From 308b3e710de3f89f6a66aec6cfc8aba433d017d0 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Fri, 31 Jul 2026 23:55:38 +0900 Subject: [PATCH 1/8] feat(report): show how the acceptance criteria themselves moved (F-5dfbac9c) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every drift detector compares code against the spec as it stands now, so one class of change is structurally invisible: rewrite a criterion to match what you built, and code and spec agree. The reversal is real and in git, but no reviewer finds it by hand. `clad report` now carries two more sections: - How the acceptance criteria moved — each criterion classified new / rewritten / removed / unchanged by joining base and head on its id, with the entry's status transition and any EARS pattern shift alongside. - Declared tests — whether each test a criterion names also moved in the range, distinguishing a real path that did not change from a placeholder the harness suggested. It grades nothing; the judgement stays with the reviewer. Two corrections that make those sections trustworthy: - The range now anchors on the merge base, not the ref's tip. Diffing tip to tip charges the base branch's own commits to the range under review; on a live repository that misattributed four untouched features. A shallow clone has no merge base, so the helper falls back to the ref and still renders. - The packet's population comes from a new status-blind enumerator rather than the changelog collector, which is a shipped-changes filter and drops planned/in_progress entries — 74% of a live range's touched entries. Verified against a real 69-feature project: 12 rewritten criteria over the range, 4 EARS polarity shifts, status transitions intact. Exit codes unchanged. Co-Authored-By: Claude Opus 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- plugins/claude-code/dist/clad.js | 753 +++++++++--------- spec.yaml | 4 +- spec/attestation.yaml | 26 +- spec/capabilities.yaml | 2 +- .../review-packet-ac-delta-5dfbac9c.yaml | 54 ++ spec/index.yaml | 1 + src/changelog/collect.ts | 64 ++ src/cli/report.ts | 55 +- src/core/git-ops.ts | 28 + src/report/ac-delta.ts | 145 ++++ src/report/report.ts | 139 +++- src/spec/reverse-index.ts | 7 +- tests/changelog/collect.test.ts | 127 ++- tests/report/ac-delta.test.ts | 163 ++++ tests/report/report-cli.test.ts | 112 +++ tests/report/report.test.ts | 132 ++- 22 files changed, 1414 insertions(+), 422 deletions(-) create mode 100644 spec/features/review-packet-ac-delta-5dfbac9c.yaml create mode 100644 src/report/ac-delta.ts create mode 100644 tests/report/ac-delta.test.ts diff --git a/README.html b/README.html index d4ec8110..7dc971b3 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2736/2736
+
2774/2774
all pass
diff --git a/README.ja.md b/README.ja.md index c9f552db..93319d2c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 | 15 段階 · 41 detectors | 270(266 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 | 15 段階 · 41 detectors | 272(268 done) | 248 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index cec6e50a..31fe3c14 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2736/2736
+
2774/2774
all pass
diff --git a/README.ko.md b/README.ko.md index b21ce565..0a59bd22 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 · all pass | 15 단계 · 41 detectors | 270 · 266 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 · all pass | 15 단계 · 41 detectors | 272 · 268 done · 자기 스펙 | 248 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 37c5b8d1..dd9064e6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 | 15 stages · 41 detectors | 270 (266 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 | 15 stages · 41 detectors | 272 (268 done) | 248 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index b8533d80..0522792c 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2736 / 2736 | 15 阶段 · 41 检测器 | 270(266 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 | 15 阶段 · 41 检测器 | 272(268 done) | 248 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index b34f9083..0f50d030 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,102 +4,102 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var Ude=Object.create;var EA=Object.defineProperty;var qde=Object.getOwnPropertyDescriptor;var Bde=Object.getOwnPropertyNames;var Hde=Object.getPrototypeOf,Gde=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{for(var r in e)EA(t,r,{get:e[r],enumerable:!0})},Zde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Bde(e))!Gde.call(t,i)&&i!==r&&EA(t,i,{get:()=>e[i],enumerable:!(n=qde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Ude(Hde(t)):{},Zde(e||!t||!t.__esModule?EA(r,"default",{value:t,enumerable:!0}):r,t));var of=v(TA=>{var by=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},AA=class extends by{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};TA.CommanderError=by;TA.InvalidArgumentError=AA});var vy=v(RA=>{var{InvalidArgumentError:Vde}=of(),OA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Vde(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Wde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}RA.Argument=OA;RA.humanReadableArgName=Wde});var CA=v(PA=>{var{humanReadableArgName:Kde}=vy(),IA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>Kde(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` -`)}displayWidth(e){return d4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return utypeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{for(var r in e)OA(t,r,{get:e[r],enumerable:!0})},efe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Yde(e))!Qde.call(t,i)&&i!==r&&OA(t,i,{get:()=>e[i],enumerable:!(n=Jde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Kde(Xde(t)):{},efe(e||!t||!t.__esModule?OA(r,"default",{value:t,enumerable:!0}):r,t));var af=v(IA=>{var wy=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},RA=class extends wy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};IA.CommanderError=wy;IA.InvalidArgumentError=RA});var xy=v(CA=>{var{InvalidArgumentError:tfe}=af(),PA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new tfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function rfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}CA.Argument=PA;CA.humanReadableArgName=rfe});var jA=v(NA=>{var{humanReadableArgName:nfe}=xy(),DA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>nfe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +`)}displayWidth(e){return h4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function d4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}PA.Help=IA;PA.stripColor=d4});var MA=v(jA=>{var{InvalidArgumentError:Jde}=of(),DA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=Yde(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new Jde(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?f4(this.name().replace(/^no-/,"")):f4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},NA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function f4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Yde(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function h4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}NA.Help=DA;NA.stripColor=h4});var zA=v(LA=>{var{InvalidArgumentError:ife}=af(),MA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ofe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ife(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?g4(this.name().replace(/^no-/,"")):g4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},FA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function g4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function ofe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}jA.Option=DA;jA.DualOptions=NA});var m4=v(p4=>{function Xde(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function Qde(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Xde(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}LA.Option=MA;LA.DualOptions=FA});var _4=v(y4=>{function sfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function afe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=sfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}p4.suggestSimilar=Qde});var _4=v(qA=>{var efe=Ge("node:events").EventEmitter,FA=Ge("node:child_process"),fo=Ge("node:path"),Sy=Ge("node:fs"),Be=Ge("node:process"),{Argument:tfe,humanReadableArgName:rfe}=vy(),{CommanderError:LA}=of(),{Help:nfe,stripColor:ife}=CA(),{Option:h4,DualOptions:ofe}=MA(),{suggestSimilar:g4}=m4(),zA=class t extends efe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>UA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>UA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>ife(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new nfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name -- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new tfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. -Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new LA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new h4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' -- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof h4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. -- 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(e,r,n){if(Sy.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist +(Did you mean ${n[0]}?)`:""}y4.suggestSimilar=afe});var w4=v(GA=>{var cfe=Ge("node:events").EventEmitter,UA=Ge("node:child_process"),fo=Ge("node:path"),$y=Ge("node:fs"),Be=Ge("node:process"),{Argument:lfe,humanReadableArgName:ufe}=xy(),{CommanderError:qA}=af(),{Help:dfe,stripColor:ffe}=jA(),{Option:b4,DualOptions:pfe}=zA(),{suggestSimilar:v4}=_4(),BA=class t extends cfe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>HA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>HA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>ffe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new dfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new lfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. +Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new qA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new b4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' +- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof b4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. +- 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(e,r,n){if($y.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=fo.resolve(u,d);if(Sy.existsSync(f))return f;if(i.includes(fo.extname(d)))return;let p=i.find(m=>Sy.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Sy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=fo.resolve(fo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=fo.basename(this._scriptPath,fo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(fo.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=y4(Be.execArgv).concat(r),c=FA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=FA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=y4(Be.execArgv).concat(r),c=FA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new LA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new LA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=fo.resolve(u,d);if($y.existsSync(f))return f;if(i.includes(fo.extname(d)))return;let p=i.find(m=>$y.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=$y.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=fo.resolve(fo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=fo.basename(this._scriptPath,fo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(fo.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=S4(Be.execArgv).concat(r),c=UA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=UA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=S4(Be.execArgv).concat(r),c=UA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new qA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new qA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` -`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ofe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=g4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=g4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} -`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>rfe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=fo.basename(e,fo.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new pfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=v4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=v4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} +`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>ufe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=fo.basename(e,fo.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function y4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function UA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}qA.Command=zA;qA.useColor=UA});var w4=v(An=>{var{Argument:b4}=vy(),{Command:BA}=_4(),{CommanderError:sfe,InvalidArgumentError:v4}=of(),{Help:afe}=CA(),{Option:S4}=MA();An.program=new BA;An.createCommand=t=>new BA(t);An.createOption=(t,e)=>new S4(t,e);An.createArgument=(t,e)=>new b4(t,e);An.Command=BA;An.Option=S4;An.Argument=b4;An.Help=afe;An.CommanderError=sfe;An.InvalidArgumentError=v4;An.InvalidOptionArgumentError=v4});var De=v(Qt=>{"use strict";var GA=Symbol.for("yaml.alias"),E4=Symbol.for("yaml.document"),wy=Symbol.for("yaml.map"),A4=Symbol.for("yaml.pair"),ZA=Symbol.for("yaml.scalar"),xy=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),pfe=t=>!!t&&typeof t=="object"&&t[po]===GA,mfe=t=>!!t&&typeof t=="object"&&t[po]===E4,hfe=t=>!!t&&typeof t=="object"&&t[po]===wy,gfe=t=>!!t&&typeof t=="object"&&t[po]===A4,T4=t=>!!t&&typeof t=="object"&&t[po]===ZA,yfe=t=>!!t&&typeof t=="object"&&t[po]===xy;function O4(t){if(t&&typeof t=="object")switch(t[po]){case wy:case xy:return!0}return!1}function _fe(t){if(t&&typeof t=="object")switch(t[po]){case GA:case wy:case ZA:case xy:return!0}return!1}var bfe=t=>(T4(t)||O4(t))&&!!t.anchor;Qt.ALIAS=GA;Qt.DOC=E4;Qt.MAP=wy;Qt.NODE_TYPE=po;Qt.PAIR=A4;Qt.SCALAR=ZA;Qt.SEQ=xy;Qt.hasAnchor=bfe;Qt.isAlias=pfe;Qt.isCollection=O4;Qt.isDocument=mfe;Qt.isMap=hfe;Qt.isNode=_fe;Qt.isPair=gfe;Qt.isScalar=T4;Qt.isSeq=yfe});var sf=v(VA=>{"use strict";var Ut=De(),Dr=Symbol("break visit"),R4=Symbol("skip children"),Ai=Symbol("remove node");function $y(t,e){let r=I4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}$y.BREAK=Dr;$y.SKIP=R4;$y.REMOVE=Ai;function Qc(t,e,r,n){let i=P4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return C4(t,n,i),Qc(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var D4=De(),vfe=sf(),Sfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},wfe=t=>t.replace(/[!,[\]{}]/g,e=>Sfe[e]),af=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+wfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&D4.isNode(e.contents)){let o={};vfe.visit(e.contents,(s,a)=>{D4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};af.defaultYaml={explicit:!1,version:"1.2"};af.defaultTags={"!!":"tag:yaml.org,2002:"};N4.Directives=af});var Ey=v(cf=>{"use strict";var j4=De(),xfe=sf();function $fe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function M4(t){let e=new Set;return xfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function F4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function kfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=M4(t));let s=F4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(j4.isScalar(s.node)||j4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}cf.anchorIsValid=$fe;cf.anchorNames=M4;cf.createNodeAnchors=kfe;cf.findNewAnchor=F4});var KA=v(L4=>{"use strict";function lf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Efe=De();function z4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>z4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Efe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}U4.toJS=z4});var Ay=v(B4=>{"use strict";var Afe=KA(),q4=De(),Tfe=Zo(),JA=class{constructor(e){Object.defineProperty(this,q4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!q4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Tfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Afe.applyReviver(o,{"":a},"",a):a}};B4.NodeBase=JA});var uf=v(H4=>{"use strict";var Ofe=Ey(),Rfe=sf(),tl=De(),Ife=Ay(),Pfe=Zo(),YA=class extends Ife.NodeBase{constructor(e){super(tl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Rfe.visit(e,{Node:(o,s)=>{(tl.isAlias(s)||tl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(Pfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ty(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Ofe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Ty(t,e,r){if(tl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(tl.isCollection(e)){let n=0;for(let i of e.items){let o=Ty(t,i,r);o>n&&(n=o)}return n}else if(tl.isPair(e)){let n=Ty(t,e.key,r),i=Ty(t,e.value,r);return Math.max(n,i)}return 1}H4.Alias=YA});var Dt=v(XA=>{"use strict";var Cfe=De(),Dfe=Ay(),Nfe=Zo(),jfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends Dfe.NodeBase{constructor(e){super(Cfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Nfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Vo.BLOCK_FOLDED="BLOCK_FOLDED";Vo.BLOCK_LITERAL="BLOCK_LITERAL";Vo.PLAIN="PLAIN";Vo.QUOTE_DOUBLE="QUOTE_DOUBLE";Vo.QUOTE_SINGLE="QUOTE_SINGLE";XA.Scalar=Vo;XA.isScalarValue=jfe});var df=v(Z4=>{"use strict";var Mfe=uf(),da=De(),G4=Dt(),Ffe="tag:yaml.org,2002:";function Lfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function zfe(t,e,r){if(da.isDocument(t)&&(t=t.contents),da.isNode(t))return t;if(da.isPair(t)){let d=r.schema[da.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Mfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ffe+e.slice(2));let l=Lfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new G4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[da.MAP]:Symbol.iterator in Object(t)?s[da.SEQ]:s[da.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new G4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Z4.createNode=zfe});var Ry=v(Oy=>{"use strict";var Ufe=df(),Ti=De(),qfe=Ay();function QA(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Ufe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var V4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,eT=class extends qfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(V4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,QA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Ti.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Ti.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,QA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Oy.Collection=eT;Oy.collectionFromPath=QA;Oy.isEmptyPath=V4});var ff=v(Iy=>{"use strict";var Bfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function tT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Hfe=(t,e,r)=>t.endsWith(` -`)?tT(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function S4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function HA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}GA.Command=BA;GA.useColor=HA});var E4=v(An=>{var{Argument:x4}=xy(),{Command:ZA}=w4(),{CommanderError:mfe,InvalidArgumentError:$4}=af(),{Help:hfe}=jA(),{Option:k4}=zA();An.program=new ZA;An.createCommand=t=>new ZA(t);An.createOption=(t,e)=>new k4(t,e);An.createArgument=(t,e)=>new x4(t,e);An.Command=ZA;An.Option=k4;An.Argument=x4;An.Help=hfe;An.CommanderError=mfe;An.InvalidArgumentError=$4;An.InvalidOptionArgumentError=$4});var De=v(Qt=>{"use strict";var WA=Symbol.for("yaml.alias"),R4=Symbol.for("yaml.document"),ky=Symbol.for("yaml.map"),I4=Symbol.for("yaml.pair"),KA=Symbol.for("yaml.scalar"),Ey=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),Sfe=t=>!!t&&typeof t=="object"&&t[po]===WA,wfe=t=>!!t&&typeof t=="object"&&t[po]===R4,xfe=t=>!!t&&typeof t=="object"&&t[po]===ky,$fe=t=>!!t&&typeof t=="object"&&t[po]===I4,P4=t=>!!t&&typeof t=="object"&&t[po]===KA,kfe=t=>!!t&&typeof t=="object"&&t[po]===Ey;function C4(t){if(t&&typeof t=="object")switch(t[po]){case ky:case Ey:return!0}return!1}function Efe(t){if(t&&typeof t=="object")switch(t[po]){case WA:case ky:case KA:case Ey:return!0}return!1}var Afe=t=>(P4(t)||C4(t))&&!!t.anchor;Qt.ALIAS=WA;Qt.DOC=R4;Qt.MAP=ky;Qt.NODE_TYPE=po;Qt.PAIR=I4;Qt.SCALAR=KA;Qt.SEQ=Ey;Qt.hasAnchor=Afe;Qt.isAlias=Sfe;Qt.isCollection=C4;Qt.isDocument=wfe;Qt.isMap=xfe;Qt.isNode=Efe;Qt.isPair=$fe;Qt.isScalar=P4;Qt.isSeq=kfe});var cf=v(JA=>{"use strict";var Ut=De(),Dr=Symbol("break visit"),D4=Symbol("skip children"),Ai=Symbol("remove node");function Ay(t,e){let r=N4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}Ay.BREAK=Dr;Ay.SKIP=D4;Ay.REMOVE=Ai;function Qc(t,e,r,n){let i=j4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return M4(t,n,i),Qc(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var F4=De(),Tfe=cf(),Ofe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rfe=t=>t.replace(/[!,[\]{}]/g,e=>Ofe[e]),lf=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Rfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&F4.isNode(e.contents)){let o={};Tfe.visit(e.contents,(s,a)=>{F4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};lf.defaultYaml={explicit:!1,version:"1.2"};lf.defaultTags={"!!":"tag:yaml.org,2002:"};L4.Directives=lf});var Oy=v(uf=>{"use strict";var z4=De(),Ife=cf();function Pfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function U4(t){let e=new Set;return Ife.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function q4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Cfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=U4(t));let s=q4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(z4.isScalar(s.node)||z4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}uf.anchorIsValid=Pfe;uf.anchorNames=U4;uf.createNodeAnchors=Cfe;uf.findNewAnchor=q4});var XA=v(B4=>{"use strict";function df(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Dfe=De();function H4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>H4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Dfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}G4.toJS=H4});var Ry=v(V4=>{"use strict";var Nfe=XA(),Z4=De(),jfe=Zo(),QA=class{constructor(e){Object.defineProperty(this,Z4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!Z4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=jfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Nfe.applyReviver(o,{"":a},"",a):a}};V4.NodeBase=QA});var ff=v(W4=>{"use strict";var Mfe=Oy(),Ffe=cf(),tl=De(),Lfe=Ry(),zfe=Zo(),eT=class extends Lfe.NodeBase{constructor(e){super(tl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Ffe.visit(e,{Node:(o,s)=>{(tl.isAlias(s)||tl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(zfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Iy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Mfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Iy(t,e,r){if(tl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(tl.isCollection(e)){let n=0;for(let i of e.items){let o=Iy(t,i,r);o>n&&(n=o)}return n}else if(tl.isPair(e)){let n=Iy(t,e.key,r),i=Iy(t,e.value,r);return Math.max(n,i)}return 1}W4.Alias=eT});var Dt=v(tT=>{"use strict";var Ufe=De(),qfe=Ry(),Bfe=Zo(),Hfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends qfe.NodeBase{constructor(e){super(Ufe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Bfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Vo.BLOCK_FOLDED="BLOCK_FOLDED";Vo.BLOCK_LITERAL="BLOCK_LITERAL";Vo.PLAIN="PLAIN";Vo.QUOTE_DOUBLE="QUOTE_DOUBLE";Vo.QUOTE_SINGLE="QUOTE_SINGLE";tT.Scalar=Vo;tT.isScalarValue=Hfe});var pf=v(J4=>{"use strict";var Gfe=ff(),fa=De(),K4=Dt(),Zfe="tag:yaml.org,2002:";function Vfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Wfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Gfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Zfe+e.slice(2));let l=Vfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new K4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new K4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}J4.createNode=Wfe});var Cy=v(Py=>{"use strict";var Kfe=pf(),Ti=De(),Jfe=Ry();function rT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Kfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Y4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nT=class extends Jfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Y4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Ti.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Ti.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Py.Collection=nT;Py.collectionFromPath=rT;Py.isEmptyPath=Y4});var mf=v(Dy=>{"use strict";var Yfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function iT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Xfe=(t,e,r)=>t.endsWith(` +`)?iT(r,e):r.includes(` `)?` -`+tT(r,e):(t.endsWith(" ")?"":" ")+r;Iy.indentComment=tT;Iy.lineComment=Hfe;Iy.stringifyComment=Bfe});var K4=v(pf=>{"use strict";var Gfe="flow",rT="block",Py="quoted";function Zfe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===rT&&(h=W4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Py&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` -`)r===rT&&(h=W4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+iT(r,e):(t.endsWith(" ")?"":" ")+r;Dy.indentComment=iT;Dy.lineComment=Xfe;Dy.stringifyComment=Yfe});var Q4=v(hf=>{"use strict";var Qfe="flow",oT="block",Ny="quoted";function epe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===oT&&(h=X4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Ny&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`)r===oT&&(h=X4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` -`&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Py){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Jn=Dt(),Wo=K4(),Dy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ny=t=>/^(%|---|\.\.\.)/m.test(t);function Vfe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function mf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ny(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Ny){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Jn=Dt(),Wo=Q4(),My=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Fy=t=>/^(%|---|\.\.\.)/m.test(t);function tpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function gf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Fy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` `);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(iT,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Wo.foldFlowLines(`${_}${w}${p}`,l,Wo.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=My(n,!0);s!=="folded"&&e!==Jn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Wo.foldFlowLines(`${_}${w}${p}`,l,Wo.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Wfe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` +${l}${_}${r}${p}`}function rpe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` `)||u&&/[[\]{},]/.test(o))return rl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?rl(o,e):Cy(t,e,r,n);if(!a&&!u&&i!==Jn.Scalar.PLAIN&&o.includes(` -`))return Cy(t,e,r,n);if(Ny(o)){if(c==="")return e.forceBlockIndent=!0,Cy(t,e,r,n);if(a&&c===l)return rl(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return rl(o,e)}return a?d:Wo.foldFlowLines(d,c,Wo.FOLD_FLOW,Dy(e,!1))}function Kfe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):Cy(s,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return mf(s.value,e);case Jn.Scalar.QUOTE_SINGLE:return nT(s.value,e);case Jn.Scalar.PLAIN:return Wfe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}J4.stringifyString=Kfe});var gf=v(oT=>{"use strict";var Jfe=Ey(),Ko=De(),Yfe=ff(),Xfe=hf();function Qfe(t,e){let r=Object.assign({blockQuote:!0,commentString:Yfe.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function epe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Ko.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function tpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&Jfe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function rpe(t,e,r,n){if(Ko.isPair(t))return t.toString(e,r,n);if(Ko.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Ko.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=epe(e.doc.schema.tags,o));let s=tpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Ko.isScalar(o)?Xfe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Ko.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}oT.createStringifyContext=Qfe;oT.stringify=rpe});var e6=v(Q4=>{"use strict";var mo=De(),Y4=Dt(),X4=gf(),yf=ff();function npe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=mo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mo.isCollection(t)||!mo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||mo.isCollection(t)||(mo.isScalar(t)?t.type===Y4.Scalar.BLOCK_FOLDED||t.type===Y4.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=X4.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=yf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=yf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=yf.lineComment(g,r.indent,l(f))));let b,_,S;mo.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&mo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=X4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +`)?rl(o,e):jy(t,e,r,n);if(!a&&!u&&i!==Jn.Scalar.PLAIN&&o.includes(` +`))return jy(t,e,r,n);if(Fy(o)){if(c==="")return e.forceBlockIndent=!0,jy(t,e,r,n);if(a&&c===l)return rl(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return rl(o,e)}return a?d:Wo.foldFlowLines(d,c,Wo.FOLD_FLOW,My(e,!1))}function npe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):jy(s,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return gf(s.value,e);case Jn.Scalar.QUOTE_SINGLE:return sT(s.value,e);case Jn.Scalar.PLAIN:return rpe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}e6.stringifyString=npe});var _f=v(cT=>{"use strict";var ipe=Oy(),Ko=De(),ope=mf(),spe=yf();function ape(t,e){let r=Object.assign({blockQuote:!0,commentString:ope.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function cpe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Ko.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function lpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&ipe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function upe(t,e,r,n){if(Ko.isPair(t))return t.toString(e,r,n);if(Ko.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Ko.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=cpe(e.doc.schema.tags,o));let s=lpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Ko.isScalar(o)?spe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Ko.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}cT.createStringifyContext=ape;cT.stringify=upe});var i6=v(n6=>{"use strict";var mo=De(),t6=Dt(),r6=_f(),bf=mf();function dpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=mo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mo.isCollection(t)||!mo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||mo.isCollection(t)||(mo.isScalar(t)?t.type===t6.Scalar.BLOCK_FOLDED||t.type===t6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=r6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=bf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=bf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=bf.lineComment(g,r.indent,l(f))));let b,_,S;mo.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&mo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=r6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${yf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${bf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` ${r.indent}`}else if(!p&&mo.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let re=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var t6=Ge("process");function ipe(t,...e){t==="debug"&&console.log(...e)}function ope(t,e){(t==="debug"||t==="warn")&&(typeof t6.emitWarning=="function"?t6.emitWarning(e):console.warn(e))}sT.debug=ipe;sT.warn=ope});var zy=v(Ly=>{"use strict";var Fy=De(),r6=Dt(),jy="<<",My={identify:t=>t===jy||typeof t=="symbol"&&t.description===jy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new r6.Scalar(Symbol(jy)),{addToJSMap:n6}),stringify:()=>jy},spe=(t,e)=>(My.identify(e)||Fy.isScalar(e)&&(!e.type||e.type===r6.Scalar.PLAIN)&&My.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===My.tag&&r.default);function n6(t,e,r){let n=i6(t,r);if(Fy.isSeq(n))for(let i of n.items)cT(t,e,i);else if(Array.isArray(n))for(let i of n)cT(t,e,i);else cT(t,e,n)}function cT(t,e,r){let n=i6(t,r);if(!Fy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function i6(t,e){return t&&Fy.isAlias(e)?e.resolve(t.doc,t):e}Ly.addMergeToJSMap=n6;Ly.isMergeKey=spe;Ly.merge=My});var uT=v(a6=>{"use strict";var ape=aT(),o6=zy(),cpe=gf(),s6=De(),lT=Zo();function lpe(t,e,{key:r,value:n}){if(s6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(o6.isMergeKey(t,r))o6.addMergeToJSMap(t,e,n);else{let i=lT.toJS(r,"",t);if(e instanceof Map)e.set(i,lT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=upe(r,i,t),s=lT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function upe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(s6.isNode(t)&&r?.doc){let n=cpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),ape.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}a6.addPairToJSMap=lpe});var Jo=v(dT=>{"use strict";var c6=df(),dpe=e6(),fpe=uT(),Uy=De();function ppe(t,e,r){let n=c6.createNode(t,void 0,r),i=c6.createNode(e,void 0,r);return new qy(n,i)}var qy=class t{constructor(e,r=null){Object.defineProperty(this,Uy.NODE_TYPE,{value:Uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Uy.isNode(r)&&(r=r.clone(e)),Uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return fpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?dpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};dT.Pair=qy;dT.createPair=ppe});var fT=v(u6=>{"use strict";var fa=De(),l6=gf(),By=ff();function mpe(t,e,r){return(e.inFlow??t.flow?gpe:hpe)(t,e,r)}function hpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=By.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var o6=Ge("process");function fpe(t,...e){t==="debug"&&console.log(...e)}function ppe(t,e){(t==="debug"||t==="warn")&&(typeof o6.emitWarning=="function"?o6.emitWarning(e):console.warn(e))}lT.debug=fpe;lT.warn=ppe});var By=v(qy=>{"use strict";var Uy=De(),s6=Dt(),Ly="<<",zy={identify:t=>t===Ly||typeof t=="symbol"&&t.description===Ly,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new s6.Scalar(Symbol(Ly)),{addToJSMap:a6}),stringify:()=>Ly},mpe=(t,e)=>(zy.identify(e)||Uy.isScalar(e)&&(!e.type||e.type===s6.Scalar.PLAIN)&&zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===zy.tag&&r.default);function a6(t,e,r){let n=c6(t,r);if(Uy.isSeq(n))for(let i of n.items)dT(t,e,i);else if(Array.isArray(n))for(let i of n)dT(t,e,i);else dT(t,e,n)}function dT(t,e,r){let n=c6(t,r);if(!Uy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function c6(t,e){return t&&Uy.isAlias(e)?e.resolve(t.doc,t):e}qy.addMergeToJSMap=a6;qy.isMergeKey=mpe;qy.merge=zy});var pT=v(d6=>{"use strict";var hpe=uT(),l6=By(),gpe=_f(),u6=De(),fT=Zo();function ype(t,e,{key:r,value:n}){if(u6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(l6.isMergeKey(t,r))l6.addMergeToJSMap(t,e,n);else{let i=fT.toJS(r,"",t);if(e instanceof Map)e.set(i,fT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=_pe(r,i,t),s=fT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function _pe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(u6.isNode(t)&&r?.doc){let n=gpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),hpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}d6.addPairToJSMap=ype});var Jo=v(mT=>{"use strict";var f6=pf(),bpe=i6(),vpe=pT(),Hy=De();function Spe(t,e,r){let n=f6.createNode(t,void 0,r),i=f6.createNode(e,void 0,r);return new Gy(n,i)}var Gy=class t{constructor(e,r=null){Object.defineProperty(this,Hy.NODE_TYPE,{value:Hy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Hy.isNode(r)&&(r=r.clone(e)),Hy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return vpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?bpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};mT.Pair=Gy;mT.createPair=Spe});var hT=v(m6=>{"use strict";var pa=De(),p6=_f(),Zy=mf();function wpe(t,e,r){return(e.inFlow??t.flow?$pe:xpe)(t,e,r)}function xpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Zy.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` -`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=By.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` +`+Zy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function $pe({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` +`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Zy.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Hy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=By.indentComment(e(n),t);r.push(o.trimStart())}}u6.stringifyCollection=mpe});var Xo=v(mT=>{"use strict";var ype=fT(),_pe=uT(),bpe=Ry(),Yo=De(),Gy=Jo(),vpe=Dt();function _f(t,e){let r=Yo.isScalar(e)?e.value:e;for(let n of t)if(Yo.isPair(n)&&(n.key===e||n.key===r||Yo.isScalar(n.key)&&n.key.value===r))return n}var pT=class extends bpe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Gy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Yo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Gy.Pair(e,e?.value):n=new Gy.Pair(e.key,e.value);let i=_f(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&vpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=_f(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=_f(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!_f(this.items,e)}set(e,r){this.add(new Gy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)_pe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Yo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ype.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};mT.YAMLMap=pT;mT.findPair=_f});var nl=v(f6=>{"use strict";var Spe=De(),d6=Xo(),wpe={collection:"map",default:!0,nodeClass:d6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Spe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>d6.YAMLMap.from(t,e,r)};f6.map=wpe});var Qo=v(p6=>{"use strict";var xpe=df(),$pe=fT(),kpe=Ry(),Vy=De(),Epe=Dt(),Ape=Zo(),hT=class extends kpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Zy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Zy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Vy.isScalar(i)?i.value:i}has(e){let r=Zy(e);return typeof r=="number"&&r=0?e:null}p6.YAMLSeq=hT});var il=v(h6=>{"use strict";var Tpe=De(),m6=Qo(),Ope={collection:"seq",default:!0,nodeClass:m6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Tpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>m6.YAMLSeq.from(t,e,r)};h6.seq=Ope});var bf=v(g6=>{"use strict";var Rpe=hf(),Ipe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Rpe.stringifyString(t,e,r,n)}};g6.string=Ipe});var Wy=v(b6=>{"use strict";var y6=Dt(),_6={identify:t=>t==null,createNode:()=>new y6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new y6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&_6.test.test(t)?t:e.options.nullStr};b6.nullTag=_6});var gT=v(S6=>{"use strict";var Ppe=Dt(),v6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ppe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&v6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};S6.boolTag=v6});var ol=v(w6=>{"use strict";function Cpe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}w6.stringifyNumber=Cpe});var _T=v(Ky=>{"use strict";var Dpe=Dt(),yT=ol(),Npe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:yT.stringifyNumber},jpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():yT.stringifyNumber(t)}},Mpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Dpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:yT.stringifyNumber};Ky.float=Mpe;Ky.floatExp=jpe;Ky.floatNaN=Npe});var vT=v(Yy=>{"use strict";var x6=ol(),Jy=t=>typeof t=="bigint"||Number.isInteger(t),bT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function $6(t,e,r){let{value:n}=t;return Jy(n)&&n>=0?r+n.toString(e):x6.stringifyNumber(t)}var Fpe={identify:t=>Jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>bT(t,2,8,r),stringify:t=>$6(t,8,"0o")},Lpe={identify:Jy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>bT(t,0,10,r),stringify:x6.stringifyNumber},zpe={identify:t=>Jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>bT(t,2,16,r),stringify:t=>$6(t,16,"0x")};Yy.int=Lpe;Yy.intHex=zpe;Yy.intOct=Fpe});var E6=v(k6=>{"use strict";var Upe=nl(),qpe=Wy(),Bpe=il(),Hpe=bf(),Gpe=gT(),ST=_T(),wT=vT(),Zpe=[Upe.map,Bpe.seq,Hpe.string,qpe.nullTag,Gpe.boolTag,wT.intOct,wT.int,wT.intHex,ST.floatNaN,ST.floatExp,ST.float];k6.schema=Zpe});var O6=v(T6=>{"use strict";var Vpe=Dt(),Wpe=nl(),Kpe=il();function A6(t){return typeof t=="bigint"||Number.isInteger(t)}var Xy=({value:t})=>JSON.stringify(t),Jpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Xy},{identify:t=>t==null,createNode:()=>new Vpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Xy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Xy},{identify:A6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>A6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Xy}],Ype={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Xpe=[Wpe.map,Kpe.seq].concat(Jpe,Ype);T6.schema=Xpe});var $T=v(R6=>{"use strict";var vf=Ge("buffer"),xT=Dt(),Qpe=hf(),eme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof vf.Buffer=="function")return vf.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var Qy=De(),kT=Jo(),tme=Dt(),rme=Qo();function I6(t,e){if(Qy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new kT.Pair(new tme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Vy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Zy.indentComment(e(n),t);r.push(o.trimStart())}}m6.stringifyCollection=wpe});var Xo=v(yT=>{"use strict";var kpe=hT(),Epe=pT(),Ape=Cy(),Yo=De(),Wy=Jo(),Tpe=Dt();function vf(t,e){let r=Yo.isScalar(e)?e.value:e;for(let n of t)if(Yo.isPair(n)&&(n.key===e||n.key===r||Yo.isScalar(n.key)&&n.key.value===r))return n}var gT=class extends Ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Wy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Yo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Wy.Pair(e,e?.value):n=new Wy.Pair(e.key,e.value);let i=vf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&Tpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=vf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=vf(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!vf(this.items,e)}set(e,r){this.add(new Wy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Epe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Yo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),kpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};yT.YAMLMap=gT;yT.findPair=vf});var nl=v(g6=>{"use strict";var Ope=De(),h6=Xo(),Rpe={collection:"map",default:!0,nodeClass:h6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ope.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>h6.YAMLMap.from(t,e,r)};g6.map=Rpe});var Qo=v(y6=>{"use strict";var Ipe=pf(),Ppe=hT(),Cpe=Cy(),Jy=De(),Dpe=Dt(),Npe=Zo(),_T=class extends Cpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ky(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ky(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Jy.isScalar(i)?i.value:i}has(e){let r=Ky(e);return typeof r=="number"&&r=0?e:null}y6.YAMLSeq=_T});var il=v(b6=>{"use strict";var jpe=De(),_6=Qo(),Mpe={collection:"seq",default:!0,nodeClass:_6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return jpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>_6.YAMLSeq.from(t,e,r)};b6.seq=Mpe});var Sf=v(v6=>{"use strict";var Fpe=yf(),Lpe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Fpe.stringifyString(t,e,r,n)}};v6.string=Lpe});var Yy=v(x6=>{"use strict";var S6=Dt(),w6={identify:t=>t==null,createNode:()=>new S6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&w6.test.test(t)?t:e.options.nullStr};x6.nullTag=w6});var bT=v(k6=>{"use strict";var zpe=Dt(),$6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new zpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&$6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};k6.boolTag=$6});var ol=v(E6=>{"use strict";function Upe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}E6.stringifyNumber=Upe});var ST=v(Xy=>{"use strict";var qpe=Dt(),vT=ol(),Bpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vT.stringifyNumber},Hpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():vT.stringifyNumber(t)}},Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new qpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:vT.stringifyNumber};Xy.float=Gpe;Xy.floatExp=Hpe;Xy.floatNaN=Bpe});var xT=v(e_=>{"use strict";var A6=ol(),Qy=t=>typeof t=="bigint"||Number.isInteger(t),wT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function T6(t,e,r){let{value:n}=t;return Qy(n)&&n>=0?r+n.toString(e):A6.stringifyNumber(t)}var Zpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>wT(t,2,8,r),stringify:t=>T6(t,8,"0o")},Vpe={identify:Qy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>wT(t,0,10,r),stringify:A6.stringifyNumber},Wpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>wT(t,2,16,r),stringify:t=>T6(t,16,"0x")};e_.int=Vpe;e_.intHex=Wpe;e_.intOct=Zpe});var R6=v(O6=>{"use strict";var Kpe=nl(),Jpe=Yy(),Ype=il(),Xpe=Sf(),Qpe=bT(),$T=ST(),kT=xT(),eme=[Kpe.map,Ype.seq,Xpe.string,Jpe.nullTag,Qpe.boolTag,kT.intOct,kT.int,kT.intHex,$T.floatNaN,$T.floatExp,$T.float];O6.schema=eme});var C6=v(P6=>{"use strict";var tme=Dt(),rme=nl(),nme=il();function I6(t){return typeof t=="bigint"||Number.isInteger(t)}var t_=({value:t})=>JSON.stringify(t),ime=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:t_},{identify:t=>t==null,createNode:()=>new tme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:t_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:t_},{identify:I6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>I6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:t_}],ome={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},sme=[rme.map,nme.seq].concat(ime,ome);P6.schema=sme});var AT=v(D6=>{"use strict";var wf=Ge("buffer"),ET=Dt(),ame=yf(),cme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof wf.Buffer=="function")return wf.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var r_=De(),TT=Jo(),lme=Dt(),ume=Qo();function N6(t,e){if(r_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new TT.Pair(new lme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=Qy.isPair(n)?n:new kT.Pair(n)}}else e("Expected a sequence for this tag");return t}function P6(t,e,r){let{replacer:n}=r,i=new rme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(kT.createPair(a,c,r))}return i}var nme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:I6,createNode:P6};e_.createPairs=P6;e_.pairs=nme;e_.resolvePairs=I6});var TT=v(AT=>{"use strict";var C6=De(),ET=Zo(),Sf=Xo(),ime=Qo(),D6=t_(),pa=class t extends ime.YAMLSeq{constructor(){super(),this.add=Sf.YAMLMap.prototype.add.bind(this),this.delete=Sf.YAMLMap.prototype.delete.bind(this),this.get=Sf.YAMLMap.prototype.get.bind(this),this.has=Sf.YAMLMap.prototype.has.bind(this),this.set=Sf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(C6.isPair(i)?(o=ET.toJS(i.key,"",r),s=ET.toJS(i.value,o,r)):o=ET.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=D6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};pa.tag="tag:yaml.org,2002:omap";var ome={collection:"seq",identify:t=>t instanceof Map,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=D6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)C6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new pa,r)},createNode:(t,e,r)=>pa.from(t,e,r)};AT.YAMLOMap=pa;AT.omap=ome});var L6=v(OT=>{"use strict";var N6=Dt();function j6({value:t,source:e},r){return e&&(t?M6:F6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var M6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N6.Scalar(!0),stringify:j6},F6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new N6.Scalar(!1),stringify:j6};OT.falseTag=F6;OT.trueTag=M6});var z6=v(r_=>{"use strict";var sme=Dt(),RT=ol(),ame={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:RT.stringifyNumber},cme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():RT.stringifyNumber(t)}},lme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new sme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:RT.stringifyNumber};r_.float=lme;r_.floatExp=cme;r_.floatNaN=ame});var q6=v(xf=>{"use strict";var U6=ol(),wf=t=>typeof t=="bigint"||Number.isInteger(t);function n_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function IT(t,e,r){let{value:n}=t;if(wf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return U6.stringifyNumber(t)}var ume={identify:wf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>n_(t,2,2,r),stringify:t=>IT(t,2,"0b")},dme={identify:wf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>n_(t,1,8,r),stringify:t=>IT(t,8,"0")},fme={identify:wf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>n_(t,0,10,r),stringify:U6.stringifyNumber},pme={identify:wf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>n_(t,2,16,r),stringify:t=>IT(t,16,"0x")};xf.int=fme;xf.intBin=ume;xf.intHex=pme;xf.intOct=dme});var CT=v(PT=>{"use strict";var s_=De(),i_=Jo(),o_=Xo(),ma=class t extends o_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;s_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new i_.Pair(e.key,null):r=new i_.Pair(e,null),o_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=o_.findPair(this.items,e);return!r&&s_.isPair(n)?s_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=o_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new i_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(i_.createPair(s,null,n));return o}};ma.tag="tag:yaml.org,2002:set";var mme={collection:"map",identify:t=>t instanceof Set,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ma.from(t,e,r),resolve(t,e){if(s_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ma,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};PT.YAMLSet=ma;PT.set=mme});var NT=v(a_=>{"use strict";var hme=ol();function DT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function B6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return hme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var gme={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>DT(t,r),stringify:B6},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>DT(t,!1),stringify:B6},H6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(H6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=DT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};a_.floatTime=yme;a_.intTime=gme;a_.timestamp=H6});var V6=v(Z6=>{"use strict";var _me=nl(),bme=Wy(),vme=il(),Sme=bf(),wme=$T(),G6=L6(),jT=z6(),c_=q6(),xme=zy(),$me=TT(),kme=t_(),Eme=CT(),MT=NT(),Ame=[_me.map,vme.seq,Sme.string,bme.nullTag,G6.trueTag,G6.falseTag,c_.intBin,c_.intOct,c_.int,c_.intHex,jT.floatNaN,jT.floatExp,jT.float,wme.binary,xme.merge,$me.omap,kme.pairs,Eme.set,MT.intTime,MT.floatTime,MT.timestamp];Z6.schema=Ame});var nB=v(zT=>{"use strict";var Y6=nl(),Tme=Wy(),X6=il(),Ome=bf(),Rme=gT(),FT=_T(),LT=vT(),Ime=E6(),Pme=O6(),Q6=$T(),$f=zy(),eB=TT(),tB=t_(),W6=V6(),rB=CT(),l_=NT(),K6=new Map([["core",Ime.schema],["failsafe",[Y6.map,X6.seq,Ome.string]],["json",Pme.schema],["yaml11",W6.schema],["yaml-1.1",W6.schema]]),J6={binary:Q6.binary,bool:Rme.boolTag,float:FT.float,floatExp:FT.floatExp,floatNaN:FT.floatNaN,floatTime:l_.floatTime,int:LT.int,intHex:LT.intHex,intOct:LT.intOct,intTime:l_.intTime,map:Y6.map,merge:$f.merge,null:Tme.nullTag,omap:eB.omap,pairs:tB.pairs,seq:X6.seq,set:rB.set,timestamp:l_.timestamp},Cme={"tag:yaml.org,2002:binary":Q6.binary,"tag:yaml.org,2002:merge":$f.merge,"tag:yaml.org,2002:omap":eB.omap,"tag:yaml.org,2002:pairs":tB.pairs,"tag:yaml.org,2002:set":rB.set,"tag:yaml.org,2002:timestamp":l_.timestamp};function Dme(t,e,r){let n=K6.get(e);if(n&&!t)return r&&!n.includes($f.merge)?n.concat($f.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(K6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat($f.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?J6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(J6).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}zT.coreKnownTags=Cme;zT.getTags=Dme});var BT=v(iB=>{"use strict";var UT=De(),Nme=nl(),jme=il(),Mme=bf(),u_=nB(),Fme=(t,e)=>t.keye.key?1:0,qT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?u_.getTags(e,"compat"):e?u_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?u_.coreKnownTags:{},this.tags=u_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,UT.MAP,{value:Nme.map}),Object.defineProperty(this,UT.SCALAR,{value:Mme.string}),Object.defineProperty(this,UT.SEQ,{value:jme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Fme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};iB.Schema=qT});var sB=v(oB=>{"use strict";var Lme=De(),HT=gf(),kf=ff();function zme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=HT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(kf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Lme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(kf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=HT.stringify(t.contents,i,()=>a=null,c);a&&(l+=kf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(HT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(kf.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(kf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=r_.isPair(n)?n:new TT.Pair(n)}}else e("Expected a sequence for this tag");return t}function j6(t,e,r){let{replacer:n}=r,i=new ume.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(TT.createPair(a,c,r))}return i}var dme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:N6,createNode:j6};n_.createPairs=j6;n_.pairs=dme;n_.resolvePairs=N6});var IT=v(RT=>{"use strict";var M6=De(),OT=Zo(),xf=Xo(),fme=Qo(),F6=i_(),ma=class t extends fme.YAMLSeq{constructor(){super(),this.add=xf.YAMLMap.prototype.add.bind(this),this.delete=xf.YAMLMap.prototype.delete.bind(this),this.get=xf.YAMLMap.prototype.get.bind(this),this.has=xf.YAMLMap.prototype.has.bind(this),this.set=xf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(M6.isPair(i)?(o=OT.toJS(i.key,"",r),s=OT.toJS(i.value,o,r)):o=OT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=F6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var pme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=F6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)M6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};RT.YAMLOMap=ma;RT.omap=pme});var B6=v(PT=>{"use strict";var L6=Dt();function z6({value:t,source:e},r){return e&&(t?U6:q6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var U6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new L6.Scalar(!0),stringify:z6},q6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new L6.Scalar(!1),stringify:z6};PT.falseTag=q6;PT.trueTag=U6});var H6=v(o_=>{"use strict";var mme=Dt(),CT=ol(),hme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:CT.stringifyNumber},gme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():CT.stringifyNumber(t)}},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new mme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:CT.stringifyNumber};o_.float=yme;o_.floatExp=gme;o_.floatNaN=hme});var Z6=v(kf=>{"use strict";var G6=ol(),$f=t=>typeof t=="bigint"||Number.isInteger(t);function s_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function DT(t,e,r){let{value:n}=t;if($f(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return G6.stringifyNumber(t)}var _me={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>s_(t,2,2,r),stringify:t=>DT(t,2,"0b")},bme={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>s_(t,1,8,r),stringify:t=>DT(t,8,"0")},vme={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>s_(t,0,10,r),stringify:G6.stringifyNumber},Sme={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>s_(t,2,16,r),stringify:t=>DT(t,16,"0x")};kf.int=vme;kf.intBin=_me;kf.intHex=Sme;kf.intOct=bme});var jT=v(NT=>{"use strict";var l_=De(),a_=Jo(),c_=Xo(),ha=class t extends c_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;l_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new a_.Pair(e.key,null):r=new a_.Pair(e,null),c_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=c_.findPair(this.items,e);return!r&&l_.isPair(n)?l_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=c_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new a_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(a_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var wme={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(l_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};NT.YAMLSet=ha;NT.set=wme});var FT=v(u_=>{"use strict";var xme=ol();function MT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function V6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return xme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $me={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>MT(t,r),stringify:V6},kme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>MT(t,!1),stringify:V6},W6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(W6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=MT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};u_.floatTime=kme;u_.intTime=$me;u_.timestamp=W6});var Y6=v(J6=>{"use strict";var Eme=nl(),Ame=Yy(),Tme=il(),Ome=Sf(),Rme=AT(),K6=B6(),LT=H6(),d_=Z6(),Ime=By(),Pme=IT(),Cme=i_(),Dme=jT(),zT=FT(),Nme=[Eme.map,Tme.seq,Ome.string,Ame.nullTag,K6.trueTag,K6.falseTag,d_.intBin,d_.intOct,d_.int,d_.intHex,LT.floatNaN,LT.floatExp,LT.float,Rme.binary,Ime.merge,Pme.omap,Cme.pairs,Dme.set,zT.intTime,zT.floatTime,zT.timestamp];J6.schema=Nme});var aB=v(BT=>{"use strict";var tB=nl(),jme=Yy(),rB=il(),Mme=Sf(),Fme=bT(),UT=ST(),qT=xT(),Lme=R6(),zme=C6(),nB=AT(),Ef=By(),iB=IT(),oB=i_(),X6=Y6(),sB=jT(),f_=FT(),Q6=new Map([["core",Lme.schema],["failsafe",[tB.map,rB.seq,Mme.string]],["json",zme.schema],["yaml11",X6.schema],["yaml-1.1",X6.schema]]),eB={binary:nB.binary,bool:Fme.boolTag,float:UT.float,floatExp:UT.floatExp,floatNaN:UT.floatNaN,floatTime:f_.floatTime,int:qT.int,intHex:qT.intHex,intOct:qT.intOct,intTime:f_.intTime,map:tB.map,merge:Ef.merge,null:jme.nullTag,omap:iB.omap,pairs:oB.pairs,seq:rB.seq,set:sB.set,timestamp:f_.timestamp},Ume={"tag:yaml.org,2002:binary":nB.binary,"tag:yaml.org,2002:merge":Ef.merge,"tag:yaml.org,2002:omap":iB.omap,"tag:yaml.org,2002:pairs":oB.pairs,"tag:yaml.org,2002:set":sB.set,"tag:yaml.org,2002:timestamp":f_.timestamp};function qme(t,e,r){let n=Q6.get(e);if(n&&!t)return r&&!n.includes(Ef.merge)?n.concat(Ef.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Q6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ef.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?eB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(eB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}BT.coreKnownTags=Ume;BT.getTags=qme});var ZT=v(cB=>{"use strict";var HT=De(),Bme=nl(),Hme=il(),Gme=Sf(),p_=aB(),Zme=(t,e)=>t.keye.key?1:0,GT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?p_.getTags(e,"compat"):e?p_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?p_.coreKnownTags:{},this.tags=p_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,HT.MAP,{value:Bme.map}),Object.defineProperty(this,HT.SCALAR,{value:Gme.string}),Object.defineProperty(this,HT.SEQ,{value:Hme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Zme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};cB.Schema=GT});var uB=v(lB=>{"use strict";var Vme=De(),VT=_f(),Af=mf();function Wme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=VT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Af.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Vme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Af.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=VT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Af.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(VT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(Af.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Af.indentComment(o(c),"")))}return r.join(` `)+` -`}oB.stringifyDocument=zme});var Ef=v(aB=>{"use strict";var Ume=uf(),sl=Ry(),Tn=De(),qme=Jo(),Bme=Zo(),Hme=BT(),Gme=sB(),GT=Ey(),Zme=KA(),Vme=df(),ZT=WA(),VT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new ZT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Tn.NODE_TYPE]:{value:Tn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Tn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){al(this.contents)&&this.contents.add(e)}addIn(e,r){al(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=GT.anchorNames(this);e.anchor=!r||n.has(r)?GT.findNewAnchor(r||"a",n):r}return new Ume.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=GT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Vme.createNode(e,u,m);return a&&Tn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new qme.Pair(i,o)}delete(e){return al(this.contents)?this.contents.delete(e):!1}deleteIn(e){return sl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):al(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Tn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&Tn.isScalar(this.contents)?this.contents.value:this.contents:Tn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Tn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:Tn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=sl.collectionFromPath(this.schema,[e],r):al(this.contents)&&this.contents.set(e,r)}setIn(e,r){sl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=sl.collectionFromPath(this.schema,Array.from(e),r):al(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ZT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ZT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Hme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Bme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Zme.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Gme.stringifyDocument(this,e)}};function al(t){if(Tn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}aB.Document=VT});var Of=v(Tf=>{"use strict";var Af=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},WT=class extends Af{constructor(e,r,n){super("YAMLParseError",e,r,n)}},KT=class extends Af{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Wme=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}lB.stringifyDocument=Wme});var Tf=v(dB=>{"use strict";var Kme=ff(),sl=Cy(),Tn=De(),Jme=Jo(),Yme=Zo(),Xme=ZT(),Qme=uB(),WT=Oy(),ehe=XA(),the=pf(),KT=YA(),JT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new KT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Tn.NODE_TYPE]:{value:Tn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Tn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){al(this.contents)&&this.contents.add(e)}addIn(e,r){al(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=WT.anchorNames(this);e.anchor=!r||n.has(r)?WT.findNewAnchor(r||"a",n):r}return new Kme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=WT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=the.createNode(e,u,m);return a&&Tn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Jme.Pair(i,o)}delete(e){return al(this.contents)?this.contents.delete(e):!1}deleteIn(e){return sl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):al(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Tn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&Tn.isScalar(this.contents)?this.contents.value:this.contents:Tn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Tn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:Tn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=sl.collectionFromPath(this.schema,[e],r):al(this.contents)&&this.contents.set(e,r)}setIn(e,r){sl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=sl.collectionFromPath(this.schema,Array.from(e),r):al(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new KT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new KT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Xme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Yme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?ehe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Qme.stringifyDocument(this,e)}};function al(t){if(Tn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}dB.Document=JT});var If=v(Rf=>{"use strict";var Of=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},YT=class extends Of{constructor(e,r,n){super("YAMLParseError",e,r,n)}},XT=class extends Of{constructor(e,r,n){super("YAMLWarning",e,r,n)}},rhe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};Tf.YAMLError=Af;Tf.YAMLParseError=WT;Tf.YAMLWarning=KT;Tf.prettifyError=Wme});var Rf=v(cB=>{"use strict";function Kme(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}cB.resolveProps=Kme});var d_=v(lB=>{"use strict";function JT(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(JT(e.key)||JT(e.value))return!0}return!1;default:return!0}}lB.containsNewline=JT});var YT=v(uB=>{"use strict";var Jme=d_();function Yme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Jme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}uB.flowIndentCheck=Yme});var XT=v(fB=>{"use strict";var dB=De();function Xme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||dB.isScalar(o)&&dB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}fB.mapIncludes=Xme});var _B=v(yB=>{"use strict";var pB=Jo(),Qme=Xo(),mB=Rf(),ehe=d_(),hB=YT(),the=XT(),gB="All mapping items must start at the same column";function rhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Qme.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=mB.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",gB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||ehe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",gB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&hB.flowIndentCheck(n.indent,f,i),r.atKey=!1,the.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=mB.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var nhe=Qo(),ihe=Rf(),ohe=YT();function she({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??nhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=ihe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&ohe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}bB.resolveBlockSeq=she});var cl=v(SB=>{"use strict";function ahe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}SB.resolveEnd=ahe});var kB=v($B=>{"use strict";var che=De(),lhe=Jo(),wB=Xo(),uhe=Qo(),dhe=cl(),xB=Rf(),fhe=d_(),phe=XT(),QT="Block collections are not allowed within flow collections",eO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?wB.YAMLMap:uhe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=dhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}$B.resolveFlowCollection=mhe});var AB=v(EB=>{"use strict";var hhe=De(),ghe=Dt(),yhe=Xo(),_he=Qo(),bhe=_B(),vhe=vB(),She=kB();function tO(t,e,r,n,i,o){let s=r.type==="block-map"?bhe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?vhe.resolveBlockSeq(t,e,r,n,o):She.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function whe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),tO(t,e,r,i,s)}let l=tO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=hhe.isNode(u)?u:new ghe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}EB.composeCollection=whe});var nO=v(TB=>{"use strict";var rO=Dt();function xhe(t,e,r){let n=e.offset,i=$he(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?rO.Scalar.BLOCK_FOLDED:rO.Scalar.BLOCK_LITERAL,s=e.source?khe(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`}};Rf.YAMLError=Of;Rf.YAMLParseError=YT;Rf.YAMLWarning=XT;Rf.prettifyError=rhe});var Pf=v(fB=>{"use strict";function nhe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}fB.resolveProps=nhe});var m_=v(pB=>{"use strict";function QT(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(QT(e.key)||QT(e.value))return!0}return!1;default:return!0}}pB.containsNewline=QT});var eO=v(mB=>{"use strict";var ihe=m_();function ohe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&ihe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}mB.flowIndentCheck=ohe});var tO=v(gB=>{"use strict";var hB=De();function she(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||hB.isScalar(o)&&hB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}gB.mapIncludes=she});var wB=v(SB=>{"use strict";var yB=Jo(),ahe=Xo(),_B=Pf(),che=m_(),bB=eO(),lhe=tO(),vB="All mapping items must start at the same column";function uhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??ahe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=_B.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",vB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||che.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",vB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&bB.flowIndentCheck(n.indent,f,i),r.atKey=!1,lhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=_B.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var dhe=Qo(),fhe=Pf(),phe=eO();function mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??dhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=fhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&phe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}xB.resolveBlockSeq=mhe});var cl=v(kB=>{"use strict";function hhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}kB.resolveEnd=hhe});var OB=v(TB=>{"use strict";var ghe=De(),yhe=Jo(),EB=Xo(),_he=Qo(),bhe=cl(),AB=Pf(),vhe=m_(),She=tO(),rO="Block collections are not allowed within flow collections",nO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function whe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?EB.YAMLMap:_he.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=bhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}TB.resolveFlowCollection=whe});var IB=v(RB=>{"use strict";var xhe=De(),$he=Dt(),khe=Xo(),Ehe=Qo(),Ahe=wB(),The=$B(),Ohe=OB();function iO(t,e,r,n,i,o){let s=r.type==="block-map"?Ahe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?The.resolveBlockSeq(t,e,r,n,o):Ohe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Rhe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),iO(t,e,r,i,s)}let l=iO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=xhe.isNode(u)?u:new $he.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}RB.composeCollection=Rhe});var sO=v(PB=>{"use strict";var oO=Dt();function Ihe(t,e,r){let n=e.offset,i=Phe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?oO.Scalar.BLOCK_FOLDED:oO.Scalar.BLOCK_LITERAL,s=e.source?Che(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -112,91 +112,92 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function $he({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var iO=Dt(),Ehe=cl();function Ahe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=iO.Scalar.PLAIN,c=The(o,l);break;case"single-quoted-scalar":a=iO.Scalar.QUOTE_SINGLE,c=Ohe(o,l);break;case"double-quoted-scalar":a=iO.Scalar.QUOTE_DOUBLE,c=Rhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=Ehe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function The(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),OB(t)}function Ohe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),OB(t.slice(1,-1)).replace(/''/g,"'")}function OB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var aO=Dt(),Dhe=cl();function Nhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=aO.Scalar.PLAIN,c=jhe(o,l);break;case"single-quoted-scalar":a=aO.Scalar.QUOTE_SINGLE,c=Mhe(o,l);break;case"double-quoted-scalar":a=aO.Scalar.QUOTE_DOUBLE,c=Fhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=Dhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function jhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),CB(t)}function Mhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),CB(t.slice(1,-1)).replace(/''/g,"'")}function CB(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Ihe(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Lhe(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Phe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Che(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}RB.resolveFlowScalar=Ahe});var CB=v(PB=>{"use strict";var ha=De(),IB=Dt(),Dhe=nO(),Nhe=oO();function jhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Dhe.resolveBlockScalar(t,e,n):Nhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ha.SCALAR]:c?l=Mhe(t.schema,i,c,r,n):e.type==="scalar"?l=Fhe(t,i,e,n):l=t.schema[ha.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ha.isScalar(d)?d:new IB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new IB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Mhe(t,e,r,n,i){if(r==="!")return t[ha.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ha.SCALAR])}function Fhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ha.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ha.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}PB.composeScalar=jhe});var NB=v(DB=>{"use strict";function Lhe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}DB.emptyScalarPosition=Lhe});var FB=v(aO=>{"use strict";var zhe=uf(),Uhe=De(),qhe=AB(),jB=CB(),Bhe=cl(),Hhe=NB(),Ghe={composeNode:MB,composeEmptyNode:sO};function MB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=Zhe(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=jB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=qhe.composeCollection(Ghe,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=sO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Uhe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function sO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Hhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=jB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Zhe({options:t},{offset:e,source:r,end:n},i){let o=new zhe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Bhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}aO.composeEmptyNode=sO;aO.composeNode=MB});var UB=v(zB=>{"use strict";var Vhe=Ef(),LB=FB(),Whe=cl(),Khe=Rf();function Jhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Vhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Khe.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?LB.composeNode(l,i,u,s):LB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Whe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}zB.composeDoc=Jhe});var lO=v(HB=>{"use strict";var Yhe=Ge("process"),Xhe=WA(),Qhe=Ef(),If=Of(),qB=De(),ege=UB(),tge=cl();function Pf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function BB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ga=De(),NB=Dt(),qhe=sO(),Bhe=cO();function Hhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?qhe.resolveBlockScalar(t,e,n):Bhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Ghe(t.schema,i,c,r,n):e.type==="scalar"?l=Zhe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new NB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new NB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ghe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Zhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}jB.composeScalar=Hhe});var LB=v(FB=>{"use strict";function Vhe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}FB.emptyScalarPosition=Vhe});var qB=v(uO=>{"use strict";var Whe=ff(),Khe=De(),Jhe=IB(),zB=MB(),Yhe=cl(),Xhe=LB(),Qhe={composeNode:UB,composeEmptyNode:lO};function UB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=ege(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=zB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Jhe.composeCollection(Qhe,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=lO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Khe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function lO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Xhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=zB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function ege({options:t},{offset:e,source:r,end:n},i){let o=new Whe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Yhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}uO.composeEmptyNode=lO;uO.composeNode=UB});var GB=v(HB=>{"use strict";var tge=Tf(),BB=qB(),rge=cl(),nge=Pf();function ige(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new tge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=nge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?BB.composeNode(l,i,u,s):BB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=rge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}HB.composeDoc=ige});var fO=v(WB=>{"use strict";var oge=Ge("process"),sge=YA(),age=Tf(),Cf=If(),ZB=De(),cge=GB(),lge=cl();function Df(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function VB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Pf(r);o?this.warnings.push(new If.YAMLWarning(s,n,i)):this.errors.push(new If.YAMLParseError(s,n,i))},this.directives=new Xhe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=BB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(qB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];qB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var dO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Df(r);o?this.warnings.push(new Cf.YAMLWarning(s,n,i)):this.errors.push(new Cf.YAMLParseError(s,n,i))},this.directives=new sge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=VB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(ZB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];ZB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=Pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=ege.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new If.YAMLParseError(Pf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new If.YAMLParseError(Pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=tge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new If.YAMLParseError(Pf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new Qhe.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};HB.Composer=cO});var VB=v(f_=>{"use strict";var rge=nO(),nge=oO(),ige=Of(),GB=hf();function oge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new ige.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return nge.resolveFlowScalar(t,e,n);case"block-scalar":return rge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function sge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=GB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=Df(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=cge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Cf.YAMLParseError(Df(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Cf.YAMLParseError(Df(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=lge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Cf.YAMLParseError(Df(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new age.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};WB.Composer=dO});var YB=v(h_=>{"use strict";var uge=sO(),dge=cO(),fge=If(),KB=yf();function pge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new fge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return dge.resolveFlowScalar(t,e,n);case"block-scalar":return uge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function mge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=KB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` -`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return ZB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function age(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=GB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":cge(t,c);break;case'"':uO(t,c,"double-quoted-scalar");break;case"'":uO(t,c,"single-quoted-scalar");break;default:uO(t,c,"scalar")}}function cge(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return JB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function hge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=KB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":gge(t,c);break;case'"':pO(t,c,"double-quoted-scalar");break;case"'":pO(t,c,"single-quoted-scalar");break;default:pO(t,c,"scalar")}}function gge(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` -`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];ZB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` -`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function ZB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function uO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}f_.createScalarToken=sge;f_.resolveAsScalar=oge;f_.setScalarValue=age});var KB=v(WB=>{"use strict";var lge=t=>"type"in t?m_(t):p_(t);function m_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=m_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=p_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=p_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=p_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function p_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=m_(e)),r)for(let o of r)i+=o.source;return n&&(i+=m_(n)),i}WB.stringify=lge});var QB=v(XB=>{"use strict";var dO=Symbol("break visit"),uge=Symbol("skip children"),JB=Symbol("remove item");function ga(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),YB(Object.freeze([]),t,e)}ga.BREAK=dO;ga.SKIP=uge;ga.REMOVE=JB;ga.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ga.parentCollection=(t,e)=>{let r=ga.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function YB(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var fO=VB(),dge=KB(),fge=QB(),pO="\uFEFF",mO="",hO="",gO="",pge=t=>!!t&&"items"in t,mge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function hge(t){switch(t){case pO:return"";case mO:return"";case hO:return"";case gO:return"";default:return JSON.stringify(t)}}function gge(t){switch(t){case pO:return"byte-order-mark";case mO:return"doc-mode";case hO:return"flow-error-end";case gO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];JB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function JB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function pO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}h_.createScalarToken=mge;h_.resolveAsScalar=pge;h_.setScalarValue=hge});var QB=v(XB=>{"use strict";var yge=t=>"type"in t?y_(t):g_(t);function y_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=y_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=g_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=g_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=g_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function g_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=y_(e)),r)for(let o of r)i+=o.source;return n&&(i+=y_(n)),i}XB.stringify=yge});var nH=v(rH=>{"use strict";var mO=Symbol("break visit"),_ge=Symbol("skip children"),eH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),tH(Object.freeze([]),t,e)}ya.BREAK=mO;ya.SKIP=_ge;ya.REMOVE=eH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function tH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var hO=YB(),bge=QB(),vge=nH(),gO="\uFEFF",yO="",_O="",bO="",Sge=t=>!!t&&"items"in t,wge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function xge(t){switch(t){case gO:return"";case yO:return"";case _O:return"";case bO:return"";default:return JSON.stringify(t)}}function $ge(t){switch(t){case gO:return"byte-order-mark";case yO:return"doc-mode";case _O:return"flow-error-end";case bO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Nr.createScalarToken=fO.createScalarToken;Nr.resolveAsScalar=fO.resolveAsScalar;Nr.setScalarValue=fO.setScalarValue;Nr.stringify=dge.stringify;Nr.visit=fge.visit;Nr.BOM=pO;Nr.DOCUMENT=mO;Nr.FLOW_END=hO;Nr.SCALAR=gO;Nr.isCollection=pge;Nr.isScalar=mge;Nr.prettyToken=hge;Nr.tokenType=gge});var bO=v(tH=>{"use strict";var Cf=h_();function Yn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var eH=new Set("0123456789ABCDEFabcdef"),yge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),g_=new Set(",[]{}"),_ge=new Set(` ,[]{} -\r `),yO=t=>!t||_ge.has(t),_O=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Nr.createScalarToken=hO.createScalarToken;Nr.resolveAsScalar=hO.resolveAsScalar;Nr.setScalarValue=hO.setScalarValue;Nr.stringify=bge.stringify;Nr.visit=vge.visit;Nr.BOM=gO;Nr.DOCUMENT=yO;Nr.FLOW_END=_O;Nr.SCALAR=bO;Nr.isCollection=Sge;Nr.isScalar=wge;Nr.prettyToken=xge;Nr.tokenType=$ge});var wO=v(oH=>{"use strict";var Nf=__();function Yn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var iH=new Set("0123456789ABCDEFabcdef"),kge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),b_=new Set(",[]{}"),Ege=new Set(` ,[]{} +\r `),vO=t=>!t||Ege.has(t),SO=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Yn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Yn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Yn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(yO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&nthis.indentValue&&!Yn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Yn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(vO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Yn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Cf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Yn(o)||e&&g_.has(o))break;r=n}else if(Yn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Nf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Yn(o)||e&&b_.has(o))break;r=n}else if(Yn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&g_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&g_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Cf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(yO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Yn(n)||r&&g_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Yn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(yge.has(r))r=this.buffer[++e];else if(r==="%"&&eH.has(this.buffer[e+1])&&eH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&b_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&b_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Nf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(vO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Yn(n)||r&&b_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Yn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(kge.has(r))r=this.buffer[++e];else if(r==="%"&&iH.has(this.buffer[e+1])&&iH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};tH.Lexer=_O});var SO=v(rH=>{"use strict";var vO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var bge=Ge("process"),nH=h_(),vge=bO();function es(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function __(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&oH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&iH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};oH.Lexer=SO});var $O=v(sH=>{"use strict";var xO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Age=Ge("process"),aH=__(),Tge=wO();function es(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function S_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&lH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&cH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(es(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(sH(r.key)&&!es(r.sep,"newline")){let s=ll(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(es(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ll(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):es(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!es(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){__(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||es(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=y_(n),o=ll(i);oH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){S_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(es(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(uH(r.key)&&!es(r.sep,"newline")){let s=ll(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(es(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ll(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):es(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!es(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){S_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||es(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=v_(n),o=ll(i);lH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=y_(e),n=ll(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=y_(e),n=ll(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};aH.Parser=wO});var fH=v(Nf=>{"use strict";var cH=lO(),Sge=Ef(),Df=Of(),wge=aT(),xge=De(),$ge=SO(),lH=xO();function uH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new $ge.LineCounter||null,prettyErrors:e}}function kge(t,e={}){let{lineCounter:r,prettyErrors:n}=uH(e),i=new lH.Parser(r?.addNewLine),o=new cH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Df.prettifyError(t,r)),a.warnings.forEach(Df.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function dH(t,e={}){let{lineCounter:r,prettyErrors:n}=uH(e),i=new lH.Parser(r?.addNewLine),o=new cH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Df.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Df.prettifyError(t,r)),s.warnings.forEach(Df.prettifyError(t,r))),s}function Ege(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=dH(t,r);if(!i)return null;if(i.warnings.forEach(o=>wge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Age(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return xge.isDocument(t)&&!n?t.toString(r):new Sge.Document(t,n,r).toString(r)}Nf.parse=Ege;Nf.parseAllDocuments=kge;Nf.parseDocument=dH;Nf.stringify=Age});var er=v(Ze=>{"use strict";var Tge=lO(),Oge=Ef(),Rge=BT(),$O=Of(),Ige=uf(),ts=De(),Pge=Jo(),Cge=Dt(),Dge=Xo(),Nge=Qo(),jge=h_(),Mge=bO(),Fge=SO(),Lge=xO(),b_=fH(),pH=sf();Ze.Composer=Tge.Composer;Ze.Document=Oge.Document;Ze.Schema=Rge.Schema;Ze.YAMLError=$O.YAMLError;Ze.YAMLParseError=$O.YAMLParseError;Ze.YAMLWarning=$O.YAMLWarning;Ze.Alias=Ige.Alias;Ze.isAlias=ts.isAlias;Ze.isCollection=ts.isCollection;Ze.isDocument=ts.isDocument;Ze.isMap=ts.isMap;Ze.isNode=ts.isNode;Ze.isPair=ts.isPair;Ze.isScalar=ts.isScalar;Ze.isSeq=ts.isSeq;Ze.Pair=Pge.Pair;Ze.Scalar=Cge.Scalar;Ze.YAMLMap=Dge.YAMLMap;Ze.YAMLSeq=Nge.YAMLSeq;Ze.CST=jge;Ze.Lexer=Mge.Lexer;Ze.LineCounter=Fge.LineCounter;Ze.Parser=Lge.Parser;Ze.parse=b_.parse;Ze.parseAllDocuments=b_.parseAllDocuments;Ze.parseDocument=b_.parseDocument;Ze.stringify=b_.stringify;Ze.visit=pH.visit;Ze.visitAsync=pH.visitAsync});import{execFileSync as mH}from"node:child_process";import{existsSync as v_}from"node:fs";import{join as S_,resolve as zge}from"node:path";function Uge(t){try{let e=mH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?zge(t,e):null}catch{return null}}function kO(t){let e=Uge(t);if(!e)return null;try{if(v_(S_(e,"MERGE_HEAD")))return"merge";if(v_(S_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(v_(S_(e,"rebase-merge"))||v_(S_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ya(t){return kO(t)!==null}function EO(t,e){try{let r=mH("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function w_(t,e){return EO(t,e)!==null}var _a=y(()=>{"use strict"});import{execFileSync as qge}from"node:child_process";import{existsSync as Bge,readFileSync as Hge}from"node:fs";import{join as yH}from"node:path";function jf(t,e){return qge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=jf(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function ns(t,e){Gge(t,e);let r=jf(t,["rev-parse","HEAD"]).trim(),n=Zge(t,e);return{groups:Vge(t,n),head:r,inventory:{after:gH($_(t,"spec.yaml")),before:gH(AO(t,e,"spec.yaml"))},since:e,unsharded_commits:Yge(t,e)}}function TO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function Gge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!w_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Zge(t,e){let r=jf(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!hH(c)&&!hH(a)))if(s.startsWith("A")){let l=x_($_(t,c));if(!l)continue;l.status==="done"?n.push(ul(l,"added-as-done")):l.status==="archived"&&n.push(ul(l,"archived"))}else if(s.startsWith("D")){let l=x_(AO(t,e,a));l&&n.push(ul(l,"archived"))}else{let l=x_($_(t,c));if(!l)continue;let d=x_(AO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ul(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ul(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ul(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function hH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function ul(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>TO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function x_(t){if(t===null)return null;let e;try{e=(0,k_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function $_(t,e){let r=yH(t,e);if(!Bge(r))return null;try{return Hge(r,"utf8")}catch{return null}}function AO(t,e,r){try{return jf(t,["show",`${e}:${r}`])}catch{return null}}function Vge(t,e){let r=Wge(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function Wge(t){let e=$_(t,yH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,k_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function gH(t){let e={};if(t!==null)try{let n=(0,k_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function Yge(t,e){let r=jf(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);Kge.test(a)&&(Jge.test(a)||n.push({hash:s,subject:a}))}return n}var k_,Kge,Jge,dl=y(()=>{"use strict";k_=St(er(),1);_a();Kge=/^(feat|fix)(\([^)]*\))?!?:/,Jge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as _H}from"node:child_process";import{appendFileSync as Xge,existsSync as OO,mkdirSync as Qge,readFileSync as eye,renameSync as tye,statSync as rye}from"node:fs";import{userInfo as nye}from"node:os";import{dirname as iye,join as IO}from"node:path";function PO(t){return IO(t,bH,oye)}function en(t,e){let r=PO(t),n=iye(r);OO(n)||Qge(n,{recursive:!0});try{OO(r)&&rye(r).size>sye&&tye(r,IO(n,vH))}catch{}Xge(r,`${JSON.stringify(e)} -`,"utf8")}function RO(t){if(!OO(t))return[];let e=eye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ba(t){return RO(PO(t))}function E_(t){return[...RO(IO(t,bH,vH)),...RO(PO(t))]}function tn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function aye(t){let e;try{e=_H("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=nye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function cye(t){try{return _H("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Mf(t,e){try{let r=ba(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=cye(t),i=aye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Mf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}en(t,tn(e,o))}catch{}}var bH,oye,vH,sye,jr=y(()=>{"use strict";bH=".cladding",oye="events.log.jsonl",vH="events.log.1.jsonl",sye=5*1024*1024});import{execFileSync as lye}from"node:child_process";import{existsSync as SH,readdirSync as uye,readFileSync as dye,statSync as wH}from"node:fs";import{createHash as fye}from"node:crypto";import{join as CO}from"node:path";function va(t){try{return lye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function DO(t){let e=[],r=CO(t,"spec.yaml");SH(r)&&wH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=CO(t,"spec",i);if(!(!SH(o)||!wH(o).isDirectory()))for(let s of uye(o))s.endsWith(".yaml")&&e.push(CO(o,s))}e.sort();let n=fye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(dye(i)),n.update("\0")}return n.digest("hex")}function A_(t,e){let r={featureId:e,gitHead:va(t),specDigest:DO(t),timestamp:new Date().toISOString()};return en(t,tn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function T_(t,e){let r=ba(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function O_(t,e,r,n){let i=tn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return en(t,i),i}var Ff=y(()=>{"use strict";jr()});import{readFileSync as pye,statSync as mye}from"node:fs";import{extname as hye,resolve as NO,sep as gye}from"node:path";function rn(t){return Math.ceil(t.length/4)}function bye(t,e){let r=NO(e),n=NO(r,t);return n===r||n.startsWith(r+gye)}function $H(t,e,r,n){if(!bye(t,e))return{path:t,omitted:"unsafe-path"};if(!yye.has(hye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>xH)return{path:t,omitted:"too-large",bytes:o}}else{let l=NO(e,t);try{o=mye(l).size}catch{return{path:t,omitted:"missing"}}if(o>xH)return{path:t,omitted:"too-large",bytes:o};try{i=pye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(_ye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};dH.Parser=kO});var gH=v(Mf=>{"use strict";var fH=fO(),Oge=Tf(),jf=If(),Rge=uT(),Ige=De(),Pge=$O(),pH=EO();function mH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Pge.LineCounter||null,prettyErrors:e}}function Cge(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(jf.prettifyError(t,r)),a.warnings.forEach(jf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hH(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new jf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(jf.prettifyError(t,r)),s.warnings.forEach(jf.prettifyError(t,r))),s}function Dge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Rge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Nge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Ige.isDocument(t)&&!n?t.toString(r):new Oge.Document(t,n,r).toString(r)}Mf.parse=Dge;Mf.parseAllDocuments=Cge;Mf.parseDocument=hH;Mf.stringify=Nge});var er=v(Ze=>{"use strict";var jge=fO(),Mge=Tf(),Fge=ZT(),AO=If(),Lge=ff(),ts=De(),zge=Jo(),Uge=Dt(),qge=Xo(),Bge=Qo(),Hge=__(),Gge=wO(),Zge=$O(),Vge=EO(),w_=gH(),yH=cf();Ze.Composer=jge.Composer;Ze.Document=Mge.Document;Ze.Schema=Fge.Schema;Ze.YAMLError=AO.YAMLError;Ze.YAMLParseError=AO.YAMLParseError;Ze.YAMLWarning=AO.YAMLWarning;Ze.Alias=Lge.Alias;Ze.isAlias=ts.isAlias;Ze.isCollection=ts.isCollection;Ze.isDocument=ts.isDocument;Ze.isMap=ts.isMap;Ze.isNode=ts.isNode;Ze.isPair=ts.isPair;Ze.isScalar=ts.isScalar;Ze.isSeq=ts.isSeq;Ze.Pair=zge.Pair;Ze.Scalar=Uge.Scalar;Ze.YAMLMap=qge.YAMLMap;Ze.YAMLSeq=Bge.YAMLSeq;Ze.CST=Hge;Ze.Lexer=Gge.Lexer;Ze.LineCounter=Zge.LineCounter;Ze.Parser=Vge.Parser;Ze.parse=w_.parse;Ze.parseAllDocuments=w_.parseAllDocuments;Ze.parseDocument=w_.parseDocument;Ze.stringify=w_.stringify;Ze.visit=yH.visit;Ze.visitAsync=yH.visitAsync});import{execFileSync as TO}from"node:child_process";import{existsSync as x_}from"node:fs";import{join as $_,resolve as Wge}from"node:path";function Kge(t){try{let e=TO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Wge(t,e):null}catch{return null}}function OO(t){let e=Kge(t);if(!e)return null;try{if(x_($_(e,"MERGE_HEAD")))return"merge";if(x_($_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(x_($_(e,"rebase-merge"))||x_($_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return OO(t)!==null}function RO(t,e){try{let r=TO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function k_(t,e){return RO(t,e)!==null}function _H(t,e){try{let r=TO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Jge}from"node:child_process";import{existsSync as Yge,readFileSync as Xge}from"node:fs";import{join as vH}from"node:path";function fl(t,e){return Jge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=fl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function ns(t,e){SH(t,e);let r=fl(t,["rev-parse","HEAD"]).trim(),n=Qge(t,e);return{groups:eye(t,n),head:r,inventory:{after:bH(Ff(t,"spec.yaml")),before:bH(A_(t,e,"spec.yaml"))},since:e,unsharded_commits:iye(t,e)}}function IO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function SH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!k_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Qge(t,e){let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!E_(c)&&!E_(a)))if(s.startsWith("A")){let l=dl(Ff(t,c));if(!l)continue;l.status==="done"?n.push(ul(l,"added-as-done")):l.status==="archived"&&n.push(ul(l,"archived"))}else if(s.startsWith("D")){let l=dl(A_(t,e,a));l&&n.push(ul(l,"archived"))}else{let l=dl(Ff(t,c));if(!l)continue;let d=dl(A_(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ul(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ul(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ul(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function E_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function wH(t,e){SH(t,e);let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!E_(c)&&!E_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?dl(Ff(t,c)):null,f=l?null:dl(A_(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function ul(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>IO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function dl(t){if(t===null)return null;let e;try{e=(0,T_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Ff(t,e){let r=vH(t,e);if(!Yge(r))return null;try{return Xge(r,"utf8")}catch{return null}}function A_(t,e,r){try{return fl(t,["show",`${e}:${r}`])}catch{return null}}function eye(t,e){let r=tye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function tye(t){let e=Ff(t,vH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,T_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function bH(t){let e={};if(t!==null)try{let n=(0,T_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function iye(t,e){let r=fl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);rye.test(a)&&(nye.test(a)||n.push({hash:s,subject:a}))}return n}var T_,rye,nye,pl=y(()=>{"use strict";T_=St(er(),1);ba();rye=/^(feat|fix)(\([^)]*\))?!?:/,nye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as xH}from"node:child_process";import{appendFileSync as oye,existsSync as PO,mkdirSync as sye,readFileSync as aye,renameSync as cye,statSync as lye}from"node:fs";import{userInfo as uye}from"node:os";import{dirname as dye,join as DO}from"node:path";function NO(t){return DO(t,$H,fye)}function en(t,e){let r=NO(t),n=dye(r);PO(n)||sye(n,{recursive:!0});try{PO(r)&&lye(r).size>pye&&cye(r,DO(n,kH))}catch{}oye(r,`${JSON.stringify(e)} +`,"utf8")}function CO(t){if(!PO(t))return[];let e=aye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return CO(NO(t))}function O_(t){return[...CO(DO(t,$H,kH)),...CO(NO(t))]}function tn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function mye(t){let e;try{e=xH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=uye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function hye(t){try{return xH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Lf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=hye(t),i=mye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Lf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}en(t,tn(e,o))}catch{}}var $H,fye,kH,pye,jr=y(()=>{"use strict";$H=".cladding",fye="events.log.jsonl",kH="events.log.1.jsonl",pye=5*1024*1024});import{execFileSync as gye}from"node:child_process";import{existsSync as EH,readdirSync as yye,readFileSync as _ye,statSync as AH}from"node:fs";import{createHash as bye}from"node:crypto";import{join as jO}from"node:path";function Sa(t){try{return gye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function MO(t){let e=[],r=jO(t,"spec.yaml");EH(r)&&AH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=jO(t,"spec",i);if(!(!EH(o)||!AH(o).isDirectory()))for(let s of yye(o))s.endsWith(".yaml")&&e.push(jO(o,s))}e.sort();let n=bye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(_ye(i)),n.update("\0")}return n.digest("hex")}function R_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:MO(t),timestamp:new Date().toISOString()};return en(t,tn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function I_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function P_(t,e,r,n){let i=tn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return en(t,i),i}var zf=y(()=>{"use strict";jr()});import{readFileSync as vye,statSync as Sye}from"node:fs";import{extname as wye,resolve as FO,sep as xye}from"node:path";function rn(t){return Math.ceil(t.length/4)}function Eye(t,e){let r=FO(e),n=FO(r,t);return n===r||n.startsWith(r+xye)}function OH(t,e,r,n){if(!Eye(t,e))return{path:t,omitted:"unsafe-path"};if(!$ye.has(wye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>TH)return{path:t,omitted:"too-large",bytes:o}}else{let l=FO(e,t);try{o=Sye(l).size}catch{return{path:t,omitted:"missing"}}if(o>TH)return{path:t,omitted:"too-large",bytes:o};try{i=vye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(kye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var yye,xH,_ye,R_=y(()=>{"use strict";yye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),xH=2e6,_ye="\0"});function Sye(t){for(let i of vye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function jO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function wye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])jO(e,s,o);for(let s of i.modules??[])jO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Sye(a);c&&jO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function On(t){let e=kH.get(t);return e||(e=wye(t),kH.set(t,e)),e}var vye,kH,Sa=y(()=>{"use strict";vye=["derived:","fixture:","script:","self-dogfood:"];kH=new WeakMap});function MO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=On(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=xye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=MO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:FO(i)}}var wa=y(()=>{"use strict";Sa()});function EH(t){return t.impacted.length}function P_(t,e,r={}){let n=r.initialDepth??I_.initialDepth,i=r.maxDepth??I_.maxDepth,o=r.coverageThreshold??I_.coverageThreshold,s=r.marginYieldThreshold??I_.marginYieldThreshold,a=On(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=MO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=EH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var I_,LO=y(()=>{"use strict";wa();Sa();I_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function $ye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function AH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=$ye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var TH=y(()=>{"use strict"});function kye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function fl(t,e){let r=kye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=AH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var C_=y(()=>{"use strict";TH()});import{existsSync as RH,readdirSync as Eye,readFileSync as Aye}from"node:fs";import{join as UO}from"node:path";function qO(t,e=Oye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Rye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:qO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:qO(`done reverted \u2014 pre-push strict gate red${r}`)}}function OH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Iye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return qO(n)}function Pye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>OH(m)-OH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Tye).map(Rye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Iye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function zO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Cye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function Dye(t,e,r){let n=zO(t,/_Rolled back at_\s*`([^`]+)`/),i=zO(t,/Last failed gate:\s*`([^`]+)`/),o=zO(t,/Retry attempts:\s*(\d+)/),s=Cye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Nye(t,e){let r=UO(t,".cladding","post-mortems");if(!RH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Eye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Dye(Aye(UO(r,o),"utf8"),e,o))}catch{}return i}function IH(t,e){try{let r=E_(t),n=Nye(t,e),i=RH(UO(t,".cladding","events.log.1.jsonl"));return Pye(r,n,e,{truncated:i})}catch{return}}var Tye,Oye,PH=y(()=>{"use strict";jr();Tye=5,Oye=120});function D_(t,e,r){return rn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:jye,o=e,s,a=On(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=fl(t,o);if("not_found"in c)return c;let l=c.focus,u=IH(n,l.id),d=a&&a.size>0?e:l.id,f=P_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Mye&&D_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],lo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return rn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],lo=0;for(;Xt.length>Ce.size&&$(Xt,K,lo,0);)Xt=Xt.slice(0,-1),lo++;let $i=[...h],Qr=0;for(;$(Xt,$i,lo,Qr);){let de=-1;for(let uo=$i.length-1;uo>=0;uo--)if(!Kt.has($i[uo])){de=uo;break}if(de<0)break;$i.splice(de,1),Qr++}re=Xt,K=$i,lo+Qr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Qr} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};rn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Pr=rn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var jye,Mye,N_=y(()=>{"use strict";R_();C_();LO();PH();wa();Sa();jye=3e3,Mye=3});function Xn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Fye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function CH(t,e,r="."){let n=On(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=P_(t,f.id),g=!("not_found"in h),b=rn(JSON.stringify(p)),_="not_found"in m?b:rn(JSON.stringify(m)),S=rn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=rn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Xn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Xn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Xn(a(c))*10)/10,medianShrinkTruncated:Math.round(Xn(a(l))*10)/10,medianStructuralRatio:Math.round(Xn(u)*100)/100,medianSliceTokens:Math.round(Xn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Xn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Xn(o.map(f=>f.searchDepth)),p95Depth:Fye(o.map(f=>f.searchDepth),95),medianEdges:Xn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Xn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Xn(o.map(f=>f.regressionTests))},features:o}}var pl,j_=y(()=>{"use strict";R_();LO();N_();Sa();pl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Lye,existsSync as BO,mkdirSync as zye,readFileSync as DH}from"node:fs";import{dirname as Uye,join as qye}from"node:path";function HO(t){return qye(t,Bye,Hye)}function Gye(t,e){return{timestamp:new Date().toISOString(),head:va(t),spec_digest:DO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function NH(t,e){try{let r=Gye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=GO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=HO(t),s=Uye(o);return BO(s)||zye(s,{recursive:!0}),Lye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function jH(t){let e=[];for(let r of t.split(` -`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function GO(t,e){let r=HO(t);if(!BO(r))return[];let n;try{n=DH(r,"utf8")}catch{return[]}let i=jH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function MH(t){let e=HO(t);if(!BO(e))return{snapshots:[],unreadable:!1};let r;try{r=DH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=jH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Lf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function FH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Lf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${pl}`),i.join(` -`)}var Bye,Hye,zf=y(()=>{"use strict";Ff();j_();Bye=".cladding",Hye="measure.jsonl"});import{existsSync as Zye}from"node:fs";import{join as Vye}from"node:path";function ml(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${Wye[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` -`)}function zH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` -`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Lf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Lf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Lf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",pl),r.join(` -`)}function hl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${Jye(l,r)} |`)}return n.join(` -`)}function Jye(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of Kye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Zye(Vye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function gl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),LH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)LH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function LH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=TO(r);n&&t.push(`- ${n}`)}t.push("")}var Wye,Kye,M_=y(()=>{"use strict";zf();j_();dl();Wye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Kye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Yye}from"node:fs";function Oi(t="./spec.yaml"){let e=Yye(t,"utf8");return(0,UH.parse)(e)}var UH,F_=y(()=>{"use strict";UH=St(er(),1)});var is=v((Mr,KO)=>{"use strict";var ZO=Mr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+BH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};ZO.prototype.toString=function(){return this.property+" "+this.message};var L_=Mr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};L_.prototype.addError=function(e){var r;if(typeof e=="string")r=new ZO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new ZO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};L_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Xye(t,e){return e+": "+t.toString()+` -`}L_.prototype.toString=function(e){return this.errors.map(Xye).join("")};Object.defineProperty(L_.prototype,"valid",{get:function(){return!this.errors.length}});KO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var qH=Mr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};qH.prototype=Object.create(Error.prototype,{constructor:{value:qH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var VO=Mr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+BH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};VO.prototype.resolve=function(e){return HH(this.base,e)};VO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=HH(this.base,i||"");var s=new VO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Qn=Mr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Qn.regexp=Qn.regex;Qn.pattern=Qn.regex;Qn.ipv4=Qn["ip-address"];Mr.isFormat=function(e,r,n){if(typeof e=="string"&&Qn[r]!==void 0){if(Qn[r]instanceof RegExp)return Qn[r].test(e);if(typeof Qn[r]=="function")return Qn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var BH=Mr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Mr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function Qye(t,e,r,n){typeof r=="object"?e[n]=WO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function e_e(t,e,r){e[r]=t[r]}function t_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=WO(t[n],e[n]):r[n]=e[n]}function WO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Qye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(e_e.bind(null,t,n)),Object.keys(e).forEach(t_e.bind(null,t,e,n))),n}KO.exports.deepMerge=WO;Mr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function r_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Mr.encodePath=function(e){return e.map(r_e).join("")};Mr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Mr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var HH=Mr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var WH=v((y7e,VH)=>{"use strict";var nn=is(),Le=nn.ValidatorResult,os=nn.SchemaError,JO={};JO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=JO.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function YO(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new os("anyOf must be an array");if(!r.anyOf.some(YO.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new os("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new os("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(YO.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!nn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=YO.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!nn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!nn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function XO(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!nn.isSchema(s))throw new os('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(XO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new os('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=XO(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function GH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new os('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&GH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)GH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!nn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function n_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var QO=is();eR.exports.SchemaScanResult=KH;function KH(t,e){this.id=t,this.ref=e}eR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=QO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=QO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!QO.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var JH=WH(),ss=is(),YH=z_().scan,XH=ss.ValidatorResult,i_e=ss.ValidatorResultError,Uf=ss.SchemaError,QH=ss.SchemaContext,o_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(JH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=YH(r||o_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ss.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Uf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Uf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ri=Jt.prototype.types={};Ri.string=function(e){return typeof e=="string"};Ri.number=function(e){return typeof e=="number"&&isFinite(e)};Ri.integer=function(e){return typeof e=="number"&&e%1===0};Ri.boolean=function(e){return typeof e=="boolean"};Ri.array=function(e){return Array.isArray(e)};Ri.null=function(e){return e===null};Ri.date=function(e){return e instanceof Date};Ri.any=function(e){return!0};Ri.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};tG.exports=Jt});var nG=v((v7e,ho)=>{"use strict";var s_e=ho.exports.Validator=rG();ho.exports.ValidatorResult=is().ValidatorResult;ho.exports.ValidatorResultError=is().ValidatorResultError;ho.exports.ValidationError=is().ValidationError;ho.exports.SchemaError=is().SchemaError;ho.exports.SchemaScanResult=z_().SchemaScanResult;ho.exports.scan=z_().scan;ho.exports.validate=function(t,e,r){var n=new s_e;return n.validate(t,e,r)}});import{readFileSync as a_e}from"node:fs";import{dirname as c_e,join as l_e}from"node:path";import{fileURLToPath as u_e}from"node:url";function h_e(t){let e=m_e.validate(t,p_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function oG(t){let e=h_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var $ye,TH,kye,C_=y(()=>{"use strict";$ye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),TH=2e6,kye="\0"});function zO(t){for(let i of Aye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function LO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Tye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])LO(e,s,o);for(let s of i.modules??[])LO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=zO(a);c&&LO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function On(t){let e=RH.get(t);return e||(e=Tye(t),RH.set(t,e)),e}var Aye,RH,is=y(()=>{"use strict";Aye=["derived:","fixture:","script:","self-dogfood:"];RH=new WeakMap});function UO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=On(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Oye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=UO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:qO(i)}}var wa=y(()=>{"use strict";is()});function IH(t){return t.impacted.length}function N_(t,e,r={}){let n=r.initialDepth??D_.initialDepth,i=r.maxDepth??D_.maxDepth,o=r.coverageThreshold??D_.coverageThreshold,s=r.marginYieldThreshold??D_.marginYieldThreshold,a=On(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=UO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=IH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var D_,BO=y(()=>{"use strict";wa();is();D_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Rye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function PH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Rye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var CH=y(()=>{"use strict"});function Iye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function ml(t,e){let r=Iye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=PH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var j_=y(()=>{"use strict";CH()});import{existsSync as NH,readdirSync as Pye,readFileSync as Cye}from"node:fs";import{join as GO}from"node:path";function ZO(t,e=Nye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function jye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:ZO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:ZO(`done reverted \u2014 pre-push strict gate red${r}`)}}function DH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Mye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return ZO(n)}function Fye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>DH(m)-DH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Dye).map(jye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Mye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function HO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Lye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function zye(t,e,r){let n=HO(t,/_Rolled back at_\s*`([^`]+)`/),i=HO(t,/Last failed gate:\s*`([^`]+)`/),o=HO(t,/Retry attempts:\s*(\d+)/),s=Lye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Uye(t,e){let r=GO(t,".cladding","post-mortems");if(!NH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Pye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(zye(Cye(GO(r,o),"utf8"),e,o))}catch{}return i}function jH(t,e){try{let r=O_(t),n=Uye(t,e),i=NH(GO(t,".cladding","events.log.1.jsonl"));return Fye(r,n,e,{truncated:i})}catch{return}}var Dye,Nye,MH=y(()=>{"use strict";jr();Dye=5,Nye=120});function M_(t,e,r){return rn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:qye,o=e,s,a=On(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ml(t,o);if("not_found"in c)return c;let l=c.focus,u=jH(n,l.id),d=a&&a.size>0?e:l.id,f=N_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Bye&&M_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],lo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return rn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],lo=0;for(;Xt.length>Ce.size&&$(Xt,K,lo,0);)Xt=Xt.slice(0,-1),lo++;let $i=[...h],Qr=0;for(;$(Xt,$i,lo,Qr);){let de=-1;for(let uo=$i.length-1;uo>=0;uo--)if(!Kt.has($i[uo])){de=uo;break}if(de<0)break;$i.splice(de,1),Qr++}re=Xt,K=$i,lo+Qr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Qr} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};rn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Pr=rn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var qye,Bye,F_=y(()=>{"use strict";C_();j_();BO();MH();wa();is();qye=3e3,Bye=3});function Xn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Hye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function FH(t,e,r="."){let n=On(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=N_(t,f.id),g=!("not_found"in h),b=rn(JSON.stringify(p)),_="not_found"in m?b:rn(JSON.stringify(m)),S=rn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=rn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Xn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Xn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Xn(a(c))*10)/10,medianShrinkTruncated:Math.round(Xn(a(l))*10)/10,medianStructuralRatio:Math.round(Xn(u)*100)/100,medianSliceTokens:Math.round(Xn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Xn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Xn(o.map(f=>f.searchDepth)),p95Depth:Hye(o.map(f=>f.searchDepth),95),medianEdges:Xn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Xn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Xn(o.map(f=>f.regressionTests))},features:o}}var hl,L_=y(()=>{"use strict";C_();BO();F_();is();hl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Gye,existsSync as VO,mkdirSync as Zye,readFileSync as LH}from"node:fs";import{dirname as Vye,join as Wye}from"node:path";function WO(t){return Wye(t,Kye,Jye)}function Yye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:MO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function zH(t,e){try{let r=Yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=KO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=WO(t),s=Vye(o);return VO(s)||Zye(s,{recursive:!0}),Gye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function UH(t){let e=[];for(let r of t.split(` +`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function KO(t,e){let r=WO(t);if(!VO(r))return[];let n;try{n=LH(r,"utf8")}catch{return[]}let i=UH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function qH(t){let e=WO(t);if(!VO(e))return{snapshots:[],unreadable:!1};let r;try{r=LH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=UH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Uf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function BH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Uf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${hl}`),i.join(` +`)}var Kye,Jye,qf=y(()=>{"use strict";zf();L_();Kye=".cladding",Jye="measure.jsonl"});import{existsSync as Xye}from"node:fs";import{join as Qye}from"node:path";function gl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${e_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function GH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` +`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Uf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Uf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Uf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",hl),r.join(` +`)}function yl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${r_e(l,r)} |`)}return n.join(` +`)}function r_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of t_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Xye(Qye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function _l(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),HH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)HH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function HH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=IO(r);n&&t.push(`- ${n}`)}t.push("")}var e_e,t_e,z_=y(()=>{"use strict";qf();L_();pl();e_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};t_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as n_e}from"node:fs";function Oi(t="./spec.yaml"){let e=n_e(t,"utf8");return(0,ZH.parse)(e)}var ZH,U_=y(()=>{"use strict";ZH=St(er(),1)});var os=v((Mr,QO)=>{"use strict";var JO=Mr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+WH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};JO.prototype.toString=function(){return this.property+" "+this.message};var q_=Mr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};q_.prototype.addError=function(e){var r;if(typeof e=="string")r=new JO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new JO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};q_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function i_e(t,e){return e+": "+t.toString()+` +`}q_.prototype.toString=function(e){return this.errors.map(i_e).join("")};Object.defineProperty(q_.prototype,"valid",{get:function(){return!this.errors.length}});QO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var VH=Mr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};VH.prototype=Object.create(Error.prototype,{constructor:{value:VH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var YO=Mr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+WH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};YO.prototype.resolve=function(e){return KH(this.base,e)};YO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=KH(this.base,i||"");var s=new YO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Qn=Mr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Qn.regexp=Qn.regex;Qn.pattern=Qn.regex;Qn.ipv4=Qn["ip-address"];Mr.isFormat=function(e,r,n){if(typeof e=="string"&&Qn[r]!==void 0){if(Qn[r]instanceof RegExp)return Qn[r].test(e);if(typeof Qn[r]=="function")return Qn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var WH=Mr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Mr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function o_e(t,e,r,n){typeof r=="object"?e[n]=XO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function s_e(t,e,r){e[r]=t[r]}function a_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=XO(t[n],e[n]):r[n]=e[n]}function XO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(o_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(s_e.bind(null,t,n)),Object.keys(e).forEach(a_e.bind(null,t,e,n))),n}QO.exports.deepMerge=XO;Mr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function c_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Mr.encodePath=function(e){return e.map(c_e).join("")};Mr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Mr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var KH=Mr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var QH=v((O7e,XH)=>{"use strict";var nn=os(),Le=nn.ValidatorResult,ss=nn.SchemaError,eR={};eR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=eR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function tR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ss("anyOf must be an array");if(!r.anyOf.some(tR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ss("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ss("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(tR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!nn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=tR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!nn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!nn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function rR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!nn.isSchema(s))throw new ss('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(rR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new ss('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=rR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function JH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new ss('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&JH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)JH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!nn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function l_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var nR=os();iR.exports.SchemaScanResult=eG;function eG(t,e){this.id=t,this.ref=e}iR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=nR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=nR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!nR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var tG=QH(),as=os(),rG=B_().scan,nG=as.ValidatorResult,u_e=as.ValidatorResultError,Bf=as.SchemaError,iG=as.SchemaContext,d_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(tG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=rG(r||d_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=as.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Bf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Bf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ri=Jt.prototype.types={};Ri.string=function(e){return typeof e=="string"};Ri.number=function(e){return typeof e=="number"&&isFinite(e)};Ri.integer=function(e){return typeof e=="number"&&e%1===0};Ri.boolean=function(e){return typeof e=="boolean"};Ri.array=function(e){return Array.isArray(e)};Ri.null=function(e){return e===null};Ri.date=function(e){return e instanceof Date};Ri.any=function(e){return!0};Ri.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};sG.exports=Jt});var cG=v((P7e,ho)=>{"use strict";var f_e=ho.exports.Validator=aG();ho.exports.ValidatorResult=os().ValidatorResult;ho.exports.ValidatorResultError=os().ValidatorResultError;ho.exports.ValidationError=os().ValidationError;ho.exports.SchemaError=os().SchemaError;ho.exports.SchemaScanResult=B_().SchemaScanResult;ho.exports.scan=B_().scan;ho.exports.validate=function(t,e,r){var n=new f_e;return n.validate(t,e,r)}});import{readFileSync as p_e}from"node:fs";import{dirname as m_e,join as h_e}from"node:path";import{fileURLToPath as g_e}from"node:url";function S_e(t){let e=v_e.validate(t,b_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function uG(t){let e=S_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var iG,d_e,f_e,p_e,m_e,sG=y(()=>{"use strict";iG=St(nG(),1),d_e=c_e(u_e(import.meta.url)),f_e=l_e(d_e,"schema.json"),p_e=JSON.parse(a_e(f_e,"utf8")),m_e=new iG.Validator});import{existsSync as tR,readdirSync as g_e}from"node:fs";import{dirname as y_e,join as ka,resolve as cG}from"node:path";function aG(t){return tR(t)?g_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Oi(ka(t,r))):[]}function Ea(t,e){U_=e?{cwd:cG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return U_&&e==="spec.yaml"&&cG(t)===U_.cwd?U_.spec:__e(t,e)}function __e(t,e){let r=ka(t,e),n=Oi(r),i=ka(t,y_e(e),"spec");if(!n.features||n.features.length===0){let o=aG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=aG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");tR(o)&&(n.architecture=Oi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(tR(o)){let s=Oi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return oG(n),n}var U_,Ue=y(()=>{"use strict";F_();sG();U_=null});import yl from"node:process";function iR(){return!!yl.stdout.isTTY}function L(t,e,r=""){let n=lG[t],i=r?` ${r}`:"";iR()?yl.stdout.write(`${rR[t]}${n}${nR} ${e}${i} -`):yl.stdout.write(`${n} ${e}${i} -`)}function qf(t,e,r=""){if(!iR())return;let n=r?` ${r}`:"";yl.stdout.write(`${uG}${rR.start}\xB7${nR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=lG[t],i=r?` ${r}`:"";iR()?yl.stdout.write(`${uG}${rR[t]}${n}${nR} ${e}${i} -`):yl.stdout.write(`${n} ${e}${i} -`)}var lG,rR,nR,uG,Ii=y(()=>{"use strict";lG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},rR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},nR="\x1B[0m",uG="\r\x1B[K"});import{createHash as PG}from"node:crypto";import{existsSync as J_e,readFileSync as aR,writeFileSync as Y_e}from"node:fs";import{join as q_}from"node:path";function X_e(t,e){let r=PG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(aR(q_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function DG(t,e){let r=PG("sha256");try{r.update(aR(q_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function as(t){let e=q_(t,...CG);if(!J_e(e))return null;let r;try{r=aR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function B_(t){return t.features?.size??t.v1?.size??0}function H_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==DG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===X_e(e,n)?{state:"fresh"}:{state:"stale"}}function NG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${DG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=Q_e+`attested_modules: + `)}`)}var lG,y_e,__e,b_e,v_e,dG=y(()=>{"use strict";lG=St(cG(),1),y_e=m_e(g_e(import.meta.url)),__e=h_e(y_e,"schema.json"),b_e=JSON.parse(p_e(__e,"utf8")),v_e=new lG.Validator});import{existsSync as oR,readdirSync as w_e}from"node:fs";import{dirname as x_e,join as ka,resolve as pG}from"node:path";function fG(t){return oR(t)?w_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Oi(ka(t,r))):[]}function Ea(t,e){H_=e?{cwd:pG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return H_&&e==="spec.yaml"&&pG(t)===H_.cwd?H_.spec:$_e(t,e)}function $_e(t,e){let r=ka(t,e),n=Oi(r),i=ka(t,x_e(e),"spec");if(!n.features||n.features.length===0){let o=fG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=fG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");oR(o)&&(n.architecture=Oi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(oR(o)){let s=Oi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return uG(n),n}var H_,Ue=y(()=>{"use strict";U_();dG();H_=null});import bl from"node:process";function cR(){return!!bl.stdout.isTTY}function L(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${sR[t]}${n}${aR} ${e}${i} +`):bl.stdout.write(`${n} ${e}${i} +`)}function Hf(t,e,r=""){if(!cR())return;let n=r?` ${r}`:"";bl.stdout.write(`${hG}${sR.start}\xB7${aR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${hG}${sR[t]}${n}${aR} ${e}${i} +`):bl.stdout.write(`${n} ${e}${i} +`)}var mG,sR,aR,hG,Ii=y(()=>{"use strict";mG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},sR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},aR="\x1B[0m",hG="\r\x1B[K"});import{createHash as zG}from"node:crypto";import{existsSync as cbe,readFileSync as dR,writeFileSync as lbe}from"node:fs";import{join as G_}from"node:path";function ube(t,e){let r=zG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(dR(G_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function qG(t,e){let r=zG("sha256");try{r.update(dR(G_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function cs(t){let e=G_(t,...UG);if(!cbe(e))return null;let r;try{r=dR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function Z_(t){return t.features?.size??t.v1?.size??0}function V_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==qG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===ube(e,n)?{state:"fresh"}:{state:"stale"}}function BG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${qG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=dbe+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return Y_e(q_(t,...CG),s,"utf8"),!0}var CG,Q_e,vl=y(()=>{"use strict";CG=["spec","attestation.yaml"];Q_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return lbe(G_(t,...UG),s,"utf8"),!0}var UG,dbe,wl=y(()=>{"use strict";UG=["spec","attestation.yaml"];dbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN # \`clad check --tier=pre-push --strict\` gate \u2014 the file's one honest author. # Do not edit by hand. # @@ -211,53 +212,53 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as cR}from"node:path";function G_(t){cs={cwd:cR(t),results:new Map}}function jG(t,e,r){!cs||cs.cwd!==cR(e)||cs.results.set(t,r)}function Z_(t,e){return!cs||cs.cwd!==cR(e)?null:cs.results.get(t)??null}function V_(){cs=null}var cs,Sl=y(()=>{"use strict";cs=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var yo=y(()=>{});import{fileURLToPath as ebe}from"node:url";var wl,tbe,lR,uR,xl=y(()=>{wl=(t,e)=>{let r=uR(tbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},tbe=t=>lR(t)?t.toString():t,lR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,uR=t=>t instanceof URL?ebe(t):t});var W_,dR=y(()=>{yo();xl();W_=(t,e=[],r={})=>{let n=wl(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as rbe}from"node:string_decoder";var MG,FG,qt,_o,nbe,LG,ibe,K_,zG,obe,Hf,sbe,fR,abe,on=y(()=>{({toString:MG}=Object.prototype),FG=t=>MG.call(t)==="[object ArrayBuffer]",qt=t=>MG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),nbe=new TextEncoder,LG=t=>nbe.encode(t),ibe=new TextDecoder,K_=t=>ibe.decode(t),zG=(t,e)=>obe(t,e).join(""),obe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new rbe(e),n=t.map(o=>typeof o=="string"?LG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Hf=t=>t.length===1&&qt(t[0])?t[0]:fR(sbe(t)),sbe=t=>t.map(e=>typeof e=="string"?LG(e):e),fR=t=>{let e=new Uint8Array(abe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},abe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as cbe}from"node:child_process";var HG,GG,lbe,ube,UG,dbe,qG,BG,fbe,ZG=y(()=>{yo();on();HG=t=>Array.isArray(t)&&Array.isArray(t.raw),GG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=lbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},lbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=ube(i,t.raw[n]),c=qG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>BG(d)):[BG(l)];return qG(c,u,a)},ube=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=UG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],BG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return fbe(t);throw t instanceof cbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},fbe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return K_(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import pR from"node:process";var ei,J_,Rn,Y_,bo=y(()=>{ei=t=>J_.includes(t),J_=[pR.stdin,pR.stdout,pR.stderr],Rn=["stdin","stdout","stderr"],Y_=t=>Rn[t]??`stdio[${t}]`});import{debuglog as pbe}from"node:util";var WG,mR,mbe,hbe,gbe,ybe,VG,_be,hR,bbe,vbe,Sbe,wbe,gR,vo,So=y(()=>{yo();bo();WG=t=>{let e={...t};for(let r of gR)e[r]=mR(t,r);return e},mR=(t,e)=>{let r=Array.from({length:mbe(t)+1}),n=hbe(t[e],r,e);return vbe(n,e)},mbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Rn.length):Rn.length,hbe=(t,e,r)=>Ot(t)?gbe(t,e,r):e.fill(t),gbe=(t,e,r)=>{for(let n of Object.keys(t).sort(ybe))for(let i of _be(n,r,e))e[i]=t[n];return e},ybe=(t,e)=>VG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,_be=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=hR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as fR}from"node:path";function W_(t){ls={cwd:fR(t),results:new Map}}function HG(t,e,r){!ls||ls.cwd!==fR(e)||ls.results.set(t,r)}function K_(t,e){return!ls||ls.cwd!==fR(e)?null:ls.results.get(t)??null}function J_(){ls=null}var ls,xl=y(()=>{"use strict";ls=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var yo=y(()=>{});import{fileURLToPath as fbe}from"node:url";var $l,pbe,pR,mR,kl=y(()=>{$l=(t,e)=>{let r=mR(pbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},pbe=t=>pR(t)?t.toString():t,pR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,mR=t=>t instanceof URL?fbe(t):t});var Y_,hR=y(()=>{yo();kl();Y_=(t,e=[],r={})=>{let n=$l(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as mbe}from"node:string_decoder";var GG,ZG,qt,_o,hbe,VG,gbe,X_,WG,ybe,Vf,_be,gR,bbe,on=y(()=>{({toString:GG}=Object.prototype),ZG=t=>GG.call(t)==="[object ArrayBuffer]",qt=t=>GG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hbe=new TextEncoder,VG=t=>hbe.encode(t),gbe=new TextDecoder,X_=t=>gbe.decode(t),WG=(t,e)=>ybe(t,e).join(""),ybe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new mbe(e),n=t.map(o=>typeof o=="string"?VG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Vf=t=>t.length===1&&qt(t[0])?t[0]:gR(_be(t)),_be=t=>t.map(e=>typeof e=="string"?VG(e):e),gR=t=>{let e=new Uint8Array(bbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},bbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as vbe}from"node:child_process";var XG,QG,Sbe,wbe,KG,xbe,JG,YG,$be,eZ=y(()=>{yo();on();XG=t=>Array.isArray(t)&&Array.isArray(t.raw),QG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Sbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Sbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=wbe(i,t.raw[n]),c=JG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>YG(d)):[YG(l)];return JG(c,u,a)},wbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=KG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],YG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return $be(t);throw t instanceof vbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},$be=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return X_(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import yR from"node:process";var ei,Q_,Rn,eb,bo=y(()=>{ei=t=>Q_.includes(t),Q_=[yR.stdin,yR.stdout,yR.stderr],Rn=["stdin","stdout","stderr"],eb=t=>Rn[t]??`stdio[${t}]`});import{debuglog as kbe}from"node:util";var rZ,_R,Ebe,Abe,Tbe,Obe,tZ,Rbe,bR,Ibe,Pbe,Cbe,Dbe,vR,vo,So=y(()=>{yo();bo();rZ=t=>{let e={...t};for(let r of vR)e[r]=_R(t,r);return e},_R=(t,e)=>{let r=Array.from({length:Ebe(t)+1}),n=Abe(t[e],r,e);return Pbe(n,e)},Ebe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Rn.length):Rn.length,Abe=(t,e,r)=>Ot(t)?Tbe(t,e,r):e.fill(t),Tbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Obe))for(let i of Rbe(n,r,e))e[i]=t[n];return e},Obe=(t,e)=>tZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Rbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=bR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},hR=t=>{if(t==="all")return t;if(Rn.includes(t))return Rn.indexOf(t);let e=bbe.exec(t);if(e!==null)return Number(e[1])},bbe=/^fd(\d+)$/,vbe=(t,e)=>t.map(r=>r===void 0?wbe[e]:r),Sbe=pbe("execa").enabled?"full":"none",wbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Sbe,stripFinalNewline:!0},gR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var $l,kl,KG,yR,xbe,X_,Q_,ls=y(()=>{So();$l=({verbose:t},e)=>yR(t,e)!=="none",kl=({verbose:t},e)=>!["none","short"].includes(yR(t,e)),KG=({verbose:t},e)=>{let r=yR(t,e);return X_(r)?r:void 0},yR=(t,e)=>e===void 0?xbe(t):vo(t,e),xbe=t=>t.find(e=>X_(e))??Q_.findLast(e=>t.includes(e)),X_=t=>typeof t=="function",Q_=["none","short","full"]});import{platform as $be}from"node:process";import{stripVTControlCharacters as kbe}from"node:util";var JG,Gf,YG,Ebe,Abe,Tbe,Obe,Rbe,Ibe,Pbe,eb=y(()=>{JG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Ibe(YG(o))).join(" ");return{command:n,escapedCommand:i}},Gf=t=>kbe(t).split(` -`).map(e=>YG(e)).join(` -`),YG=t=>t.replaceAll(Tbe,e=>Ebe(e)),Ebe=t=>{let e=Obe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Abe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Tbe=Abe(),Obe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Rbe=65535,Ibe=t=>Pbe.test(t)?t:$be==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Pbe=/^[\w./-]+$/});import XG from"node:process";function _R(){let{env:t}=XG,{TERM:e,TERM_PROGRAM:r}=t;return XG.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var QG=y(()=>{});var eZ,tZ,Cbe,Dbe,Nbe,jbe,Mbe,tb,$Qe,rZ=y(()=>{QG();eZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},tZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Cbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Dbe={...eZ,...tZ},Nbe={...eZ,...Cbe},jbe=_R(),Mbe=jbe?Dbe:Nbe,tb=Mbe,$Qe=Object.entries(tZ)});import Fbe from"node:tty";var Lbe,be,AQe,nZ,TQe,OQe,RQe,IQe,PQe,CQe,DQe,NQe,jQe,MQe,FQe,LQe,zQe,UQe,qQe,rb,BQe,HQe,GQe,ZQe,VQe,WQe,KQe,JQe,YQe,iZ,XQe,oZ,QQe,eet,tet,ret,net,iet,oet,set,aet,cet,uet,bR=y(()=>{Lbe=Fbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Lbe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},AQe=be(0,0),nZ=be(1,22),TQe=be(2,22),OQe=be(3,23),RQe=be(4,24),IQe=be(53,55),PQe=be(7,27),CQe=be(8,28),DQe=be(9,29),NQe=be(30,39),jQe=be(31,39),MQe=be(32,39),FQe=be(33,39),LQe=be(34,39),zQe=be(35,39),UQe=be(36,39),qQe=be(37,39),rb=be(90,39),BQe=be(40,49),HQe=be(41,49),GQe=be(42,49),ZQe=be(43,49),VQe=be(44,49),WQe=be(45,49),KQe=be(46,49),JQe=be(47,49),YQe=be(100,49),iZ=be(91,39),XQe=be(92,39),oZ=be(93,39),QQe=be(94,39),eet=be(95,39),tet=be(96,39),ret=be(97,39),net=be(101,49),iet=be(102,49),oet=be(103,49),set=be(104,49),aet=be(105,49),cet=be(106,49),uet=be(107,49)});var sZ=y(()=>{bR();bR()});var lZ,Ube,nb,aZ,qbe,cZ,Bbe,uZ=y(()=>{rZ();sZ();lZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ube(r),c=qbe[t]({failed:o,reject:s,piped:n}),l=Bbe[t]({reject:s});return`${rb(`[${a}]`)} ${rb(`[${i}]`)} ${l(c)} ${l(e)}`},Ube=t=>`${nb(t.getHours(),2)}:${nb(t.getMinutes(),2)}:${nb(t.getSeconds(),2)}.${nb(t.getMilliseconds(),3)}`,nb=(t,e)=>String(t).padStart(e,"0"),aZ=({failed:t,reject:e})=>t?e?tb.cross:tb.warning:tb.tick,qbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:aZ,duration:aZ},cZ=t=>t,Bbe={command:()=>nZ,output:()=>cZ,ipc:()=>cZ,error:({reject:t})=>t?iZ:oZ,duration:()=>rb}});var dZ,Hbe,Gbe,fZ=y(()=>{ls();dZ=(t,e,r)=>{let n=KG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Hbe(i,o,n)).filter(i=>i!==void 0).map(i=>Gbe(i)).join("")},Hbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Gbe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},bR=t=>{if(t==="all")return t;if(Rn.includes(t))return Rn.indexOf(t);let e=Ibe.exec(t);if(e!==null)return Number(e[1])},Ibe=/^fd(\d+)$/,Pbe=(t,e)=>t.map(r=>r===void 0?Dbe[e]:r),Cbe=kbe("execa").enabled?"full":"none",Dbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Cbe,stripFinalNewline:!0},vR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var El,Al,nZ,SR,Nbe,tb,rb,us=y(()=>{So();El=({verbose:t},e)=>SR(t,e)!=="none",Al=({verbose:t},e)=>!["none","short"].includes(SR(t,e)),nZ=({verbose:t},e)=>{let r=SR(t,e);return tb(r)?r:void 0},SR=(t,e)=>e===void 0?Nbe(t):vo(t,e),Nbe=t=>t.find(e=>tb(e))??rb.findLast(e=>t.includes(e)),tb=t=>typeof t=="function",rb=["none","short","full"]});import{platform as jbe}from"node:process";import{stripVTControlCharacters as Mbe}from"node:util";var iZ,Wf,oZ,Fbe,Lbe,zbe,Ube,qbe,Bbe,Hbe,nb=y(()=>{iZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Bbe(oZ(o))).join(" ");return{command:n,escapedCommand:i}},Wf=t=>Mbe(t).split(` +`).map(e=>oZ(e)).join(` +`),oZ=t=>t.replaceAll(zbe,e=>Fbe(e)),Fbe=t=>{let e=Ube[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=qbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Lbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},zbe=Lbe(),Ube={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},qbe=65535,Bbe=t=>Hbe.test(t)?t:jbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Hbe=/^[\w./-]+$/});import sZ from"node:process";function wR(){let{env:t}=sZ,{TERM:e,TERM_PROGRAM:r}=t;return sZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var aZ=y(()=>{});var cZ,lZ,Gbe,Zbe,Vbe,Wbe,Kbe,ib,LQe,uZ=y(()=>{aZ();cZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},lZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Gbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Zbe={...cZ,...lZ},Vbe={...cZ,...Gbe},Wbe=wR(),Kbe=Wbe?Zbe:Vbe,ib=Kbe,LQe=Object.entries(lZ)});import Jbe from"node:tty";var Ybe,be,qQe,dZ,BQe,HQe,GQe,ZQe,VQe,WQe,KQe,JQe,YQe,XQe,QQe,eet,tet,ret,net,ob,iet,oet,set,aet,cet,uet,det,fet,pet,fZ,met,pZ,het,get,yet,_et,bet,vet,wet,xet,$et,ket,Eet,xR=y(()=>{Ybe=Jbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Ybe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},qQe=be(0,0),dZ=be(1,22),BQe=be(2,22),HQe=be(3,23),GQe=be(4,24),ZQe=be(53,55),VQe=be(7,27),WQe=be(8,28),KQe=be(9,29),JQe=be(30,39),YQe=be(31,39),XQe=be(32,39),QQe=be(33,39),eet=be(34,39),tet=be(35,39),ret=be(36,39),net=be(37,39),ob=be(90,39),iet=be(40,49),oet=be(41,49),set=be(42,49),aet=be(43,49),cet=be(44,49),uet=be(45,49),det=be(46,49),fet=be(47,49),pet=be(100,49),fZ=be(91,39),met=be(92,39),pZ=be(93,39),het=be(94,39),get=be(95,39),yet=be(96,39),_et=be(97,39),bet=be(101,49),vet=be(102,49),wet=be(103,49),xet=be(104,49),$et=be(105,49),ket=be(106,49),Eet=be(107,49)});var mZ=y(()=>{xR();xR()});var yZ,Qbe,sb,hZ,eve,gZ,tve,_Z=y(()=>{uZ();mZ();yZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Qbe(r),c=eve[t]({failed:o,reject:s,piped:n}),l=tve[t]({reject:s});return`${ob(`[${a}]`)} ${ob(`[${i}]`)} ${l(c)} ${l(e)}`},Qbe=t=>`${sb(t.getHours(),2)}:${sb(t.getMinutes(),2)}:${sb(t.getSeconds(),2)}.${sb(t.getMilliseconds(),3)}`,sb=(t,e)=>String(t).padStart(e,"0"),hZ=({failed:t,reject:e})=>t?e?ib.cross:ib.warning:ib.tick,eve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:hZ,duration:hZ},gZ=t=>t,tve={command:()=>dZ,output:()=>gZ,ipc:()=>gZ,error:({reject:t})=>t?fZ:pZ,duration:()=>ob}});var bZ,rve,nve,vZ=y(()=>{us();bZ=(t,e,r)=>{let n=nZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>rve(i,o,n)).filter(i=>i!==void 0).map(i=>nve(i)).join("")},rve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},nve=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Zbe}from"node:util";var Pi,Vbe,Wbe,Kbe,ib,Jbe,El=y(()=>{eb();uZ();fZ();Pi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Vbe({type:t,result:i,verboseInfo:n}),s=Wbe(e,o),a=dZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Vbe=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),Wbe=(t,e)=>t.split(` -`).map(r=>Kbe({...e,message:r})),Kbe=t=>({verboseLine:lZ(t),verboseObject:t}),ib=t=>{let e=typeof t=="string"?t:Zbe(t);return Gf(e).replaceAll(" "," ".repeat(Jbe))},Jbe=2});var pZ,mZ=y(()=>{ls();El();pZ=(t,e)=>{$l(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var hZ,Ybe,Xbe,Qbe,gZ=y(()=>{ls();hZ=(t,e,r)=>{Qbe(t);let n=Ybe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Ybe=t=>$l({verbose:t})?Xbe++:void 0,Xbe=0n,Qbe=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Q_.includes(e)&&!X_(e)){let r=Q_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as yZ}from"node:process";var ob,vR,sb=y(()=>{ob=()=>yZ.bigint(),vR=t=>Number(yZ.bigint()-t)/1e6});var ab,SR=y(()=>{mZ();gZ();sb();eb();So();ab=(t,e,r)=>{let n=ob(),{command:i,escapedCommand:o}=JG(t,e),s=mR(r,"verbose"),a=hZ(s,o,{...r});return pZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var wZ=v((Met,SZ)=>{SZ.exports=vZ;vZ.sync=tve;var _Z=Ge("fs");function eve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{EZ.exports=$Z;$Z.sync=rve;var xZ=Ge("fs");function $Z(t,e,r){xZ.stat(t,function(n,i){r(n,n?!1:kZ(i,e))})}function rve(t,e){return kZ(xZ.statSync(t),e)}function kZ(t,e){return t.isFile()&&nve(t,e)}function nve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var OZ=v((zet,TZ)=>{var Let=Ge("fs"),cb;process.platform==="win32"||global.TESTING_WINDOWS?cb=wZ():cb=AZ();TZ.exports=wR;wR.sync=ive;function wR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){wR(t,e||{},function(o,s){o?i(o):n(s)})})}cb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function ive(t,e){try{return cb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var jZ=v((Uet,NZ)=>{var Al=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",RZ=Ge("path"),ove=Al?";":":",IZ=OZ(),PZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),CZ=(t,e)=>{let r=e.colon||ove,n=t.match(/\//)||Al&&t.match(/\\/)?[""]:[...Al?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Al?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Al?i.split(r):[""];return Al&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},DZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=CZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(PZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=RZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];IZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},sve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=CZ(t,e),o=[];for(let s=0;s{"use strict";var MZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};xR.exports=MZ;xR.exports.default=MZ});var qZ=v((Bet,UZ)=>{"use strict";var LZ=Ge("path"),ave=jZ(),cve=FZ();function zZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=ave.sync(t.command,{path:r[cve({env:r})],pathExt:e?LZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=LZ.resolve(i?t.options.cwd:"",s)),s}function lve(t){return zZ(t)||zZ(t,!0)}UZ.exports=lve});var BZ=v((Het,kR)=>{"use strict";var $R=/([()\][%!^"`<>&|;, *?])/g;function uve(t){return t=t.replace($R,"^$1"),t}function dve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace($R,"^$1"),e&&(t=t.replace($R,"^$1")),t}kR.exports.command=uve;kR.exports.argument=dve});var GZ=v((Get,HZ)=>{"use strict";HZ.exports=/^#!(.*)/});var VZ=v((Zet,ZZ)=>{"use strict";var fve=GZ();ZZ.exports=(t="")=>{let e=t.match(fve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var KZ=v((Vet,WZ)=>{"use strict";var ER=Ge("fs"),pve=VZ();function mve(t){let r=Buffer.alloc(150),n;try{n=ER.openSync(t,"r"),ER.readSync(n,r,0,150,0),ER.closeSync(n)}catch{}return pve(r.toString())}WZ.exports=mve});var QZ=v((Wet,XZ)=>{"use strict";var hve=Ge("path"),JZ=qZ(),YZ=BZ(),gve=KZ(),yve=process.platform==="win32",_ve=/\.(?:com|exe)$/i,bve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function vve(t){t.file=JZ(t);let e=t.file&&gve(t.file);return e?(t.args.unshift(t.file),t.command=e,JZ(t)):t.file}function Sve(t){if(!yve)return t;let e=vve(t),r=!_ve.test(e);if(t.options.forceShell||r){let n=bve.test(e);t.command=hve.normalize(t.command),t.command=YZ.command(t.command),t.args=t.args.map(o=>YZ.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function wve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Sve(n)}XZ.exports=wve});var r9=v((Ket,t9)=>{"use strict";var AR=process.platform==="win32";function TR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function xve(t,e){if(!AR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=e9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function e9(t,e){return AR&&t===1&&!e.file?TR(e.original,"spawn"):null}function $ve(t,e){return AR&&t===1&&!e.file?TR(e.original,"spawnSync"):null}t9.exports={hookChildProcess:xve,verifyENOENT:e9,verifyENOENTSync:$ve,notFoundError:TR}});var o9=v((Jet,Tl)=>{"use strict";var n9=Ge("child_process"),OR=QZ(),RR=r9();function i9(t,e,r){let n=OR(t,e,r),i=n9.spawn(n.command,n.args,n.options);return RR.hookChildProcess(i,n),i}function kve(t,e,r){let n=OR(t,e,r),i=n9.spawnSync(n.command,n.args,n.options);return i.error=i.error||RR.verifyENOENTSync(i.status,n),i}Tl.exports=i9;Tl.exports.spawn=i9;Tl.exports.sync=kve;Tl.exports._parse=OR;Tl.exports._enoent=RR});function lb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var s9=y(()=>{});var a9=y(()=>{});import{promisify as Eve}from"node:util";import{execFile as Ave,execFileSync as ttt}from"node:child_process";import c9 from"node:path";import{fileURLToPath as Tve}from"node:url";function ub(t){return t instanceof URL?Tve(t):t}function l9(t){return{*[Symbol.iterator](){let e=c9.resolve(ub(t)),r;for(;r!==e;)yield e,r=e,e=c9.resolve(e,"..")}}}var itt,ott,u9=y(()=>{a9();itt=Eve(Ave);ott=10*1024*1024});import db from"node:process";import Oa from"node:path";var Ove,Rve,Ive,d9,f9=y(()=>{s9();u9();Ove=({cwd:t=db.cwd(),path:e=db.env[lb()],preferLocal:r=!0,execPath:n=db.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(ub(t)),s=[],a=e.split(Oa.delimiter);return r&&Rve(s,a,o),i&&Ive(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},Rve=(t,e,r)=>{for(let n of l9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Ive=(t,e,r,n)=>{let i=Oa.resolve(n,ub(r),"..");e.includes(i)||t.push(i)},d9=({env:t=db.env,...e}={})=>{t={...t};let r=lb({env:t});return e.path=t[r],t[r]=Ove(e),t}});var p9,ti,m9,h9,g9,fb,Zf,Vf,Ra=y(()=>{p9=(t,e,r)=>{let n=r?Vf:Zf,i=t instanceof ti?{}:{cause:t};return new n(e,i)},ti=class extends Error{},m9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,g9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},h9=t=>fb(t)&&g9 in t,g9=Symbol("isExecaError"),fb=t=>Object.prototype.toString.call(t)==="[object Error]",Zf=class extends Error{};m9(Zf,Zf.name);Vf=class extends Error{};m9(Vf,Vf.name)});var y9,Pve,_9,b9,v9=y(()=>{y9=()=>{let t=b9-_9+1;return Array.from({length:t},Pve)},Pve=(t,e)=>({name:`SIGRT${e+1}`,number:_9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),_9=34,b9=64});var S9,w9=y(()=>{S9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Cve}from"node:os";var IR,Dve,x9=y(()=>{w9();v9();IR=()=>{let t=y9();return[...S9,...t].map(Dve)},Dve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Cve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Nve}from"node:os";var jve,Mve,$9,Fve,Lve,zve,wtt,k9=y(()=>{x9();jve=()=>{let t=IR();return Object.fromEntries(t.map(Mve))},Mve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],$9=jve(),Fve=()=>{let t=IR(),e=65,r=Array.from({length:e},(n,i)=>Lve(i,t));return Object.assign({},...r)},Lve=(t,e)=>{let r=zve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},zve=(t,e)=>{let r=e.find(({name:n})=>Nve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},wtt=Fve()});import{constants as Wf}from"node:os";var A9,T9,O9,Uve,qve,E9,Bve,PR,Hve,Gve,pb,Kf=y(()=>{k9();A9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return O9(t,e)},T9=t=>t===0?t:O9(t,"`subprocess.kill()`'s argument"),O9=(t,e)=>{if(Number.isInteger(t))return Uve(t,e);if(typeof t=="string")return Bve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${PR()}`)},Uve=(t,e)=>{if(E9.has(t))return E9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${PR()}`)},qve=()=>new Map(Object.entries(Wf.signals).reverse().map(([t,e])=>[e,t])),E9=qve(),Bve=(t,e)=>{if(t in Wf.signals)return t;throw t.toUpperCase()in Wf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${PR()}`)},PR=()=>`Available signal names: ${Hve()}. -Available signal numbers: ${Gve()}.`,Hve=()=>Object.keys(Wf.signals).sort().map(t=>`'${t}'`).join(", "),Gve=()=>[...new Set(Object.values(Wf.signals).sort((t,e)=>t-e))].join(", "),pb=t=>$9[t].description});import{setTimeout as Zve}from"node:timers/promises";var R9,Vve,I9,Wve,Kve,Jve,CR,mb=y(()=>{Ra();Kf();R9=t=>{if(t===!1)return t;if(t===!0)return Vve;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},Vve=1e3*5,I9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Wve(s,a,r);Kve(l,n);let u=t(c);return Jve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Wve=(t,e,r)=>{let[n=r,i]=fb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!fb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:T9(n),error:i}},Kve=(t,e)=>{t!==void 0&&e.reject(t)},Jve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&CR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},CR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Zve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Yve}from"node:events";var hb,DR=y(()=>{hb=async(t,e)=>{t.aborted||await Yve(t,"abort",{signal:e})}});var P9,C9,Xve,NR=y(()=>{DR();P9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},C9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Xve(t,e,n,i)],Xve=async(t,e,r,{signal:n})=>{throw await hb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Ol,Qve,jR,D9,N9,gb,j9,M9,F9,L9,z9,U9,eSe,tSe,rSe,ri,nSe,us,Rl,Il=y(()=>{Ol=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Qve(t,e,r),jR(t,e,n)},Qve=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},jR=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} cannot be used: the ${us(e)} has already exited or disconnected.`)},D9=t=>{throw new Error(`${ri("getOneMessage",t)} could not complete: the ${us(t)} exited or disconnected.`)},N9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${us(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as ive}from"node:util";var Pi,ove,sve,ave,ab,cve,Tl=y(()=>{nb();_Z();vZ();Pi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ove({type:t,result:i,verboseInfo:n}),s=sve(e,o),a=bZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ove=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),sve=(t,e)=>t.split(` +`).map(r=>ave({...e,message:r})),ave=t=>({verboseLine:yZ(t),verboseObject:t}),ab=t=>{let e=typeof t=="string"?t:ive(t);return Wf(e).replaceAll(" "," ".repeat(cve))},cve=2});var SZ,wZ=y(()=>{us();Tl();SZ=(t,e)=>{El(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var xZ,lve,uve,dve,$Z=y(()=>{us();xZ=(t,e,r)=>{dve(t);let n=lve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},lve=t=>El({verbose:t})?uve++:void 0,uve=0n,dve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!rb.includes(e)&&!tb(e)){let r=rb.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as kZ}from"node:process";var cb,$R,lb=y(()=>{cb=()=>kZ.bigint(),$R=t=>Number(kZ.bigint()-t)/1e6});var ub,kR=y(()=>{wZ();$Z();lb();nb();So();ub=(t,e,r)=>{let n=cb(),{command:i,escapedCommand:o}=iZ(t,e),s=_R(r,"verbose"),a=xZ(s,o,{...r});return SZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var RZ=v((Xet,OZ)=>{OZ.exports=TZ;TZ.sync=pve;var EZ=Ge("fs");function fve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{DZ.exports=PZ;PZ.sync=mve;var IZ=Ge("fs");function PZ(t,e,r){IZ.stat(t,function(n,i){r(n,n?!1:CZ(i,e))})}function mve(t,e){return CZ(IZ.statSync(t),e)}function CZ(t,e){return t.isFile()&&hve(t,e)}function hve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var MZ=v((ttt,jZ)=>{var ett=Ge("fs"),db;process.platform==="win32"||global.TESTING_WINDOWS?db=RZ():db=NZ();jZ.exports=ER;ER.sync=gve;function ER(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){ER(t,e||{},function(o,s){o?i(o):n(s)})})}db(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function gve(t,e){try{return db.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var HZ=v((rtt,BZ)=>{var Ol=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",FZ=Ge("path"),yve=Ol?";":":",LZ=MZ(),zZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),UZ=(t,e)=>{let r=e.colon||yve,n=t.match(/\//)||Ol&&t.match(/\\/)?[""]:[...Ol?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ol?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ol?i.split(r):[""];return Ol&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},qZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=UZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(zZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=FZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];LZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},_ve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=UZ(t,e),o=[];for(let s=0;s{"use strict";var GZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};AR.exports=GZ;AR.exports.default=GZ});var JZ=v((itt,KZ)=>{"use strict";var VZ=Ge("path"),bve=HZ(),vve=ZZ();function WZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=bve.sync(t.command,{path:r[vve({env:r})],pathExt:e?VZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=VZ.resolve(i?t.options.cwd:"",s)),s}function Sve(t){return WZ(t)||WZ(t,!0)}KZ.exports=Sve});var YZ=v((ott,OR)=>{"use strict";var TR=/([()\][%!^"`<>&|;, *?])/g;function wve(t){return t=t.replace(TR,"^$1"),t}function xve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(TR,"^$1"),e&&(t=t.replace(TR,"^$1")),t}OR.exports.command=wve;OR.exports.argument=xve});var QZ=v((stt,XZ)=>{"use strict";XZ.exports=/^#!(.*)/});var t9=v((att,e9)=>{"use strict";var $ve=QZ();e9.exports=(t="")=>{let e=t.match($ve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var n9=v((ctt,r9)=>{"use strict";var RR=Ge("fs"),kve=t9();function Eve(t){let r=Buffer.alloc(150),n;try{n=RR.openSync(t,"r"),RR.readSync(n,r,0,150,0),RR.closeSync(n)}catch{}return kve(r.toString())}r9.exports=Eve});var a9=v((ltt,s9)=>{"use strict";var Ave=Ge("path"),i9=JZ(),o9=YZ(),Tve=n9(),Ove=process.platform==="win32",Rve=/\.(?:com|exe)$/i,Ive=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Pve(t){t.file=i9(t);let e=t.file&&Tve(t.file);return e?(t.args.unshift(t.file),t.command=e,i9(t)):t.file}function Cve(t){if(!Ove)return t;let e=Pve(t),r=!Rve.test(e);if(t.options.forceShell||r){let n=Ive.test(e);t.command=Ave.normalize(t.command),t.command=o9.command(t.command),t.args=t.args.map(o=>o9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Dve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Cve(n)}s9.exports=Dve});var u9=v((utt,l9)=>{"use strict";var IR=process.platform==="win32";function PR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Nve(t,e){if(!IR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=c9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function c9(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawn"):null}function jve(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawnSync"):null}l9.exports={hookChildProcess:Nve,verifyENOENT:c9,verifyENOENTSync:jve,notFoundError:PR}});var p9=v((dtt,Rl)=>{"use strict";var d9=Ge("child_process"),CR=a9(),DR=u9();function f9(t,e,r){let n=CR(t,e,r),i=d9.spawn(n.command,n.args,n.options);return DR.hookChildProcess(i,n),i}function Mve(t,e,r){let n=CR(t,e,r),i=d9.spawnSync(n.command,n.args,n.options);return i.error=i.error||DR.verifyENOENTSync(i.status,n),i}Rl.exports=f9;Rl.exports.spawn=f9;Rl.exports.sync=Mve;Rl.exports._parse=CR;Rl.exports._enoent=DR});function fb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var m9=y(()=>{});var h9=y(()=>{});import{promisify as Fve}from"node:util";import{execFile as Lve,execFileSync as gtt}from"node:child_process";import g9 from"node:path";import{fileURLToPath as zve}from"node:url";function pb(t){return t instanceof URL?zve(t):t}function y9(t){return{*[Symbol.iterator](){let e=g9.resolve(pb(t)),r;for(;r!==e;)yield e,r=e,e=g9.resolve(e,"..")}}}var btt,vtt,_9=y(()=>{h9();btt=Fve(Lve);vtt=10*1024*1024});import mb from"node:process";import Oa from"node:path";var Uve,qve,Bve,b9,v9=y(()=>{m9();_9();Uve=({cwd:t=mb.cwd(),path:e=mb.env[fb()],preferLocal:r=!0,execPath:n=mb.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(pb(t)),s=[],a=e.split(Oa.delimiter);return r&&qve(s,a,o),i&&Bve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},qve=(t,e,r)=>{for(let n of y9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Bve=(t,e,r,n)=>{let i=Oa.resolve(n,pb(r),"..");e.includes(i)||t.push(i)},b9=({env:t=mb.env,...e}={})=>{t={...t};let r=fb({env:t});return e.path=t[r],t[r]=Uve(e),t}});var S9,ti,w9,x9,$9,hb,Kf,Jf,Ra=y(()=>{S9=(t,e,r)=>{let n=r?Jf:Kf,i=t instanceof ti?{}:{cause:t};return new n(e,i)},ti=class extends Error{},w9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,$9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},x9=t=>hb(t)&&$9 in t,$9=Symbol("isExecaError"),hb=t=>Object.prototype.toString.call(t)==="[object Error]",Kf=class extends Error{};w9(Kf,Kf.name);Jf=class extends Error{};w9(Jf,Jf.name)});var k9,Hve,E9,A9,T9=y(()=>{k9=()=>{let t=A9-E9+1;return Array.from({length:t},Hve)},Hve=(t,e)=>({name:`SIGRT${e+1}`,number:E9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),E9=34,A9=64});var O9,R9=y(()=>{O9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Gve}from"node:os";var NR,Zve,I9=y(()=>{R9();T9();NR=()=>{let t=k9();return[...O9,...t].map(Zve)},Zve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Gve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Vve}from"node:os";var Wve,Kve,P9,Jve,Yve,Xve,Mtt,C9=y(()=>{I9();Wve=()=>{let t=NR();return Object.fromEntries(t.map(Kve))},Kve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],P9=Wve(),Jve=()=>{let t=NR(),e=65,r=Array.from({length:e},(n,i)=>Yve(i,t));return Object.assign({},...r)},Yve=(t,e)=>{let r=Xve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Xve=(t,e)=>{let r=e.find(({name:n})=>Vve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Mtt=Jve()});import{constants as Yf}from"node:os";var N9,j9,M9,Qve,eSe,D9,tSe,jR,rSe,nSe,gb,Xf=y(()=>{C9();N9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return M9(t,e)},j9=t=>t===0?t:M9(t,"`subprocess.kill()`'s argument"),M9=(t,e)=>{if(Number.isInteger(t))return Qve(t,e);if(typeof t=="string")return tSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${jR()}`)},Qve=(t,e)=>{if(D9.has(t))return D9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${jR()}`)},eSe=()=>new Map(Object.entries(Yf.signals).reverse().map(([t,e])=>[e,t])),D9=eSe(),tSe=(t,e)=>{if(t in Yf.signals)return t;throw t.toUpperCase()in Yf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${jR()}`)},jR=()=>`Available signal names: ${rSe()}. +Available signal numbers: ${nSe()}.`,rSe=()=>Object.keys(Yf.signals).sort().map(t=>`'${t}'`).join(", "),nSe=()=>[...new Set(Object.values(Yf.signals).sort((t,e)=>t-e))].join(", "),gb=t=>P9[t].description});import{setTimeout as iSe}from"node:timers/promises";var F9,oSe,L9,sSe,aSe,cSe,MR,yb=y(()=>{Ra();Xf();F9=t=>{if(t===!1)return t;if(t===!0)return oSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},oSe=1e3*5,L9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=sSe(s,a,r);aSe(l,n);let u=t(c);return cSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},sSe=(t,e,r)=>{let[n=r,i]=hb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!hb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:j9(n),error:i}},aSe=(t,e)=>{t!==void 0&&e.reject(t)},cSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&MR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},MR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await iSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as lSe}from"node:events";var _b,FR=y(()=>{_b=async(t,e)=>{t.aborted||await lSe(t,"abort",{signal:e})}});var z9,U9,uSe,LR=y(()=>{FR();z9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},U9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[uSe(t,e,n,i)],uSe=async(t,e,r,{signal:n})=>{throw await _b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Il,dSe,zR,q9,B9,bb,H9,G9,Z9,V9,W9,K9,fSe,pSe,mSe,ri,hSe,ds,Pl,Cl=y(()=>{Il=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{dSe(t,e,r),zR(t,e,n)},dSe=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},zR=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} cannot be used: the ${ds(e)} has already exited or disconnected.`)},q9=t=>{throw new Error(`${ri("getOneMessage",t)} could not complete: the ${ds(t)} exited or disconnected.`)},B9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${ds(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${ri("getOneMessage",t)}, ${ri("sendMessage",t,"message, {strict: true}")}, -]);`)},gb=(t,e)=>new Error(`${ri("sendMessage",e)} failed when sending an acknowledgment response to the ${us(e)}.`,{cause:t}),j9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${us(t)} is not listening to incoming messages.`)},M9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${us(t)} exited without listening to incoming messages.`)},F9=()=>new Error(`\`cancelSignal\` aborted: the ${us(!0)} disconnected.`),L9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},z9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ri(e,r)} cannot be used: the ${us(r)} is disconnecting.`,{cause:t})},U9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(eSe(t))throw new Error(`${ri(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},eSe=({code:t,message:e})=>tSe.has(t)||rSe.some(r=>e.includes(r)),tSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),rSe=["could not be cloned","circular structure","call stack size exceeded"],ri=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${nSe(e)}${t}(${r})`,nSe=t=>t?"":"subprocess.",us=t=>t?"parent process":"subprocess",Rl=t=>{t.connected&&t.disconnect()}});var Ci,Pl=y(()=>{Ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var _b,Cl,Di,q9,iSe,oSe,B9,sSe,H9,Jf,yb,ds=y(()=>{So();_b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=q9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(B9(o,e,n,!0));return s},Cl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=q9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(B9(o,e,n,!1));return s},Di=new WeakMap,q9=(t,e,r)=>{let n=iSe(e,r);return oSe(n,e,r,t),n},iSe=(t,e)=>{let r=hR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Jf(e)}" must not be "${t}". +]);`)},bb=(t,e)=>new Error(`${ri("sendMessage",e)} failed when sending an acknowledgment response to the ${ds(e)}.`,{cause:t}),H9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${ds(t)} is not listening to incoming messages.`)},G9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${ds(t)} exited without listening to incoming messages.`)},Z9=()=>new Error(`\`cancelSignal\` aborted: the ${ds(!0)} disconnected.`),V9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},W9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ri(e,r)} cannot be used: the ${ds(r)} is disconnecting.`,{cause:t})},K9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(fSe(t))throw new Error(`${ri(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},fSe=({code:t,message:e})=>pSe.has(t)||mSe.some(r=>e.includes(r)),pSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),mSe=["could not be cloned","circular structure","call stack size exceeded"],ri=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${hSe(e)}${t}(${r})`,hSe=t=>t?"":"subprocess.",ds=t=>t?"parent process":"subprocess",Pl=t=>{t.connected&&t.disconnect()}});var Ci,Dl=y(()=>{Ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Sb,Nl,Di,J9,gSe,ySe,Y9,_Se,X9,Qf,vb,fs=y(()=>{So();Sb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Y9(o,e,n,!0));return s},Nl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Y9(o,e,n,!1));return s},Di=new WeakMap,J9=(t,e,r)=>{let n=gSe(e,r);return ySe(n,e,r,t),n},gSe=(t,e)=>{let r=bR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Qf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},oSe=(t,e,r,n)=>{let i=n[H9(t)];if(i===void 0)throw new TypeError(`"${Jf(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Jf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Jf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},B9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=sSe(t,r);return`The "${i}: ${yb(o)}" option is incompatible with using "${Jf(n)}: ${yb(e)}". -Please set this option with "pipe" instead.`},sSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=H9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},H9=t=>t==="all"?1:t,Jf=t=>t?"to":"from",yb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as aSe}from"node:events";var Ia,bb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),aSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var vb,MR,Sb,FR,G9,Z9,Yf=y(()=>{vb=(t,e)=>{e&&MR(t)},MR=t=>{t.refCounted()},Sb=(t,e)=>{e&&FR(t)},FR=t=>{t.unrefCounted()},G9=(t,e)=>{e&&(FR(t),FR(t))},Z9=(t,e)=>{e&&(MR(t),MR(t))}});import{once as cSe}from"node:events";import{scheduler as lSe}from"node:timers/promises";var V9,W9,wb,K9=y(()=>{$b();Yf();xb();kb();V9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(Y9(i)||Q9(i))return;wb.has(t)||wb.set(t,[]);let o=wb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await X9(t,n,i),await lSe.yield();let s=await J9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},W9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{LR();let o=wb.get(t);for(;o?.length>0;)await cSe(n,"message:done");t.removeListener("message",i),Z9(e,r),n.connected=!1,n.emit("disconnect")},wb=new WeakMap});import{EventEmitter as uSe}from"node:events";var fs,Eb,dSe,Ab,Xf=y(()=>{K9();Yf();fs=(t,e,r)=>{if(Eb.has(t))return Eb.get(t);let n=new uSe;return n.connected=!0,Eb.set(t,n),dSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Eb=new WeakMap,dSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=V9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",W9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),G9(r,n)},Ab=t=>{let e=Eb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as fSe}from"node:events";var eV,pSe,tV,J9,Y9,rV,Tb,mSe,Ob,nV,xb=y(()=>{Pl();bb();Pb();Il();Xf();$b();eV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=fs(t,e,r),s=Rb(t,o);return{id:pSe++,type:Ob,message:n,hasListeners:s}},pSe=0n,tV=(t,e)=>{if(!(e?.type!==Ob||e.hasListeners))for(let{id:r}of t)r!==void 0&&Tb[r].resolve({isDeadlock:!0,hasListeners:!1})},J9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Ob||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:nV,message:Rb(e,i)};try{await Ib({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},Y9=t=>{if(t?.type!==nV)return!1;let{id:e,message:r}=t;return Tb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},rV=async(t,e,r)=>{if(t?.type!==Ob)return;let n=Ci();Tb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,mSe(e,r,i)]);o&&N9(r),s||j9(r)}finally{i.abort(),delete Tb[t.id]}},Tb={},mSe=async(t,e,{signal:r})=>{Ia(t,1,r),await fSe(t,"disconnect",{signal:r}),M9(e)},Ob="execa:ipc:request",nV="execa:ipc:response"});var iV,oV,X9,Qf,Rb,hSe,$b=y(()=>{Pl();So();ds();xb();iV=(t,e,r)=>{Qf.has(t)||Qf.set(t,new Set);let n=Qf.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},oV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},X9=async(t,e,r)=>{for(;!Rb(t,e)&&Qf.get(t)?.size>0;){let n=[...Qf.get(t)];tV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Qf=new WeakMap,Rb=(t,e)=>e.listenerCount("message")>hSe(t),hSe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as gSe}from"node:util";var Ib,ySe,UR,_Se,zR,Pb=y(()=>{Il();$b();xb();Ib=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Ol({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),ySe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ySe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=eV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=iV(t,s,o);try{await UR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Rl(t),c}finally{oV(a)}},UR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=_Se(t);try{await Promise.all([rV(n,t,r),o(n)])}catch(s){throw z9({error:s,methodName:e,isSubprocess:r}),U9({error:s,methodName:e,isSubprocess:r,message:i}),s}},_Se=t=>{if(zR.has(t))return zR.get(t);let e=gSe(t.send.bind(t));return zR.set(t,e),e},zR=new WeakMap});import{scheduler as bSe}from"node:timers/promises";var aV,cV,vSe,sV,Q9,lV,LR,qR,kb=y(()=>{Pb();Xf();Il();aV=(t,e)=>{let r="cancelSignal";return jR(r,!1,t.connected),UR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:lV,message:e},message:e})},cV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await vSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),qR.signal),vSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!sV){if(sV=!0,!n){L9();return}if(e===null){LR();return}fs(t,e,r),await bSe.yield()}},sV=!1,Q9=t=>t?.type!==lV?!1:(qR.abort(t.message),!0),lV="execa:ipc:cancel",LR=()=>{qR.abort(F9())},qR=new AbortController});var uV,dV,SSe,wSe,BR=y(()=>{DR();kb();mb();uV=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},dV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[SSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],SSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await hb(e,i);let o=wSe(e);throw await aV(t,o),CR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},wSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as xSe}from"node:timers/promises";var fV,pV,$Se,HR=y(()=>{Ra();fV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},pV=(t,e,r,n)=>e===0||e===void 0?[]:[$Se(t,e,r,n)],$Se=async(t,e,r,{signal:n})=>{throw await xSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ti}});import{execPath as kSe,execArgv as ESe}from"node:process";import mV from"node:path";var hV,gV,GR=y(()=>{xl();hV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},gV=(t,e,{node:r=!1,nodePath:n=kSe,nodeOptions:i=ESe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=wl(n,'The "nodePath" option'),l=mV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(mV.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as ASe}from"node:v8";var yV,TSe,OSe,RSe,_V,ZR=y(()=>{yV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");RSe[r](t)}},TSe=t=>{try{ASe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},OSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},RSe={advanced:TSe,json:OSe},_V=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var vV,ISe,sn,VR,PSe,bV,Cb,Pa=y(()=>{vV=({encoding:t})=>{if(VR.has(t))return;let e=PSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Cb(t)}\`. -Please rename it to ${Cb(e)}.`);let r=[...VR].map(n=>Cb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Cb(t)}\`. -Please rename it to one of: ${r}.`)},ISe=new Set(["utf8","utf16le"]),sn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),VR=new Set([...ISe,...sn]),PSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in bV)return bV[e];if(VR.has(e))return e},bV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Cb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as CSe}from"node:fs";import DSe from"node:path";import NSe from"node:process";var SV,wV,xV,WR=y(()=>{xl();SV=(t=wV())=>{let e=wl(t,'The "cwd" option');return DSe.resolve(e)},wV=()=>{try{return NSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},xV=(t,e)=>{if(e===wV())return t;let r;try{r=CSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},ySe=(t,e,r,n)=>{let i=n[X9(t)];if(i===void 0)throw new TypeError(`"${Qf(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Qf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Qf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Y9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=_Se(t,r);return`The "${i}: ${vb(o)}" option is incompatible with using "${Qf(n)}: ${vb(e)}". +Please set this option with "pipe" instead.`},_Se=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=X9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},X9=t=>t==="all"?1:t,Qf=t=>t?"to":"from",vb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as bSe}from"node:events";var Ia,wb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),bSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var xb,UR,$b,qR,Q9,eV,ep=y(()=>{xb=(t,e)=>{e&&UR(t)},UR=t=>{t.refCounted()},$b=(t,e)=>{e&&qR(t)},qR=t=>{t.unrefCounted()},Q9=(t,e)=>{e&&(qR(t),qR(t))},eV=(t,e)=>{e&&(UR(t),UR(t))}});import{once as vSe}from"node:events";import{scheduler as SSe}from"node:timers/promises";var tV,rV,kb,nV=y(()=>{Ab();ep();Eb();Tb();tV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(oV(i)||aV(i))return;kb.has(t)||kb.set(t,[]);let o=kb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await sV(t,n,i),await SSe.yield();let s=await iV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},rV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{BR();let o=kb.get(t);for(;o?.length>0;)await vSe(n,"message:done");t.removeListener("message",i),eV(e,r),n.connected=!1,n.emit("disconnect")},kb=new WeakMap});import{EventEmitter as wSe}from"node:events";var ps,Ob,xSe,Rb,tp=y(()=>{nV();ep();ps=(t,e,r)=>{if(Ob.has(t))return Ob.get(t);let n=new wSe;return n.connected=!0,Ob.set(t,n),xSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Ob=new WeakMap,xSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=tV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",rV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),Q9(r,n)},Rb=t=>{let e=Ob.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as $Se}from"node:events";var cV,kSe,lV,iV,oV,uV,Ib,ESe,Pb,dV,Eb=y(()=>{Dl();wb();Nb();Cl();tp();Ab();cV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ps(t,e,r),s=Cb(t,o);return{id:kSe++,type:Pb,message:n,hasListeners:s}},kSe=0n,lV=(t,e)=>{if(!(e?.type!==Pb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Ib[r].resolve({isDeadlock:!0,hasListeners:!1})},iV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Pb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:dV,message:Cb(e,i)};try{await Db({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},oV=t=>{if(t?.type!==dV)return!1;let{id:e,message:r}=t;return Ib[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},uV=async(t,e,r)=>{if(t?.type!==Pb)return;let n=Ci();Ib[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ESe(e,r,i)]);o&&B9(r),s||H9(r)}finally{i.abort(),delete Ib[t.id]}},Ib={},ESe=async(t,e,{signal:r})=>{Ia(t,1,r),await $Se(t,"disconnect",{signal:r}),G9(e)},Pb="execa:ipc:request",dV="execa:ipc:response"});var fV,pV,sV,rp,Cb,ASe,Ab=y(()=>{Dl();So();fs();Eb();fV=(t,e,r)=>{rp.has(t)||rp.set(t,new Set);let n=rp.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},pV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},sV=async(t,e,r)=>{for(;!Cb(t,e)&&rp.get(t)?.size>0;){let n=[...rp.get(t)];lV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},rp=new WeakMap,Cb=(t,e)=>e.listenerCount("message")>ASe(t),ASe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as TSe}from"node:util";var Db,OSe,GR,RSe,HR,Nb=y(()=>{Cl();Ab();Eb();Db=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Il({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),OSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},OSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=cV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=fV(t,s,o);try{await GR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Pl(t),c}finally{pV(a)}},GR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=RSe(t);try{await Promise.all([uV(n,t,r),o(n)])}catch(s){throw W9({error:s,methodName:e,isSubprocess:r}),K9({error:s,methodName:e,isSubprocess:r,message:i}),s}},RSe=t=>{if(HR.has(t))return HR.get(t);let e=TSe(t.send.bind(t));return HR.set(t,e),e},HR=new WeakMap});import{scheduler as ISe}from"node:timers/promises";var hV,gV,PSe,mV,aV,yV,BR,ZR,Tb=y(()=>{Nb();tp();Cl();hV=(t,e)=>{let r="cancelSignal";return zR(r,!1,t.connected),GR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:yV,message:e},message:e})},gV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await PSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),ZR.signal),PSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!mV){if(mV=!0,!n){V9();return}if(e===null){BR();return}ps(t,e,r),await ISe.yield()}},mV=!1,aV=t=>t?.type!==yV?!1:(ZR.abort(t.message),!0),yV="execa:ipc:cancel",BR=()=>{ZR.abort(Z9())},ZR=new AbortController});var _V,bV,CSe,DSe,VR=y(()=>{FR();Tb();yb();_V=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},bV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[CSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],CSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await _b(e,i);let o=DSe(e);throw await hV(t,o),MR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},DSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as NSe}from"node:timers/promises";var vV,SV,jSe,WR=y(()=>{Ra();vV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},SV=(t,e,r,n)=>e===0||e===void 0?[]:[jSe(t,e,r,n)],jSe=async(t,e,r,{signal:n})=>{throw await NSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ti}});import{execPath as MSe,execArgv as FSe}from"node:process";import wV from"node:path";var xV,$V,KR=y(()=>{kl();xV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},$V=(t,e,{node:r=!1,nodePath:n=MSe,nodeOptions:i=FSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=$l(n,'The "nodePath" option'),l=wV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(wV.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as LSe}from"node:v8";var kV,zSe,USe,qSe,EV,JR=y(()=>{kV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");qSe[r](t)}},zSe=t=>{try{LSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},USe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},qSe={advanced:zSe,json:USe},EV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var TV,BSe,sn,YR,HSe,AV,jb,Pa=y(()=>{TV=({encoding:t})=>{if(YR.has(t))return;let e=HSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. +Please rename it to ${jb(e)}.`);let r=[...YR].map(n=>jb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. +Please rename it to one of: ${r}.`)},BSe=new Set(["utf8","utf16le"]),sn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),YR=new Set([...BSe,...sn]),HSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in AV)return AV[e];if(YR.has(e))return e},AV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},jb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as GSe}from"node:fs";import ZSe from"node:path";import VSe from"node:process";var OV,RV,IV,XR=y(()=>{kl();OV=(t=RV())=>{let e=$l(t,'The "cwd" option');return ZSe.resolve(e)},RV=()=>{try{return VSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},IV=(t,e)=>{if(e===RV())return t;let r;try{r=GSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import jSe from"node:path";import $V from"node:process";var kV,Db,MSe,FSe,KR=y(()=>{kV=St(o9(),1);f9();mb();Kf();NR();BR();HR();GR();ZR();Pa();WR();xl();So();Db=(t,e,r)=>{r.cwd=SV(r.cwd);let[n,i,o]=gV(t,e,r),{command:s,args:a,options:c}=kV.default._parse(n,i,o),l=WG(c),u=MSe(l);return fV(u),vV(u),yV(u),P9(u),uV(u),u.shell=uR(u.shell),u.env=FSe(u),u.killSignal=A9(u.killSignal),u.forceKillAfterDelay=R9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!sn.has(u.encoding)&&u.buffer[f]),$V.platform==="win32"&&jSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},MSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),FSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...$V.env,...t}:t;return r||n?d9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Nb,JR=y(()=>{Nb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Dl(t){if(typeof t=="string")return LSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return zSe(t)}var LSe,zSe,EV,USe,AV,qSe,YR=y(()=>{LSe=t=>t.at(-1)===EV?t.slice(0,t.at(-2)===AV?-2:-1):t,zSe=t=>t.at(-1)===USe?t.subarray(0,t.at(-2)===qSe?-2:-1):t,EV=` -`,USe=EV.codePointAt(0),AV="\r",qSe=AV.codePointAt(0)});function ni(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function XR(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Ca(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function QR(t,e){return XR(t,e)&&Ca(t,e)}var Da=y(()=>{});function TV(){return this[tI].next()}function OV(t){return this[tI].return(t)}function rI({preventCancel:t=!1}={}){let e=this.getReader(),r=new eI(e,t),n=Object.create(HSe);return n[tI]=r,n}var BSe,eI,tI,HSe,RV=y(()=>{BSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),eI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},tI=Symbol();Object.defineProperty(TV,"name",{value:"next"});Object.defineProperty(OV,"name",{value:"return"});HSe=Object.create(BSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:TV},return:{enumerable:!0,configurable:!0,writable:!0,value:OV}})});var IV=y(()=>{});var PV=y(()=>{RV();IV()});var CV,GSe,ZSe,VSe,ep,nI=y(()=>{Da();PV();CV=t=>{if(Ca(t,{checkOpen:!1})&&ep.on!==void 0)return ZSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(GSe.call(t)==="[object ReadableStream]")return rI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:GSe}=Object.prototype,ZSe=async function*(t){let e=new AbortController,r={};VSe(t,e,r);try{for await(let[n]of ep.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},VSe=async(t,e,r)=>{try{await ep.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},ep={}});var Nl,WSe,jV,DV,KSe,NV,Ni,tp=y(()=>{nI();Nl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=CV(t),u=e();u.length=0;try{for await(let d of l){let f=KSe(d),p=r[f](d,u);jV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return WSe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},WSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&jV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},jV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){DV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&DV(c,e,i,o),new Ni},DV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},KSe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=NV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&NV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:NV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,rp,jb,Mb,Fb,Lb=y(()=>{wo=t=>t,rp=()=>{},jb=({contents:t})=>t,Mb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Fb=t=>t.length});async function zb(t,e){return Nl(t,QSe,e)}var JSe,YSe,XSe,QSe,MV=y(()=>{tp();Lb();JSe=()=>({contents:[]}),YSe=()=>1,XSe=(t,{contents:e})=>(e.push(t),e),QSe={init:JSe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:YSe,truncateChunk:rp,addChunk:XSe,getFinalChunk:rp,finalize:jb}});async function Ub(t,e){return Nl(t,cwe,e)}var ewe,twe,rwe,FV,LV,nwe,iwe,owe,swe,UV,zV,awe,qV,cwe,BV=y(()=>{tp();Lb();ewe=()=>({contents:new ArrayBuffer(0)}),twe=t=>rwe.encode(t),rwe=new TextEncoder,FV=t=>new Uint8Array(t),LV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),nwe=(t,e)=>t.slice(0,e),iwe=(t,{contents:e,length:r},n)=>{let i=qV()?swe(e,n):owe(e,n);return new Uint8Array(i).set(t,r),i},owe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(UV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},swe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:UV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},UV=t=>zV**Math.ceil(Math.log(t)/Math.log(zV)),zV=2,awe=({contents:t,length:e})=>qV()?t:t.slice(0,e),qV=()=>"resize"in ArrayBuffer.prototype,cwe={init:ewe,convertChunk:{string:twe,buffer:FV,arrayBuffer:FV,dataView:LV,typedArray:LV,others:Mb},getSize:Fb,truncateChunk:nwe,addChunk:iwe,getFinalChunk:rp,finalize:awe}});async function Bb(t,e){return Nl(t,pwe,e)}var lwe,qb,uwe,dwe,fwe,pwe,HV=y(()=>{tp();Lb();lwe=()=>({contents:"",textDecoder:new TextDecoder}),qb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),uwe=(t,{contents:e})=>e+t,dwe=(t,e)=>t.slice(0,e),fwe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},pwe={init:lwe,convertChunk:{string:wo,buffer:qb,arrayBuffer:qb,dataView:qb,typedArray:qb,others:Mb},getSize:Fb,truncateChunk:dwe,addChunk:uwe,getFinalChunk:fwe,finalize:jb}});var GV=y(()=>{MV();BV();HV();tp()});import{on as mwe}from"node:events";import{finished as hwe}from"node:stream/promises";var Hb=y(()=>{nI();GV();Object.assign(ep,{on:mwe,finished:hwe})});var ZV,gwe,VV,WV,ywe,KV,JV,Gb,Na=y(()=>{Hb();bo();So();ZV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ni))throw t;if(o==="all")return t;let s=gwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},gwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",VV=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},WV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=ywe(t,e);return`Command's ${r} was larger than ${n} ${i}`},ywe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=vo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:Y_(r),threshold:i,unit:n}},KV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Gb(r)),JV=(t,e,r)=>{if(!e)return t;let n=Gb(r);return t.length>n?t.slice(0,n):t},Gb=([,t])=>t});import{inspect as _we}from"node:util";var XV,bwe,vwe,Swe,wwe,xwe,YV,QV=y(()=>{YR();on();WR();eb();Na();Kf();Ra();XV=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=bwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Swe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>wwe(D)).join(` -`)].map(D=>Gf(Dl(xwe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},bwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=vwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${WV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${pb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},vwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Swe=(t,e)=>{if(t instanceof ti)return;let r=h9(t)?t.originalMessage:String(t?.message??t),n=Gf(xV(r,e));return n===""?void 0:n},wwe=t=>typeof t=="string"?t:_we(t),xwe=t=>Array.isArray(t)?t.map(e=>Dl(YV(e))).filter(Boolean).join(` -`):YV(t),YV=t=>typeof t=="string"?t:qt(t)?K_(t):""});var Zb,jl,np,$we,eW,kwe,ip=y(()=>{Kf();sb();Ra();QV();Zb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>eW({command:t,escapedCommand:e,cwd:o,durationMs:vR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),jl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>np({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),np=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=kwe(l,u),{originalMessage:A,shortMessage:D,message:$}=XV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=p9(t,$,x);return Object.assign(re,$we({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},$we=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>eW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:vR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),eW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),kwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:pb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Ewe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(tW(t*1e3)%1e3),nanoseconds:Math.trunc(tW(t*1e6)%1e3)}}function Awe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function iI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Ewe(t);break}case"bigint":return Awe(t)}throw new TypeError("Expected a finite number or bigint")}var tW,rW=y(()=>{tW=t=>Number.isFinite(t)?t:0});function oI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Twe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Owe(d,u):f;i.push(p)}},a=iI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Iwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var Twe,Owe,Rwe,Iwe,nW=y(()=>{rW();Twe=t=>t===0||t===0n,Owe=(t,e)=>e===1||e===1n?t:`${t}s`,Rwe=1e-7,Iwe=24n*60n*60n*1000n});var iW,oW=y(()=>{El();iW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var sW,Pwe,aW=y(()=>{nW();ls();El();oW();sW=(t,e)=>{$l(e)&&(iW(t,e),Pwe(t,e))},Pwe=(t,e)=>{let r=`(done in ${oI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ml,Vb=y(()=>{aW();Ml=(t,e,{reject:r})=>{if(sW(t,e),t.failed&&r)throw t;return t}});var uW,Cwe,Dwe,dW,fW,cW,Nwe,sI,lW,ja,pW,jwe,Wb,mW,Mwe,Fwe,aI,hW,Lwe,gW,Kb,zwe,cI,Uwe,qwe,yW,In,Jb,lI,_W,bW,ps,wr=y(()=>{Da();yo();on();uW=(t,e)=>ja(t)?"asyncGenerator":pW(t)?"generator":Wb(t)?"fileUrl":Mwe(t)?"filePath":zwe(t)?"webStream":ni(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Uwe(t)?"asyncIterable":qwe(t)?"iterable":cI(t)?dW({transform:t},e):jwe(t)?Cwe(t,e):"native",Cwe=(t,e)=>QR(t.transform,{checkOpen:!1})?Dwe(t,e):cI(t.transform)?dW(t,e):Nwe(t,e),Dwe=(t,e)=>(fW(t,e,"Duplex stream"),"duplex"),dW=(t,e)=>(fW(t,e,"web TransformStream"),"webTransform"),fW=({final:t,binary:e,objectMode:r},n,i)=>{cW(t,`${n}.final`,i),cW(e,`${n}.binary`,i),sI(r,`${n}.objectMode`)},cW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Nwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!lW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(QR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(cI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!lW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return sI(r,`${i}.binary`),sI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},sI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},lW=t=>ja(t)||pW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",pW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",jwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Wb=t=>Object.prototype.toString.call(t)==="[object URL]",mW=t=>Wb(t)&&t.protocol!=="file:",Mwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Fwe.has(e))&&aI(t.file),Fwe=new Set(["file","append"]),aI=t=>typeof t=="string",hW=(t,e)=>t==="native"&&typeof e=="string"&&!Lwe.has(e),Lwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),gW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Kb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",zwe=t=>gW(t)||Kb(t),cI=t=>gW(t?.readable)&&Kb(t?.writable),Uwe=t=>yW(t)&&typeof t[Symbol.asyncIterator]=="function",qwe=t=>yW(t)&&typeof t[Symbol.iterator]=="function",yW=t=>typeof t=="object"&&t!==null,In=new Set(["generator","asyncGenerator","duplex","webTransform"]),Jb=new Set(["fileUrl","filePath","fileNumber"]),lI=new Set(["fileUrl","filePath"]),_W=new Set([...lI,"webStream","nodeStream"]),bW=new Set(["webTransform","duplex"]),ps={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var uI,Bwe,Hwe,vW,dI=y(()=>{wr();uI=(t,e,r,n)=>n==="output"?Bwe(t,e,r):Hwe(t,e,r),Bwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Hwe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},vW=(t,e)=>{let r=t.findLast(({type:n})=>In.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var SW,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,wW=y(()=>{yo();Pa();wr();dI();SW=(t,e,r,n)=>[...t.filter(({type:i})=>!In.has(i)),...Gwe(t,e,r,n)],Gwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>In.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Zwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Jwe(o,r)},Zwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Vwe({stdioItem:t,optionName:i}):e==="webTransform"?Wwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Kwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Vwe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},Wwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=uI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Kwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||sn.has(o),{writableObjectMode:f,readableObjectMode:p}=uI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Jwe=(t,e)=>e==="input"?t.reverse():t});import fI from"node:process";var xW,Ywe,Xwe,Fl,pI,$W,Qwe,exe,kW=y(()=>{Da();wr();xW=(t,e,r)=>{let n=t.map(i=>Ywe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??exe},Ywe=({type:t,value:e},r)=>Xwe[r]??$W[t](e),Xwe=["input","output","output"],Fl=()=>{},pI=()=>"input",$W={generator:Fl,asyncGenerator:Fl,fileUrl:Fl,filePath:Fl,iterable:pI,asyncIterable:pI,uint8Array:pI,webStream:t=>Kb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?XR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Fl,duplex:Fl,native(t){let e=Qwe(t);if(e!==void 0)return e;if(ni(t,{checkOpen:!1}))return $W.nodeStream(t)}},Qwe=t=>{if([0,fI.stdin].includes(t))return"input";if([1,2,fI.stdout,fI.stderr].includes(t))return"output"},exe="output"});var EW,AW=y(()=>{EW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var TW,txe,rxe,OW,nxe,ixe,RW=y(()=>{bo();AW();ls();TW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=txe(t,n).map((a,c)=>OW(a,c));return o?nxe(s,r,i):EW(s,e)},txe=(t,e)=>{if(t===void 0)return Rn.map(n=>e[n]);if(rxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Rn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Rn.length);return Array.from({length:r},(n,i)=>t[i])},rxe=t=>Rn.some(e=>t[e]!==void 0),OW=(t,e)=>Array.isArray(t)?t.map(r=>OW(r,e)):t??(e>=Rn.length?"ignore":"pipe"),nxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!kl(r,i)&&ixe(n)?"ignore":n),ixe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as oxe}from"node:fs";import sxe from"node:tty";var PW,axe,cxe,lxe,uxe,IW,CW=y(()=>{Da();bo();on();ds();PW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?axe({stdioItem:t,fdNumber:n,direction:i}):uxe({stdioItem:t,fdNumber:n}),axe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=cxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ni(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},cxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=lxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(sxe.isatty(i))throw new TypeError(`The \`${e}: ${yb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:_o(oxe(i)),optionName:e}}},lxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=J_.indexOf(t);if(r!==-1)return r},uxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:IW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:IW(e,e,r),optionName:r}:ni(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,IW=(t,e,r)=>{let n=J_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var DW,dxe,fxe,pxe,mxe,NW=y(()=>{Da();on();wr();DW=({input:t,inputFile:e},r)=>r===0?[...dxe(t),...pxe(e)]:[],dxe=t=>t===void 0?[]:[{type:fxe(t),value:t,optionName:"input"}],fxe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},pxe=t=>t===void 0?[]:[{...mxe(t),optionName:"inputFile"}],mxe=t=>{if(Wb(t))return{type:"fileUrl",value:t};if(aI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var jW,MW,hxe,gxe,FW,yxe,_xe,LW,zW=y(()=>{wr();jW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),MW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=hxe(i,t);if(s.length!==0){if(o){gxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(_W.has(t))return FW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});bW.has(t)&&_xe({otherStdioItems:s,type:t,value:e,optionName:r})}},hxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),gxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{lI.has(e)&&FW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},FW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>yxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return LW(s,n,e),i==="output"?o[0].stream:void 0},yxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,_xe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);LW(i,n,e)},LW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ps[r]} that is the same.`)}});var Yb,bxe,vxe,Sxe,wxe,xxe,$xe,kxe,Exe,Axe,Txe,Oxe,mI,Rxe,Xb=y(()=>{bo();wW();dI();wr();kW();RW();CW();NW();zW();Yb=(t,e,r,n)=>{let o=TW(e,r,n).map((a,c)=>bxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Axe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Rxe(a)),s},bxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=Y_(e),{stdioItems:o,isStdioArray:s}=vxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=xW(o,e,i),c=o.map(d=>PW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=SW(c,i,a,r),u=vW(l,a);return Exe(l,u),{direction:a,objectMode:u,stdioItems:l}},vxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Sxe(c,n)),...DW(r,e)],s=jW(o),a=s.length>1;return wxe(s,a,n),$xe(s),{stdioItems:s,isStdioArray:a}},Sxe=(t,e)=>({type:uW(t,e),value:t,optionName:e}),wxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(xxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},xxe=new Set(["ignore","ipc"]),$xe=t=>{for(let e of t)kxe(e)},kxe=({type:t,value:e,optionName:r})=>{if(mW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(hW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Exe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Jb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Axe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Txe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw mI(i),o}},Txe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Oxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Oxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=MW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},mI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ei(r)&&r.destroy()},Rxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as UW}from"node:fs";var BW,ji,Ixe,HW,qW,Pxe,GW=y(()=>{on();Xb();wr();BW=(t,e)=>Yb(Pxe,t,e,!0),ji=({type:t,optionName:e})=>{HW(e,ps[t])},Ixe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&HW(t,`"${e}"`),{}),HW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},qW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Ixe},Pxe={input:{...qW,fileUrl:({value:t})=>({contents:[_o(UW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(UW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...qW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:ji,string:ji,uint8Array:ji}}});var xo,hI,op=y(()=>{YR();xo=(t,{stripFinalNewline:e},r)=>hI(e,r)&&t!==void 0&&!Array.isArray(t)?Dl(t):t,hI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Qb,yI,ZW,VW,Cxe,Dxe,Nxe,WW,jxe,gI,Mxe,Fxe,Lxe,ev=y(()=>{Qb=(t,e,r,n)=>t||r?void 0:VW(e,n),yI=(t,e,r)=>r?t.flatMap(n=>ZW(n,e)):ZW(t,e),ZW=(t,e)=>{let{transform:r,final:n}=VW(e,{});return[...r(t),...n()]},VW=(t,e)=>(e.previousChunks="",{transform:Cxe.bind(void 0,e,t),final:Nxe.bind(void 0,e)}),Cxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=gI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=gI(n,r.slice(i+1))),t.previousChunks=n},Dxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Nxe=function*({previousChunks:t}){t.length>0&&(yield t)},WW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:jxe.bind(void 0,n)},jxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Mxe:Lxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},gI=(t,e)=>`${t}${e}`,Mxe={windowsNewline:`\r +${t}`}});import WSe from"node:path";import PV from"node:process";var CV,Mb,KSe,JSe,QR=y(()=>{CV=St(p9(),1);v9();yb();Xf();LR();VR();WR();KR();JR();Pa();XR();kl();So();Mb=(t,e,r)=>{r.cwd=OV(r.cwd);let[n,i,o]=$V(t,e,r),{command:s,args:a,options:c}=CV.default._parse(n,i,o),l=rZ(c),u=KSe(l);return vV(u),TV(u),kV(u),z9(u),_V(u),u.shell=mR(u.shell),u.env=JSe(u),u.killSignal=N9(u.killSignal),u.forceKillAfterDelay=F9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!sn.has(u.encoding)&&u.buffer[f]),PV.platform==="win32"&&WSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},KSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),JSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...PV.env,...t}:t;return r||n?b9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Fb,eI=y(()=>{Fb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function jl(t){if(typeof t=="string")return YSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return XSe(t)}var YSe,XSe,DV,QSe,NV,ewe,tI=y(()=>{YSe=t=>t.at(-1)===DV?t.slice(0,t.at(-2)===NV?-2:-1):t,XSe=t=>t.at(-1)===QSe?t.subarray(0,t.at(-2)===ewe?-2:-1):t,DV=` +`,QSe=DV.codePointAt(0),NV="\r",ewe=NV.codePointAt(0)});function ni(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function rI(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Ca(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function nI(t,e){return rI(t,e)&&Ca(t,e)}var Da=y(()=>{});function jV(){return this[oI].next()}function MV(t){return this[oI].return(t)}function sI({preventCancel:t=!1}={}){let e=this.getReader(),r=new iI(e,t),n=Object.create(rwe);return n[oI]=r,n}var twe,iI,oI,rwe,FV=y(()=>{twe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),iI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},oI=Symbol();Object.defineProperty(jV,"name",{value:"next"});Object.defineProperty(MV,"name",{value:"return"});rwe=Object.create(twe,{next:{enumerable:!0,configurable:!0,writable:!0,value:jV},return:{enumerable:!0,configurable:!0,writable:!0,value:MV}})});var LV=y(()=>{});var zV=y(()=>{FV();LV()});var UV,nwe,iwe,owe,np,aI=y(()=>{Da();zV();UV=t=>{if(Ca(t,{checkOpen:!1})&&np.on!==void 0)return iwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(nwe.call(t)==="[object ReadableStream]")return sI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:nwe}=Object.prototype,iwe=async function*(t){let e=new AbortController,r={};owe(t,e,r);try{for await(let[n]of np.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},owe=async(t,e,r)=>{try{await np.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},np={}});var Ml,swe,HV,qV,awe,BV,Ni,ip=y(()=>{aI();Ml=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=UV(t),u=e();u.length=0;try{for await(let d of l){let f=awe(d),p=r[f](d,u);HV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return swe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},swe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&HV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},HV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){qV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&qV(c,e,i,o),new Ni},qV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},awe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=BV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&BV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:BV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,op,Lb,zb,Ub,qb=y(()=>{wo=t=>t,op=()=>{},Lb=({contents:t})=>t,zb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ub=t=>t.length});async function Bb(t,e){return Ml(t,dwe,e)}var cwe,lwe,uwe,dwe,GV=y(()=>{ip();qb();cwe=()=>({contents:[]}),lwe=()=>1,uwe=(t,{contents:e})=>(e.push(t),e),dwe={init:cwe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:lwe,truncateChunk:op,addChunk:uwe,getFinalChunk:op,finalize:Lb}});async function Hb(t,e){return Ml(t,vwe,e)}var fwe,pwe,mwe,ZV,VV,hwe,gwe,ywe,_we,KV,WV,bwe,JV,vwe,YV=y(()=>{ip();qb();fwe=()=>({contents:new ArrayBuffer(0)}),pwe=t=>mwe.encode(t),mwe=new TextEncoder,ZV=t=>new Uint8Array(t),VV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hwe=(t,e)=>t.slice(0,e),gwe=(t,{contents:e,length:r},n)=>{let i=JV()?_we(e,n):ywe(e,n);return new Uint8Array(i).set(t,r),i},ywe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(KV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},_we=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:KV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},KV=t=>WV**Math.ceil(Math.log(t)/Math.log(WV)),WV=2,bwe=({contents:t,length:e})=>JV()?t:t.slice(0,e),JV=()=>"resize"in ArrayBuffer.prototype,vwe={init:fwe,convertChunk:{string:pwe,buffer:ZV,arrayBuffer:ZV,dataView:VV,typedArray:VV,others:zb},getSize:Ub,truncateChunk:hwe,addChunk:gwe,getFinalChunk:op,finalize:bwe}});async function Zb(t,e){return Ml(t,kwe,e)}var Swe,Gb,wwe,xwe,$we,kwe,XV=y(()=>{ip();qb();Swe=()=>({contents:"",textDecoder:new TextDecoder}),Gb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),wwe=(t,{contents:e})=>e+t,xwe=(t,e)=>t.slice(0,e),$we=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},kwe={init:Swe,convertChunk:{string:wo,buffer:Gb,arrayBuffer:Gb,dataView:Gb,typedArray:Gb,others:zb},getSize:Ub,truncateChunk:xwe,addChunk:wwe,getFinalChunk:$we,finalize:Lb}});var QV=y(()=>{GV();YV();XV();ip()});import{on as Ewe}from"node:events";import{finished as Awe}from"node:stream/promises";var Vb=y(()=>{aI();QV();Object.assign(np,{on:Ewe,finished:Awe})});var eW,Twe,tW,rW,Owe,nW,iW,Wb,Na=y(()=>{Vb();bo();So();eW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ni))throw t;if(o==="all")return t;let s=Twe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Twe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",tW=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},rW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Owe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=vo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:eb(r),threshold:i,unit:n}},nW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Wb(r)),iW=(t,e,r)=>{if(!e)return t;let n=Wb(r);return t.length>n?t.slice(0,n):t},Wb=([,t])=>t});import{inspect as Rwe}from"node:util";var sW,Iwe,Pwe,Cwe,Dwe,Nwe,oW,aW=y(()=>{tI();on();XR();nb();Na();Xf();Ra();sW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Iwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Cwe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>Dwe(D)).join(` +`)].map(D=>Wf(jl(Nwe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},Iwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Pwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${rW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${gb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Pwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Cwe=(t,e)=>{if(t instanceof ti)return;let r=x9(t)?t.originalMessage:String(t?.message??t),n=Wf(IV(r,e));return n===""?void 0:n},Dwe=t=>typeof t=="string"?t:Rwe(t),Nwe=t=>Array.isArray(t)?t.map(e=>jl(oW(e))).filter(Boolean).join(` +`):oW(t),oW=t=>typeof t=="string"?t:qt(t)?X_(t):""});var Kb,Fl,sp,jwe,cW,Mwe,ap=y(()=>{Xf();lb();Ra();aW();Kb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>cW({command:t,escapedCommand:e,cwd:o,durationMs:$R(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Fl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>sp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),sp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Mwe(l,u),{originalMessage:A,shortMessage:D,message:$}=sW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=S9(t,$,x);return Object.assign(re,jwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},jwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>cW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:$R(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),cW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Mwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:gb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Fwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(lW(t*1e3)%1e3),nanoseconds:Math.trunc(lW(t*1e6)%1e3)}}function Lwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function cI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Fwe(t);break}case"bigint":return Lwe(t)}throw new TypeError("Expected a finite number or bigint")}var lW,uW=y(()=>{lW=t=>Number.isFinite(t)?t:0});function lI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+qwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&zwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Uwe(d,u):f;i.push(p)}},a=cI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Bwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var zwe,Uwe,qwe,Bwe,dW=y(()=>{uW();zwe=t=>t===0||t===0n,Uwe=(t,e)=>e===1||e===1n?t:`${t}s`,qwe=1e-7,Bwe=24n*60n*60n*1000n});var fW,pW=y(()=>{Tl();fW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var mW,Hwe,hW=y(()=>{dW();us();Tl();pW();mW=(t,e)=>{El(e)&&(fW(t,e),Hwe(t,e))},Hwe=(t,e)=>{let r=`(done in ${lI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ll,Jb=y(()=>{hW();Ll=(t,e,{reject:r})=>{if(mW(t,e),t.failed&&r)throw t;return t}});var _W,Gwe,Zwe,bW,vW,gW,Vwe,uI,yW,ja,SW,Wwe,Yb,wW,Kwe,Jwe,dI,xW,Ywe,$W,Xb,Xwe,fI,Qwe,exe,kW,In,Qb,pI,EW,AW,ms,wr=y(()=>{Da();yo();on();_W=(t,e)=>ja(t)?"asyncGenerator":SW(t)?"generator":Yb(t)?"fileUrl":Kwe(t)?"filePath":Xwe(t)?"webStream":ni(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Qwe(t)?"asyncIterable":exe(t)?"iterable":fI(t)?bW({transform:t},e):Wwe(t)?Gwe(t,e):"native",Gwe=(t,e)=>nI(t.transform,{checkOpen:!1})?Zwe(t,e):fI(t.transform)?bW(t,e):Vwe(t,e),Zwe=(t,e)=>(vW(t,e,"Duplex stream"),"duplex"),bW=(t,e)=>(vW(t,e,"web TransformStream"),"webTransform"),vW=({final:t,binary:e,objectMode:r},n,i)=>{gW(t,`${n}.final`,i),gW(e,`${n}.binary`,i),uI(r,`${n}.objectMode`)},gW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Vwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!yW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(nI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(fI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!yW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return uI(r,`${i}.binary`),uI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},uI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},yW=t=>ja(t)||SW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",SW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Wwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Yb=t=>Object.prototype.toString.call(t)==="[object URL]",wW=t=>Yb(t)&&t.protocol!=="file:",Kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Jwe.has(e))&&dI(t.file),Jwe=new Set(["file","append"]),dI=t=>typeof t=="string",xW=(t,e)=>t==="native"&&typeof e=="string"&&!Ywe.has(e),Ywe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),$W=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Xb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Xwe=t=>$W(t)||Xb(t),fI=t=>$W(t?.readable)&&Xb(t?.writable),Qwe=t=>kW(t)&&typeof t[Symbol.asyncIterator]=="function",exe=t=>kW(t)&&typeof t[Symbol.iterator]=="function",kW=t=>typeof t=="object"&&t!==null,In=new Set(["generator","asyncGenerator","duplex","webTransform"]),Qb=new Set(["fileUrl","filePath","fileNumber"]),pI=new Set(["fileUrl","filePath"]),EW=new Set([...pI,"webStream","nodeStream"]),AW=new Set(["webTransform","duplex"]),ms={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var mI,txe,rxe,TW,hI=y(()=>{wr();mI=(t,e,r,n)=>n==="output"?txe(t,e,r):rxe(t,e,r),txe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},rxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},TW=(t,e)=>{let r=t.findLast(({type:n})=>In.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var OW,nxe,ixe,oxe,sxe,axe,cxe,RW=y(()=>{yo();Pa();wr();hI();OW=(t,e,r,n)=>[...t.filter(({type:i})=>!In.has(i)),...nxe(t,e,r,n)],nxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>In.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=ixe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return cxe(o,r)},ixe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?oxe({stdioItem:t,optionName:i}):e==="webTransform"?sxe({stdioItem:t,index:r,newTransforms:n,direction:o}):axe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),oxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},sxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=mI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},axe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||sn.has(o),{writableObjectMode:f,readableObjectMode:p}=mI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},cxe=(t,e)=>e==="input"?t.reverse():t});import gI from"node:process";var IW,lxe,uxe,zl,yI,PW,dxe,fxe,CW=y(()=>{Da();wr();IW=(t,e,r)=>{let n=t.map(i=>lxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??fxe},lxe=({type:t,value:e},r)=>uxe[r]??PW[t](e),uxe=["input","output","output"],zl=()=>{},yI=()=>"input",PW={generator:zl,asyncGenerator:zl,fileUrl:zl,filePath:zl,iterable:yI,asyncIterable:yI,uint8Array:yI,webStream:t=>Xb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?rI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:zl,duplex:zl,native(t){let e=dxe(t);if(e!==void 0)return e;if(ni(t,{checkOpen:!1}))return PW.nodeStream(t)}},dxe=t=>{if([0,gI.stdin].includes(t))return"input";if([1,2,gI.stdout,gI.stderr].includes(t))return"output"},fxe="output"});var DW,NW=y(()=>{DW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var jW,pxe,mxe,MW,hxe,gxe,FW=y(()=>{bo();NW();us();jW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=pxe(t,n).map((a,c)=>MW(a,c));return o?hxe(s,r,i):DW(s,e)},pxe=(t,e)=>{if(t===void 0)return Rn.map(n=>e[n]);if(mxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Rn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Rn.length);return Array.from({length:r},(n,i)=>t[i])},mxe=t=>Rn.some(e=>t[e]!==void 0),MW=(t,e)=>Array.isArray(t)?t.map(r=>MW(r,e)):t??(e>=Rn.length?"ignore":"pipe"),hxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Al(r,i)&&gxe(n)?"ignore":n),gxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as yxe}from"node:fs";import _xe from"node:tty";var zW,bxe,vxe,Sxe,wxe,LW,UW=y(()=>{Da();bo();on();fs();zW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?bxe({stdioItem:t,fdNumber:n,direction:i}):wxe({stdioItem:t,fdNumber:n}),bxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=vxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ni(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},vxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Sxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(_xe.isatty(i))throw new TypeError(`The \`${e}: ${vb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:_o(yxe(i)),optionName:e}}},Sxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=Q_.indexOf(t);if(r!==-1)return r},wxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:LW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:LW(e,e,r),optionName:r}:ni(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,LW=(t,e,r)=>{let n=Q_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var qW,xxe,$xe,kxe,Exe,BW=y(()=>{Da();on();wr();qW=({input:t,inputFile:e},r)=>r===0?[...xxe(t),...kxe(e)]:[],xxe=t=>t===void 0?[]:[{type:$xe(t),value:t,optionName:"input"}],$xe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},kxe=t=>t===void 0?[]:[{...Exe(t),optionName:"inputFile"}],Exe=t=>{if(Yb(t))return{type:"fileUrl",value:t};if(dI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var HW,GW,Axe,Txe,ZW,Oxe,Rxe,VW,WW=y(()=>{wr();HW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),GW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Axe(i,t);if(s.length!==0){if(o){Txe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(EW.has(t))return ZW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});AW.has(t)&&Rxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Axe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Txe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{pI.has(e)&&ZW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},ZW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return VW(s,n,e),i==="output"?o[0].stream:void 0},Oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Rxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);VW(i,n,e)},VW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ms[r]} that is the same.`)}});var ev,Ixe,Pxe,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,_I,qxe,tv=y(()=>{bo();RW();hI();wr();CW();FW();UW();BW();WW();ev=(t,e,r,n)=>{let o=jW(e,r,n).map((a,c)=>Ixe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Lxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>qxe(a)),s},Ixe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=eb(e),{stdioItems:o,isStdioArray:s}=Pxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=IW(o,e,i),c=o.map(d=>zW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=OW(c,i,a,r),u=TW(l,a);return Fxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Pxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Cxe(c,n)),...qW(r,e)],s=HW(o),a=s.length>1;return Dxe(s,a,n),jxe(s),{stdioItems:s,isStdioArray:a}},Cxe=(t,e)=>({type:_W(t,e),value:t,optionName:e}),Dxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Nxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Nxe=new Set(["ignore","ipc"]),jxe=t=>{for(let e of t)Mxe(e)},Mxe=({type:t,value:e,optionName:r})=>{if(wW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(xW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Fxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Qb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Lxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(zxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw _I(i),o}},zxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Uxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Uxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=GW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},_I=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ei(r)&&r.destroy()},qxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as KW}from"node:fs";var YW,ji,Bxe,XW,JW,Hxe,QW=y(()=>{on();tv();wr();YW=(t,e)=>ev(Hxe,t,e,!0),ji=({type:t,optionName:e})=>{XW(e,ms[t])},Bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&XW(t,`"${e}"`),{}),XW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},JW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Bxe},Hxe={input:{...JW,fileUrl:({value:t})=>({contents:[_o(KW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(KW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...JW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:ji,string:ji,uint8Array:ji}}});var xo,bI,cp=y(()=>{tI();xo=(t,{stripFinalNewline:e},r)=>bI(e,r)&&t!==void 0&&!Array.isArray(t)?jl(t):t,bI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var rv,SI,eK,tK,Gxe,Zxe,Vxe,rK,Wxe,vI,Kxe,Jxe,Yxe,nv=y(()=>{rv=(t,e,r,n)=>t||r?void 0:tK(e,n),SI=(t,e,r)=>r?t.flatMap(n=>eK(n,e)):eK(t,e),eK=(t,e)=>{let{transform:r,final:n}=tK(e,{});return[...r(t),...n()]},tK=(t,e)=>(e.previousChunks="",{transform:Gxe.bind(void 0,e,t),final:Vxe.bind(void 0,e)}),Gxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=vI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=vI(n,r.slice(i+1))),t.previousChunks=n},Zxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Vxe=function*({previousChunks:t}){t.length>0&&(yield t)},rK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Wxe.bind(void 0,n)},Wxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Kxe:Yxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},vI=(t,e)=>`${t}${e}`,Kxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:gI},Fxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Lxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Fxe}});import{Buffer as zxe}from"node:buffer";var KW,Uxe,JW,qxe,Bxe,YW,XW=y(()=>{on();KW=(t,e)=>t?void 0:Uxe.bind(void 0,e),Uxe=function*(t,e){if(typeof e!="string"&&!qt(e)&&!zxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},JW=(t,e)=>t?qxe.bind(void 0,e):Bxe.bind(void 0,e),qxe=function*(t,e){YW(t,e),yield e},Bxe=function*(t,e){if(YW(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},YW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:vI},Jxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Yxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Jxe}});import{Buffer as Xxe}from"node:buffer";var nK,Qxe,iK,e0e,t0e,oK,sK=y(()=>{on();nK=(t,e)=>t?void 0:Qxe.bind(void 0,e),Qxe=function*(t,e){if(typeof e!="string"&&!qt(e)&&!Xxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},iK=(t,e)=>t?e0e.bind(void 0,e):t0e.bind(void 0,e),e0e=function*(t,e){oK(t,e),yield e},t0e=function*(t,e){if(oK(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},oK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as Hxe}from"node:buffer";import{StringDecoder as Gxe}from"node:string_decoder";var tv,Zxe,Vxe,Wxe,_I=y(()=>{on();tv=(t,e,r)=>{if(r)return;if(t)return{transform:Zxe.bind(void 0,new TextEncoder)};let n=new Gxe(e);return{transform:Vxe.bind(void 0,n),final:Wxe.bind(void 0,n)}},Zxe=function*(t,e){Hxe.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},Vxe=function*(t,e){yield qt(e)?t.write(e):e},Wxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as QW}from"node:util";var bI,rv,e3,Kxe,t3,Jxe,r3=y(()=>{bI=QW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),rv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Jxe}=e[r];for await(let i of n(t))yield*rv(i,e,r+1)},e3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Kxe(r,Number(e),t)},Kxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*rv(n,r,e+1)},t3=QW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Jxe=function*(t){yield t}});var vI,n3,Ma,sp,Yxe,Xxe,SI=y(()=>{vI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},n3=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...sp(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Xxe}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},sp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Yxe(r,Number(e),t)},Yxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},Xxe=function*(t){yield t}});import{Transform as Qxe,getDefaultHighWaterMark as i3}from"node:stream";var wI,nv,o3,iv=y(()=>{wr();ev();XW();_I();r3();SI();wI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=o3(t,s,o),l=ja(e),u=ja(r),d=l?bI.bind(void 0,rv,a):vI.bind(void 0,Ma),f=l||u?bI.bind(void 0,e3,a):vI.bind(void 0,sp),p=l||u?t3.bind(void 0,a):void 0;return{stream:new Qxe({writableObjectMode:n,writableHighWaterMark:i3(n),readableObjectMode:i,readableHighWaterMark:i3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},nv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=o3(s,r,a);t=n3(c,t)}return t},o3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:KW(n,a)},tv(r,s,n),Qb(r,o,n,c),{transform:t,final:e},{transform:JW(i,a)},WW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var s3,e0e,t0e,r0e,n0e,a3=y(()=>{iv();on();wr();s3=(t,e)=>{for(let r of e0e(t))t0e(t,r,e)},e0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),t0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ps[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>r0e(a,n));r.input=Hf(s)},r0e=(t,e)=>{let r=nv(t,e,"utf8",!0);return n0e(r),Hf(r)},n0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var ov,i0e,o0e,c3,l3,s0e,u3,xI=y(()=>{Pa();wr();El();ls();ov=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&kl(r,n)&&!sn.has(e)&&i0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&o0e.has(o))||t.every(({type:i})=>In.has(i))),i0e=t=>t===1||t===2,o0e=new Set(["pipe","overlapped"]),c3=async(t,e,r,n)=>{for await(let i of t)s0e(e)||u3(i,r,n)},l3=(t,e,r)=>{for(let n of t)u3(n,e,r)},s0e=t=>t._readableState.pipes.length>0,u3=(t,e,r)=>{let n=ib(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as a0e,appendFileSync as c0e}from"node:fs";var d3,l0e,u0e,d0e,f0e,p0e,f3=y(()=>{xI();iv();ev();on();wr();Na();d3=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>l0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},l0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=JV(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=u0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=d0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});f0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&p0e(b,m,i),S}catch(x){return n.error=x,S}},u0e=(t,e,r,n)=>{try{return nv(t,e,r,!1)}catch(i){return n.error=i,t}},d0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Hf(t)};let s=zG(t,r);return n[o]?{serializedResult:s,finalResult:yI(s,!i[o],e)}:{serializedResult:s}},f0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!ov({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=yI(t,!1,s);try{l3(a,e,n)}catch(c){r.error??=c}},p0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Jb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?c0e(n,t):(r.add(o),a0e(n,t))}}});var p3,m3=y(()=>{on();op();p3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xo(e,r,"all")]:Array.isArray(e)?[xo(t,r,"all"),...e]:qt(t)&&qt(e)?fR([t,e]):`${t}${e}`}});import{once as $I}from"node:events";var h3,m0e,g3,y3,h0e,kI,EI=y(()=>{Ra();h3=async(t,e)=>{let[r,n]=await m0e(t);return e.isForcefullyTerminated??=!1,[r,n]},m0e=async t=>{let[e,r]=await Promise.allSettled([$I(t,"spawn"),$I(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?g3(t):r.value},g3=async t=>{try{return await $I(t,"exit")}catch{return g3(t)}},y3=async t=>{let[e,r]=await t;if(!h0e(e,r)&&kI(e,r))throw new ti;return[e,r]},h0e=(t,e)=>t===void 0&&e===void 0,kI=(t,e)=>t!==0||e!==null});var _3,g0e,b3=y(()=>{Ra();Na();EI();_3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=g0e(t,e,r),s=o?.code==="ETIMEDOUT",a=KV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},g0e=(t,e,r)=>t!==void 0?t:kI(e,r)?new ti:void 0});import{spawnSync as y0e}from"node:child_process";var v3,_0e,b0e,v0e,sv,S0e,w0e,x0e,$0e,S3=y(()=>{SR();KR();JR();ip();Vb();GW();op();a3();f3();Na();m3();b3();v3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=_0e(t,e,r),d=S0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ml(d,c,l)},_0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ab(t,e,r),a=b0e(r),{file:c,commandArguments:l,options:u}=Db(t,e,a);v0e(u);let d=BW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},b0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,v0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&sv("ipcInput"),t&&sv("ipc: true"),r&&sv("detached: true"),n&&sv("cancelSignal")},sv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},S0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=w0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=_3(c,r),{output:m,error:h=l}=d3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(p3(m,r),r,"all");return $0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},w0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{s3(o,r);let a=x0e(r);return y0e(...Nb(t,e,a))}catch(a){return jl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},x0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Gb(e)}),$0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Zb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):np({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as AI,on as k0e}from"node:events";var w3,E0e,A0e,T0e,O0e,x3=y(()=>{Il();Xf();Yf();w3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ol({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Ab(t)}),E0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),E0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{vb(e,i);let o=fs(t,e,r),s=new AbortController;try{return await Promise.race([A0e(o,n,s),T0e(o,r,s),O0e(o,r,s)])}catch(a){throw Rl(t),a}finally{s.abort(),Sb(e,i)}},A0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await AI(t,"message",{signal:r});return n}for await(let[n]of k0e(t,"message",{signal:r}))if(e(n))return n},T0e=async(t,e,{signal:r})=>{await AI(t,"disconnect",{signal:r}),D9(e)},O0e=async(t,e,{signal:r})=>{let[n]=await AI(t,"strict:error",{signal:r});throw gb(n,e)}});import{once as k3,on as R0e}from"node:events";var E3,TI,I0e,P0e,C0e,$3,OI=y(()=>{Il();Xf();Yf();E3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>TI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),TI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ol({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Ab(t)}),vb(e,o);let s=fs(t,e,r),a=new AbortController,c={};return I0e(t,s,a),P0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),C0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},I0e=async(t,e,r)=>{try{await k3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},P0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await k3(t,"strict:error",{signal:r.signal});n.error=gb(i,e),r.abort()}catch{}},C0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of R0e(r,"message",{signal:o.signal}))$3(s),yield c}catch{$3(s)}finally{o.abort(),Sb(e,a),n||Rl(t),i&&await t}},$3=({error:t})=>{if(t)throw t}});import A3 from"node:process";var T3,O3,R3,RI=y(()=>{Pb();x3();OI();kb();T3=(t,{ipc:e})=>{Object.assign(t,R3(t,!1,e))},O3=()=>{let t=A3,e=!0,r=A3.channel!==void 0;return{...R3(t,e,r),getCancelSignal:cV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},R3=(t,e,r)=>({sendMessage:Ib.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:w3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:E3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as D0e}from"node:child_process";import{PassThrough as N0e,Readable as j0e,Writable as M0e,Duplex as F0e}from"node:stream";var I3,L0e,ap,z0e,U0e,q0e,B0e,P3=y(()=>{Xb();ip();Vb();I3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{mI(n);let a=new D0e;L0e(a,n),Object.assign(a,{readable:z0e,writable:U0e,duplex:q0e});let c=jl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=B0e(c,s,i);return{subprocess:a,promise:l}},L0e=(t,e)=>{let r=ap(),n=ap(),i=ap(),o=Array.from({length:e.length-3},ap),s=ap(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},ap=()=>{let t=new N0e;return t.end(),t},z0e=()=>new j0e({read(){}}),U0e=()=>new M0e({write(){}}),q0e=()=>new F0e({read(){},write(){}}),B0e=async(t,e,r)=>Ml(t,e,r)});import{createReadStream as C3,createWriteStream as D3}from"node:fs";import{Buffer as H0e}from"node:buffer";import{Readable as cp,Writable as G0e,Duplex as Z0e}from"node:stream";var j3,lp,N3,V0e,M3=y(()=>{iv();Xb();wr();j3=(t,e)=>Yb(V0e,t,e,!1),lp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ps[t]}.`)},N3={fileNumber:lp,generator:wI,asyncGenerator:wI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Z0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},V0e={input:{...N3,fileUrl:({value:t})=>({stream:C3(t)}),filePath:({value:{file:t}})=>({stream:C3(t)}),webStream:({value:t})=>({stream:cp.fromWeb(t)}),iterable:({value:t})=>({stream:cp.from(t)}),asyncIterable:({value:t})=>({stream:cp.from(t)}),string:({value:t})=>({stream:cp.from(t)}),uint8Array:({value:t})=>({stream:cp.from(H0e.from(t))})},output:{...N3,fileUrl:({value:t})=>({stream:D3(t)}),filePath:({value:{file:t,append:e}})=>({stream:D3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:G0e.fromWeb(t)}),iterable:lp,asyncIterable:lp,string:lp,uint8Array:lp}}});import{on as W0e,once as F3}from"node:events";import{PassThrough as K0e,getDefaultHighWaterMark as J0e}from"node:stream";import{finished as U3}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)PI(i);let e=t.some(({readableObjectMode:i})=>i),r=Y0e(t,e),n=new II({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Y0e,II,X0e,Q0e,e$e,PI,t$e,r$e,n$e,i$e,o$e,q3,B3,CI,H3,s$e,av,L3,z3,cv=y(()=>{Y0e=(t,e)=>{if(t.length===0)return J0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},II=class extends K0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(PI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=X0e(this,this.#t,this.#o);let r=t$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(PI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},X0e=async(t,e,r)=>{av(t,L3);let n=new AbortController;try{await Promise.race([Q0e(t,n),e$e(t,e,r,n)])}finally{n.abort(),av(t,-L3)}},Q0e=async(t,{signal:e})=>{try{await U3(t,{signal:e,cleanup:!0})}catch(r){throw q3(t,r),r}},e$e=async(t,e,r,{signal:n})=>{for await(let[i]of W0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},PI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},t$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{av(t,z3);let a=new AbortController;try{await Promise.race([r$e(o,e,a),n$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),i$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),av(t,-z3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?CI(t):o$e(t))},r$e=async(t,e,{signal:r})=>{try{await t,r.aborted||CI(e)}catch(n){r.aborted||q3(e,n)}},n$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await U3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;B3(s)?i.add(e):H3(t,s)}},i$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await F3(t,i,{signal:o}),!t.readable)return F3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},o$e=t=>{t.writable&&t.end()},q3=(t,e)=>{B3(e)?CI(t):H3(t,e)},B3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",CI=t=>{(t.readable||t.writable)&&t.destroy()},H3=(t,e)=>{t.destroyed||(t.once("error",s$e),t.destroy(e))},s$e=()=>{},av=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},L3=2,z3=1});import{finished as G3}from"node:stream/promises";var Ll,a$e,DI,c$e,NI,lv=y(()=>{bo();Ll=(t,e)=>{t.pipe(e),a$e(t,e),c$e(t,e)},a$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await G3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}DI(e)}},DI=t=>{t.writable&&t.end()},c$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await G3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}NI(t)}},NI=t=>{t.readable&&t.destroy()}});var Z3,l$e,u$e,d$e,f$e,p$e,V3=y(()=>{cv();bo();bb();wr();lv();Z3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>In.has(c)))l$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!In.has(c)))d$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fa(o);Ll(s,i)}},l$e=(t,e,r,n)=>{r==="output"?Ll(t.stdio[n],e):Ll(e,t.stdio[n]);let i=u$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},u$e=["stdin","stdout","stderr"],d$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;f$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},f$e=(t,{signal:e})=>{ei(t)&&Ia(t,p$e,e)},p$e=2});var La,W3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var uv,jI,MI,m$e,FI,dv,h$e,LI,zI,UI,K3,oat,sat,J3=y(()=>{W3();uv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",jI=Symbol.for("signal-exit emitter"),MI=globalThis,m$e=Object.defineProperty.bind(Object),FI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(MI[jI])return MI[jI];m$e(MI,jI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},dv=class{},h$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),LI=class extends dv{onExit(){return()=>{}}load(){}unload(){}},zI=class extends dv{#t=UI.platform==="win32"?"SIGINT":"SIGHUP";#r=new FI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!uv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of La)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,La.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return uv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&uv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},UI=globalThis.process,{onExit:K3,load:oat,unload:sat}=h$e(uv(UI)?new zI(UI):new LI)});import{addAbortListener as g$e}from"node:events";var Y3,X3=y(()=>{J3();Y3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=K3(()=>{t.kill()});g$e(n,()=>{i()})}});var eK,y$e,_$e,Q3,b$e,tK=y(()=>{dR();sb();ds();xl();eK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=ob(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=y$e(r,n,i),{sourceStream:d,sourceError:f}=b$e(t,l),{options:p,fileDescriptors:m}=Di.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},y$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=_$e(t,e,...r),a=_b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},_$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Q3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||lR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=W_(r,...n);return{destination:e(Q3)(i,o,s),pipeOptions:s}}if(Di.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Q3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),b$e=(t,e)=>{try{return{sourceStream:Cl(t,e)}}catch(r){return{sourceError:r}}}});var nK,v$e,qI,rK,BI=y(()=>{ip();lv();nK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=v$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw qI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},v$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return NI(t),n;if(e!==void 0)return DI(r),e},qI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>jl({error:t,command:rK,escapedCommand:rK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),rK="source.pipe(destination)"});var iK,oK=y(()=>{iK=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as S$e}from"node:stream/promises";var sK,w$e,x$e,$$e,fv,k$e,E$e,aK=y(()=>{cv();bb();lv();sK=(t,e,r)=>{let n=fv.has(e)?x$e(t,e):w$e(t,e);return Ia(t,k$e,r.signal),Ia(e,E$e,r.signal),$$e(e),n},w$e=(t,e)=>{let r=Fa([t]);return Ll(r,e),fv.set(e,r),r},x$e=(t,e)=>{let r=fv.get(e);return r.add(t),r},$$e=async t=>{try{await S$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}fv.delete(t)},fv=new WeakMap,k$e=2,E$e=1});import{aborted as A$e}from"node:util";var cK,T$e,lK=y(()=>{BI();cK=(t,e)=>t===void 0?[]:[T$e(t,e)],T$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await A$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw qI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var pv,O$e,R$e,uK=y(()=>{yo();tK();BI();oK();aK();lK();pv=(t,...e)=>{if(Ot(e[0]))return pv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=eK(t,...e),i=O$e({...n,destination:r});return i.pipe=pv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},O$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=R$e(t,i);nK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=sK(e,o,d);return await Promise.race([iK(u),...cK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},R$e=(t,e)=>Promise.allSettled([t,e])});import{on as I$e}from"node:events";import{getDefaultHighWaterMark as P$e}from"node:stream";var mv,C$e,HI,D$e,fK,GI,dK,N$e,j$e,hv=y(()=>{_I();ev();SI();mv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return C$e(e,s),fK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},C$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},HI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;D$e(e,s,t);let a=t.readableObjectMode&&!o;return fK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},D$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},fK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=I$e(t,"data",{signal:e.signal,highWaterMark:dK,highWatermark:dK});return N$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},GI=P$e(!0),dK=GI,N$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=j$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*sp(a)}},j$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[tv(t,r,!e),Qb(t,i,!n,{})].filter(Boolean)});import{setImmediate as M$e}from"node:timers/promises";var pK,F$e,L$e,z$e,ZI,mK,VI=y(()=>{Hb();on();xI();hv();Na();op();pK=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=F$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([L$e(t),d]);return}let f=hI(c,r),p=HI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([z$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},F$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!ov({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=HI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await c3(a,t,r,o)},L$e=async t=>{await M$e(),t.readableFlowing===null&&t.resume()},z$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Ub(r,{maxBuffer:o})):await Bb(r,{maxBuffer:o})}catch(a){return mK(ZV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},ZI=async t=>{try{return await t}catch(e){return mK(e)}},mK=({bufferedData:t})=>FG(t)?new Uint8Array(t):t});import{finished as U$e}from"node:stream/promises";var up,q$e,B$e,H$e,G$e,Z$e,WI,gv,hK,yv=y(()=>{up=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=q$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],U$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||G$e(a,e,r,n)}finally{s.abort()}},q$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&B$e(t,r,n),n},B$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{H$e(e,r),n.call(t,...i)}},H$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},G$e=(t,e,r,n)=>{if(!Z$e(t,e,r,n))throw t},Z$e=(t,e,r,n=!0)=>r.propagating?hK(t)||gv(t):(r.propagating=!0,WI(r,e)===n?hK(t):gv(t)),WI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",gv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",hK=t=>t?.code==="EPIPE"});var gK,KI,JI=y(()=>{VI();yv();gK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>KI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),KI=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=up(t,e,l);if(WI(l,e)){await u;return}let[d]=await Promise.all([pK({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var yK,_K,V$e,W$e,YI=y(()=>{cv();JI();yK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,_K=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>KI({...V$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:W$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),V$e=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},W$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var bK,vK,SK=y(()=>{El();ls();bK=t=>kl(t,"ipc"),vK=(t,e)=>{let r=ib(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var wK,xK,$K=y(()=>{Na();SK();So();OI();wK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=bK(o),a=vo(e,"ipc"),c=vo(r,"ipc");for await(let l of TI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(VV(t,i,c),i.push(l)),s&&vK(l,o);return i},xK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as K$e}from"node:events";var kK,J$e,Y$e,X$e,EK=y(()=>{Da();HR();NR();BR();bo();wr();VI();$K();ZR();YI();JI();EI();yv();kK=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=h3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=gK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=_K({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=wK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=J$e(h,t,S),D=Y$e(m,S);try{return await Promise.race([Promise.all([{},y3(_),Promise.all(x),w,T,_V(t,d),...A,...D]),g,X$e(t,b),...pV(t,o,f,b),...C9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...dV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>ZI(re))),ZI(w),xK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},J$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:up(n,i,r)),Y$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ni(o,{checkOpen:!1})&&!ei(o)).map(({type:i,value:o,stream:s=o})=>up(s,n,e,{isSameDirection:In.has(i),stopOnExit:i==="native"}))),X$e=async(t,{signal:e})=>{let[r]=await K$e(t,"error",{signal:e});throw r}});var AK,dp,zl,_v=y(()=>{Pl();AK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),dp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},zl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as TK}from"node:stream/promises";var XI,OK,QI,eP,bv,vv,tP=y(()=>{yv();XI=async t=>{if(t!==void 0)try{await QI(t)}catch{}},OK=async t=>{if(t!==void 0)try{await eP(t)}catch{}},QI=async t=>{await TK(t,{cleanup:!0,readable:!1,writable:!0})},eP=async t=>{await TK(t,{cleanup:!0,readable:!0,writable:!1})},bv=async(t,e)=>{if(await t,e)throw e},vv=(t,e,r)=>{r&&!gv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as Q$e}from"node:stream";import{callbackify as eke}from"node:util";var RK,rP,nP,iP,tke,oP,sP,IK,aP=y(()=>{Pa();ds();hv();Pl();_v();tP();RK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||sn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=rP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=nP(a,s),{read:f,onStdoutDataDone:p}=iP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Q$e({read:f,destroy:eke(sP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return oP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},rP=(t,e,r)=>{let n=Cl(t,e),i=dp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},nP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:GI},iP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ci(),s=mv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){tke(this,s,o)},onStdoutDataDone:o}},tke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},oP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await eP(t),await n,await XI(i),await e,r.readable&&r.push(null)}catch(o){await XI(i),IK(r,o)}},sP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await zl(r,e)&&(IK(t,n),await bv(e,n))},IK=(t,e)=>{vv(t,t.readable,e)}});import{Writable as rke}from"node:stream";import{callbackify as PK}from"node:util";var CK,cP,lP,nke,ike,uP,dP,DK,fP=y(()=>{ds();_v();tP();CK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=cP(t,r,e),s=new rke({...lP(n,t,i),destroy:PK(dP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return uP(n,s),s},cP=(t,e,r)=>{let n=_b(t,e),i=dp(r,n,"writableFinal"),o=dp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},lP=(t,e,r)=>({write:nke.bind(void 0,t),final:PK(ike.bind(void 0,t,e,r))}),nke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},ike=async(t,e,r)=>{await zl(r,e)&&(t.writable&&t.end(),await e)},uP=async(t,e,r)=>{try{await QI(t),e.writable&&e.end()}catch(n){await OK(r),DK(e,n)}},dP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await zl(r,e),await zl(n,e)&&(DK(t,i),await bv(e,i))},DK=(t,e)=>{vv(t,t.writable,e)}});import{Duplex as oke}from"node:stream";import{callbackify as ske}from"node:util";var NK,ake,jK=y(()=>{Pa();aP();fP();NK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||sn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=rP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=cP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=nP(c,a),{read:g,onStdoutDataDone:b}=iP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new oke({read:g,...lP(u,t,d),destroy:ske(ake.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return oP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),uP(u,_,c),_},ake=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([sP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),dP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var pP,cke,MK=y(()=>{Pa();ds();hv();pP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||sn.has(e),s=Cl(t,r),a=mv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return cke(a,s,t)},cke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var FK,LK=y(()=>{_v();aP();fP();jK();MK();FK=(t,{encoding:e})=>{let r=AK();t.readable=RK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=CK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=NK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=pP.bind(void 0,t,e),t[Symbol.asyncIterator]=pP.bind(void 0,t,e,{})}});var zK,lke,uke,UK=y(()=>{zK=(t,e)=>{for(let[r,n]of uke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},lke=(async()=>{})().constructor.prototype,uke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(lke,t)])});import{setMaxListeners as dke}from"node:events";import{spawn as fke}from"node:child_process";var qK,pke,mke,hke,gke,yke,BK=y(()=>{Hb();SR();KR();ds();JR();RI();ip();Vb();P3();M3();op();V3();mb();X3();uK();YI();EK();LK();Pl();UK();qK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=pke(t,e,r),{subprocess:f,promise:p}=hke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=pv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),zK(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},pke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ab(t,e,r),{file:a,commandArguments:c,options:l}=Db(t,e,r),u=mke(l),d=j3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},mke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},hke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=fke(...Nb(t,e,r))}catch(m){return I3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;dke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Z3(c,a,l),Y3(c,r,l);let d={},f=Ci();c.kill=I9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=yK(c,r),FK(c,r),T3(c,r);let p=gke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},gke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await kK({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>xo(x,e,w)),_=xo(h,e,"all"),S=yke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ml(S,n,e)},yke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?np({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ni,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Zb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Sv,_ke,bke,HK=y(()=>{yo();So();Sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,_ke(n,t[n],i)]));return{...t,...r}},_ke=(t,e,r)=>bke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,bke=new Set(["env",...gR])});var ms,vke,Ske,GK=y(()=>{yo();dR();ZG();S3();BK();HK();ms=(t,e,r,n)=>{let i=(s,a,c)=>ms(s,a,r,c),o=(...s)=>vke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},vke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Sv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Ske({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?v3(a,c,l):qK(a,c,l,i)},Ske=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=HG(e)?GG(e,r):[e,...r],[s,a,c]=W_(...o),l=Sv(Sv(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var ZK,VK,WK,wke,xke,KK=y(()=>{ZK=({file:t,commandArguments:e})=>WK(t,e),VK=({file:t,commandArguments:e})=>({...WK(t,e),isSync:!0}),WK=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=wke(t);return{file:r,commandArguments:n}},wke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(xke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},xke=/ +/g});var JK,YK,$ke,XK,kke,QK,eJ=y(()=>{JK=(t,e,r)=>{t.sync=e($ke,r),t.s=t.sync},YK=({options:t})=>XK(t),$ke=({options:t})=>({...XK(t),isSync:!0}),XK=t=>({options:{...kke(t),...t}}),kke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},QK={preferLocal:!0}});var Klt,We,Jlt,Ylt,Xlt,Qlt,eut,tut,rut,nut,Fr=y(()=>{GK();KK();GR();eJ();RI();Klt=ms(()=>({})),We=ms(()=>({isSync:!0})),Jlt=ms(ZK),Ylt=ms(VK),Xlt=ms(hV),Qlt=ms(YK,{},QK,JK),{sendMessage:eut,getOneMessage:tut,getEachMessage:rut,getCancelSignal:nut}=O3()});import{existsSync as wv,statSync as Eke}from"node:fs";import{dirname as mP,extname as Ake,isAbsolute as tJ,join as hP,relative as gP,resolve as xv,sep as Tke}from"node:path";function $v(t){return t==="./gradlew"||t==="gradle"}function Oke(t){return(wv(hP(t,"build.gradle.kts"))||wv(hP(t,"build.gradle")))&&wv(hP(t,"gradle.properties"))}function Rke(t,e){let n=gP(t,e).split(Tke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function hs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Ike(t,e){let r=xv(t,e),n=r;wv(r)?Eke(r).isFile()&&(n=mP(r)):Ake(r)!==""&&(n=mP(r));let i=gP(t,n);if(i.startsWith("..")||tJ(i))return null;let o=n;for(;;){if(Oke(o))return o;if(xv(o)===xv(t))return null;let s=mP(o);if(s===o)return null;let a=gP(t,s);if(a.startsWith("..")||tJ(a))return null;o=s}}function kv(t,e){let r=xv(t),n=new Map,i=[];for(let o of e){let s=Ike(r,o);if(!s){i.push(o);continue}let a=Rke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Ev=y(()=>{"use strict"});import{existsSync as _P,readFileSync as Pke}from"node:fs";import{join as Ul}from"node:path";function ql(t="."){let e=Ul(t,".cladding","config.yaml");if(!_P(e))return yP;try{let n=(0,rJ.parse)(Pke(e,"utf8"))?.gate;if(!n)return yP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Cke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return yP}}function nJ(t="."){let e=ql(t).testReport,r=e?[e,...bP]:bP;return[...new Set(r.map(n=>Ul(t,n)))]}function iJ(t="."){let e=ql(t).testReport;if(e){let r=Ul(t,e);return _P(r)?r:null}return bP.map(r=>Ul(t,r)).find(r=>_P(r))??null}function oJ(t,e){let r=[],n=!1;for(let i of t){let o=Dke.exec(i);if(o){n=!0;for(let s of e)r.push(hs(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var rJ,Cke,yP,bP,Dke,fp=y(()=>{"use strict";rJ=St(er(),1);Ev();Cke=["type","lint","test","coverage"],yP={scope:"feature"},bP=["test-report.junit.xml",Ul("coverage","junit.xml"),Ul(".cladding","test-report.junit.xml")];Dke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as SP,readFileSync as sJ,readdirSync as Nke,statSync as jke}from"node:fs";import{join as Av}from"node:path";function $P(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Av(t,e);if(SP(r))try{if(aJ.test(sJ(r,"utf8")))return!0}catch{}}return!1}function cJ(t){try{return SP(t)&&aJ.test(sJ(t,"utf8"))}catch{return!1}}function lJ(t,e=0){if(e>4||!SP(t))return!1;let r;try{r=Nke(t)}catch{return!1}for(let n of r){let i=Av(t,n),o=!1;try{o=jke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(lJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&cJ(i))return!0}return!1}function Lke(t){if($P(t))return!0;for(let e of Mke)if(cJ(Av(t,e)))return!0;for(let e of Fke)if(lJ(Av(t,e)))return!0;return!1}function uJ(t="."){let e=ql(t).coverage;return e||(Lke(t)?"kover":"jacoco")}function dJ(t="."){return wP[uJ(t)]}function fJ(t="."){return vP[uJ(t)]}var wP,vP,xP,aJ,Mke,Fke,Tv=y(()=>{"use strict";fp();wP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},vP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},xP=[vP.kover,vP.jacoco],aJ=/kover/i;Mke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Fke=["buildSrc","build-logic"]});import{existsSync as mp,readFileSync as mJ,readdirSync as hJ}from"node:fs";import{join as gs}from"node:path";function EP(t){return mp(gs(t,"gradlew"))?"./gradlew":"gradle"}function zke(t){let e=EP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[dJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Uke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(mJ(gs(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function Bke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Zke(t,e){for(let r of e)if(mp(gs(t,r)))return r}function Vke(t,e){try{return hJ(t).find(n=>n.endsWith(e))}catch{return}}function Jke(t){try{return JSON.parse(mJ(gs(t,"package.json"),"utf8"))}catch{return{}}}function pp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function pJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Yke(t,e,r){if(pp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Wke)if(n.configs.some(i=>mp(gs(t,i))))return n.gate;if(Kke.some(n=>mp(gs(t,n)))||r.eslintConfig!==void 0)return e}function Qke(t,e){return Xke.some(r=>mp(gs(t,r)))?!0:e.jest!==void 0}function eEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function kP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function tEe(t,e){let r=Jke(t),n=e.lint?Yke(t,e.lint,r):void 0,i=n?{...e,lint:n}:kP(e,"lint"),o=pp(r,"test"),s=o?eEe(o):void 0;return o&&!s?(i=kP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...pp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Qke(t,r)?{...i,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(s==="vitest"&&!pp(r,"coverage")&&!pJ(r,"@vitest/coverage-v8")&&!pJ(r,"@vitest/coverage-istanbul")?i=kP(i,"coverage"):s==="vitest"&&pp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Hke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Vke(t,o):r=Zke(t,[o]),r)break;if(!r||e.requiresSource&&!Bke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?tEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return Gke}var Mi,qke,Hke,Gke,Wke,Kke,Xke,an=y(()=>{"use strict";Tv();Mi=["--offline","--no-install"];qke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Hke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Mi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Mi,"eslint","."]},test:{cmd:"npx",args:[...Mi,"vitest","run"]},coverage:{cmd:"npx",args:[...Mi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Mi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Mi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:zke},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Uke}],Gke={language:"unknown",manifest:"",gates:{}};Wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Mi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Mi,"oxlint"]}}],Kke=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"];Xke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as rEe,readFileSync as nEe}from"node:fs";import{join as iEe}from"node:path";function za(t){return t.code==="ENOENT"}function Ov(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return gJ.test(o)||gJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} -${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Bl(t,e){let r=iEe(t,"package.json");if(!rEe(r))return!1;try{return!!JSON.parse(nEe(r,"utf8")).scripts?.[e]}catch{return!1}}var gJ,Pn=y(()=>{"use strict";gJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function oEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Rv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Rv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Ov(i,Rv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Rv,Ua,Iv=y(()=>{"use strict";Fr();an();Pn();Rv="ARCHITECTURE_VIOLATION";Ua={name:Rv,subprocess:!0,run:oEe}});function sEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Pv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Pv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Ov(i,Pv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Pv,qa,Cv=y(()=>{"use strict";Fr();an();Pn();Pv="HARDCODED_SECRET";qa={name:Pv,subprocess:!0,run:sEe}});import{existsSync as AP,readdirSync as yJ}from"node:fs";import{join as Dv}from"node:path";function cEe(t,e){let r=Dv(t,e.path);if(!AP(r))return!0;if(e.isDirectory)try{return yJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function lEe(t){let{cwd:e="."}=t,r=[];for(let i of aEe)cEe(e,i)&&r.push({detector:hp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Dv(e,"spec.yaml");if(AP(n)){let i=fEe(n),o=i?null:uEe(e);if(i)r.push({detector:hp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:hp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=dEe(e);s&&r.push({detector:hp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function uEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Dv(t,e);if(!AP(r))continue;let n;try{n=yJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Oi(Dv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function dEe(t){try{return q(t),null}catch(e){return e.message}}function fEe(t){let e;try{e=Oi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var hp,aEe,_J,bJ=y(()=>{"use strict";Ue();F_();hp="ABSENCE_OF_GOVERNANCE",aEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];_J={name:hp,run:lEe}});function Nv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function TP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Nv(r)==="while",o=mEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Nv(r)}'`}let n=pEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Nv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Nv(r)}'`:null}function hEe(t,e){let r=TP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function vJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...hEe(r,n));return e}var pEe,mEe,OP=y(()=>{"use strict";pEe={event:"when",state:"while",optional:"where",unwanted:"if"},mEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function gEe(t){let{cwd:e="."}=t;return ge(e,jv,yEe)}function yEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:jv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of vJ(t.features))e.push({detector:jv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var jv,SJ,wJ=y(()=>{"use strict";OP();wt();jv="AC_DRIFT";SJ={name:jv,run:gEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return $J[n]??xJ}var _Ee,bEe,vEe,xJ,SEe,wEe,$J,xEe,kJ,Ba=y(()=>{"use strict";an();_Ee=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,bEe=/^[ \t]*import\s+([\w.]+)/gm,vEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,xJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:_Ee,importStyle:"relative"},SEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:bEe,importStyle:"dotted"},wEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:vEe,importStyle:"dotted"},$J={typescript:xJ,kotlin:SEe,python:wEe},xEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],kJ=new Set([...Object.values($J).flatMap(t=>t?.extensions??[]),...xEe].map(t=>t.toLowerCase()))});import{existsSync as $Ee,readFileSync as kEe,readdirSync as EEe,statSync as AEe}from"node:fs";import{join as AJ,relative as EJ}from"node:path";function TEe(t,e){if(!$Ee(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=EEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=AJ(i,s),c;try{c=AEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function OEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function IEe(t){return REe.test(t)}function PEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>TEe(AJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=kEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Ba();TJ="AI_HINTS_FORBIDDEN_PATTERN";REe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;OJ={name:TJ,run:PEe}});function CEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:IJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var IJ,PJ,CJ=y(()=>{"use strict";Ue();IJ="AC_DUPLICATE_WITHIN_FEATURE";PJ={name:IJ,run:CEe}});import{createRequire as DEe}from"module";import{basename as NEe,dirname as IP,normalize as jEe,relative as MEe,resolve as FEe,sep as jJ}from"path";import*as LEe from"fs";function zEe(t){let e=jEe(t);return e.length>1&&e[e.length-1]===jJ&&(e=e.substring(0,e.length-1)),e}function MJ(t,e){return t.replace(UEe,e)}function BEe(t){return t==="/"||qEe.test(t)}function RP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=FEe(t)),(n||o)&&(t=zEe(t)),t===".")return"";let s=t[t.length-1]!==i;return MJ(s?t+i:t,i)}function FJ(t,e){return e+t}function HEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:MJ(MEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function GEe(t){return t}function ZEe(t,e,r){return e+t+r}function VEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?HEe(t,e):n?FJ:GEe}function WEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function KEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function QEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?KEe(t):WEe(t):n&&n.length?YEe:JEe:XEe}function oAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?iAe:r&&r.length?n?eAe:tAe:n?rAe:nAe}function cAe(t){return t.group?aAe:sAe}function dAe(t){return t.group?lAe:uAe}function mAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?pAe:fAe}function LJ(t,e,r){if(r.options.useRealPaths)return hAe(e,r);let n=IP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=IP(n)}return r.symlinks.set(t,e),i>1}function hAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Mv(t,e,r,n){e(t&&!n?t:null,r)}function $Ae(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?gAe:vAe:n?e?yAe:xAe:i?e?bAe:wAe:e?_Ae:SAe}function AAe(t){return t?EAe:kAe}function IAe(t,e){return new Promise((r,n)=>{qJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function qJ(t,e,r){new UJ(t,e,r).start()}function PAe(t,e){return new UJ(t,e).start()}var DJ,UEe,qEe,JEe,YEe,XEe,eAe,tAe,rAe,nAe,iAe,sAe,aAe,lAe,uAe,fAe,pAe,gAe,yAe,_Ae,bAe,vAe,SAe,wAe,xAe,zJ,kAe,EAe,TAe,OAe,RAe,UJ,NJ,BJ,HJ,GJ=y(()=>{DJ=DEe(import.meta.url);UEe=/[\\/]/g;qEe=/^[a-z]:[\\/]$/i;JEe=(t,e)=>{e.push(t||".")},YEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},XEe=()=>{};eAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},tAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},rAe=(t,e,r,n)=>{r.files++},nAe=(t,e)=>{e.push(t)},iAe=()=>{};sAe=t=>t,aAe=()=>[""].slice(0,0);lAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},uAe=()=>{};fAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&LJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},pAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&LJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};gAe=t=>t.counts,yAe=t=>t.groups,_Ae=t=>t.paths,bAe=t=>t.paths.slice(0,t.options.maxFiles),vAe=(t,e,r)=>(Mv(e,r,t.counts,t.options.suppressErrors),null),SAe=(t,e,r)=>(Mv(e,r,t.paths,t.options.suppressErrors),null),wAe=(t,e,r)=>(Mv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),xAe=(t,e,r)=>(Mv(e,r,t.groups,t.options.suppressErrors),null);zJ={withFileTypes:!0},kAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",zJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},EAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",zJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};TAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},OAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},RAe=class{aborted=!1;abort(){this.aborted=!0}},UJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=$Ae(e,this.isSynchronous),this.root=RP(t,e),this.state={root:BEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new OAe,options:e,queue:new TAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new RAe,fs:e.fs||LEe},this.joinPath=VEe(this.root,e),this.pushDirectory=QEe(this.root,e),this.pushFile=oAe(e),this.getArray=cAe(e),this.groupFiles=dAe(e),this.resolveSymlink=mAe(e,this.isSynchronous),this.walkDirectory=AAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=RP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=NEe(_),x=RP(IP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};NJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return IAe(this.root,this.options)}withCallback(t){qJ(this.root,this.options,t)}sync(){return PAe(this.root,this.options)}},BJ=null;try{DJ.resolve("picomatch"),BJ=DJ("picomatch")}catch{}HJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:jJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new NJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new NJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||BJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var gp=v((sdt,JJ)=>{"use strict";var ZJ="[^\\\\/]",CAe="(?=.)",VJ="[^/]",PP="(?:\\/|$)",WJ="(?:^|\\/)",CP=`\\.{1,2}${PP}`,DAe="(?!\\.)",NAe=`(?!${WJ}${CP})`,jAe=`(?!\\.{0,1}${PP})`,MAe=`(?!${CP})`,FAe="[^.\\/]",LAe=`${VJ}*?`,zAe="/",KJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:CAe,QMARK:VJ,END_ANCHOR:PP,DOTS_SLASH:CP,NO_DOT:DAe,NO_DOTS:NAe,NO_DOT_SLASH:jAe,NO_DOTS_SLASH:MAe,QMARK_NO_DOT:FAe,STAR:LAe,START_ANCHOR:WJ,SEP:zAe},UAe={...KJ,SLASH_LITERAL:"[\\\\/]",QMARK:ZJ,STAR:`${ZJ}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},qAe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};JJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:qAe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?UAe:KJ}}});var yp=v(Lr=>{"use strict";var{REGEX_BACKSLASH:BAe,REGEX_REMOVE_BACKSLASH:HAe,REGEX_SPECIAL_CHARS:GAe,REGEX_SPECIAL_CHARS_GLOBAL:ZAe}=gp();Lr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Lr.hasRegexChars=t=>GAe.test(t);Lr.isRegexChar=t=>t.length===1&&Lr.hasRegexChars(t);Lr.escapeRegex=t=>t.replace(ZAe,"\\$1");Lr.toPosixSlashes=t=>t.replace(BAe,"/");Lr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Lr.removeBackslashes=t=>t.replace(HAe,e=>e==="\\"?"":e);Lr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Lr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Lr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Lr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Lr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var i8=v((cdt,n8)=>{"use strict";var YJ=yp(),{CHAR_ASTERISK:DP,CHAR_AT:VAe,CHAR_BACKWARD_SLASH:_p,CHAR_COMMA:WAe,CHAR_DOT:NP,CHAR_EXCLAMATION_MARK:jP,CHAR_FORWARD_SLASH:r8,CHAR_LEFT_CURLY_BRACE:MP,CHAR_LEFT_PARENTHESES:FP,CHAR_LEFT_SQUARE_BRACKET:KAe,CHAR_PLUS:JAe,CHAR_QUESTION_MARK:XJ,CHAR_RIGHT_CURLY_BRACE:YAe,CHAR_RIGHT_PARENTHESES:QJ,CHAR_RIGHT_SQUARE_BRACKET:XAe}=gp(),e8=t=>t===r8||t===_p,t8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},QAe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&e8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=YJ.removeBackslashes(P)),xe&&_===!0&&(xe=YJ.removeBackslashes(xe)));let Pr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,e8(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var bp=gp(),cn=yp(),{MAX_LENGTH:Fv,POSIX_REGEX_SOURCE:eTe,REGEX_NON_SPECIAL_CHARS:tTe,REGEX_SPECIAL_CHARS_BACKREF:rTe,REPLACEMENTS:o8}=bp,nTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>cn.escapeRegex(i)).join("..")}return r},Hl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,s8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},iTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},a8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(iTe(e))return e.replace(/\\(.)/g,"$1")},oTe=t=>{let e=t.map(a8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},sTe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=a8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?cn.escapeRegex(r[0]):`[${r.map(i=>cn.escapeRegex(i)).join("")}]`}*`},aTe=t=>{let e=0,r=t.trim(),n=LP(r);for(;n;)e++,r=n.body.trim(),n=LP(r);return e},cTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:bp.DEFAULT_MAX_EXTGLOB_RECURSION,n=s8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||oTe(n)))return{risky:!0};for(let i of n){let o=sTe(i);if(o)return{risky:!0,safeOutput:o};if(aTe(i)>r)return{risky:!0}}return{risky:!1}},zP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=o8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Fv,r.maxLength):Fv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=bp.globChars(r.windows),l=bp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=cn.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Pr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},lo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},$i=H=>{$[H]++,xe.push(H)},Qr=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},uo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;$i("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},zde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=cTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,ki=s[H.tokensIndex];ki.type="text",ki.value=ht,ki.output=lt||cn.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let ki=zP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${ki})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Qr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(rTe,(B,Oe,ut,zt,lt,ki)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):ki===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=cn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=eTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=cn.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){$i("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Hl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){zde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Qr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Hl("closing","]"));P=`\\${P}`}else $i("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Hl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Qr("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||cn.hasRegexChars(B))continue;let Oe=cn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){$i("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=nTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Qr("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){uo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){lo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=tTe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){uo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),ki=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!ki){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ei=t[$.index+4];if(Ei&&Ei!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Pr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Pr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ei=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ei})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing","]"));$.output=cn.escapeLast($.output,"["),Qr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing",")"));$.output=cn.escapeLast($.output,"("),Qr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Hl("closing","}"));$.output=cn.escapeLast($.output,"{"),Qr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};zP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Fv,r.maxLength):Fv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=o8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=bp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=cn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};c8.exports=zP});var f8=v((udt,d8)=>{"use strict";var lTe=i8(),UP=l8(),u8=yp(),uTe=gp(),dTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=dTe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?u8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(u8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):UP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>lTe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=UP.fastpaths(t,e)),i.output||(i=UP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=uTe;d8.exports=Rt});var g8=v((ddt,h8)=>{"use strict";var p8=f8(),fTe=yp();function m8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:fTe.isWindows()}),p8(t,e,r)}Object.assign(m8,p8);h8.exports=m8});import{readdir as pTe,readdirSync as mTe,realpath as hTe,realpathSync as gTe,stat as yTe,statSync as _Te}from"fs";import{isAbsolute as bTe,posix as Ha,resolve as vTe}from"path";import{fileURLToPath as STe}from"url";function $Te(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&xTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function ATe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function v8(t){var e;let r=Gl.default.scan(t,TTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function DTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Gl.default.scan(t);return r.isGlob||r.negated}function vp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function S8(t){return typeof t=="string"?[t]:t??[]}function qP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=CTe(o);s=bTe(s.replace(jTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=NTe.exec(s))===null||i===void 0?void 0:i[0],l=v8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ha.join(o,...d):o}return s}function MTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(qP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(qP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(qP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function FTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=MTe(t,e,n);t.debug&&vp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(_8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Gl.default)(i.match,f),m=(0,Gl.default)(i.ignore,f),h=$Te(i.match,f),g=y8(r,d,o),b=o?g:y8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new HJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&vp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return vp(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&vp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&ATe(r,d)]}function LTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function UTe(t){let e={...zTe,...t};return e.cwd=(e.cwd instanceof URL?STe(e.cwd):vTe(e.cwd)).replace(_8,"/"),e.ignore=S8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||pTe,readdirSync:e.fs.readdirSync||mTe,realpath:e.fs.realpath||hTe,realpathSync:e.fs.realpathSync||gTe,stat:e.fs.stat||yTe,statSync:e.fs.statSync||_Te}),e.debug&&vp("globbing with options:",e),e}function qTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=wTe(t)||typeof t=="string",i=S8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=UTe(n?e:t);return i.length>0?FTe(o,i):[]}function ys(t,e){let[r,n]=qTe(t,e);return r?LTe(r.sync(),n):[]}var Gl,wTe,_8,b8,xTe,kTe,ETe,TTe,OTe,RTe,ITe,PTe,CTe,NTe,jTe,zTe,Sp=y(()=>{GJ();Gl=St(g8(),1),wTe=Array.isArray,_8=/\\/g,b8=process.platform==="win32",xTe=/^(\/?\.\.)+$/;kTe=/^[A-Z]:\/$/i,ETe=b8?t=>kTe.test(t):t=>t==="/";TTe={parts:!0};OTe=/(?t.replace(OTe,"\\$&"),PTe=t=>t.replace(RTe,"\\$&"),CTe=b8?PTe:ITe;NTe=/^(\/?\.\.)+/,jTe=/\\(?=[()[\]{}!*+?@|])/g;zTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as wp,readFileSync as BTe,readdirSync as HTe,statSync as w8}from"node:fs";import{join as Ga}from"node:path";function GTe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Fi(e,n),o=[],{layers:s,forbiddenImports:a}=BP(r);return(s.size>0||a.length>0)&&!wp(Ga(e,i.mainRoot))?[{detector:xp,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(ZTe(e,i,s,o),VTe(e,i,s,o)),a.length>0&&WTe(e,i,a,o),o)}function BP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function ZTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(wp(o))for(let s of HTe(o)){let a=Ga(o,s);w8(a).isDirectory()&&(r.has(s)||n.push({detector:xp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function VTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(wp(o))for(let s of r){let a=Ga(o,s);wp(a)&&w8(a).isDirectory()||n.push({detector:xp,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function WTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!wp(a))continue;let c=ys([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=BTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];KTe(p,s.to,e.importStyle)&&n.push({detector:xp,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function KTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var xp,x8,HP=y(()=>{"use strict";Sp();Ue();Ba();xp="ARCHITECTURE_FROM_SPEC";x8={name:xp,run:GTe}});import{existsSync as JTe,readFileSync as YTe}from"node:fs";import{join as XTe}from"node:path";function eOe(t){let{cwd:e="."}=t,r=XTe(e,"spec/capabilities.yaml");if(!JTe(r))return[];let n;try{let u=YTe(r,"utf8"),d=$8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";$8=St(er(),1);Ue();Lv="CAPABILITIES_FEATURE_MAPPING",QTe=8;k8={name:Lv,run:eOe}});import{existsSync as tOe,readFileSync as rOe}from"node:fs";import{join as nOe}from"node:path";function iOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function oOe(t){let{cwd:e="."}=t;return ge(e,GP,r=>sOe(r,e))}function sOe(t,e){let r=Fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=nOe(e,o);if(!tOe(s))continue;let a=rOe(s,"utf8");iOe(a)||n.push({detector:GP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var GP,A8,T8=y(()=>{"use strict";Ba();wt();GP="CONVENTION_DRIFT";A8={name:GP,run:oOe}});import{existsSync as ZP,readFileSync as O8}from"node:fs";import{join as zv}from"node:path";function aOe(t){return JSON.parse(t).total?.lines?.pct??0}function R8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function uOe(t,e){if(!$v(dt(t).gates.coverage?.cmd))return null;let r;try{r=kv(t,e)}catch(c){return[{detector:$o,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=xP.find(d=>ZP(zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=R8(O8(zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:$o,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=I8(n,i);return a0?[{detector:$o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function dOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=uOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Fi(e,r),i=dt(e).language==="kotlin"?xP.find(a=>ZP(zv(e,a)))??fJ(e):n.coverageSummary,o=zv(e,i);if(!ZP(o))return[{detector:$o,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=O8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?cOe(a):n.coverageFormat==="cobertura-xml"?lOe(a):aOe(a)}catch(a){return[{detector:$o,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:$o,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Uv?[]:[{detector:$o,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Uv}%`}]}var $o,Uv,P8,C8=y(()=>{"use strict";Ue();Tv();Ba();Ev();an();$o="COVERAGE_DROP",Uv=70;P8={name:$o,run:dOe}});import{existsSync as fOe}from"node:fs";import{join as pOe}from"node:path";function hOe(t){let{cwd:e="."}=t;return ge(e,qv,r=>gOe(r,e))}function gOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();qv="DELIVERABLE_INTEGRITY",mOe=8;D8={name:qv,run:hOe}});function yOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Bv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function _Oe(t){let e=yOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Bv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function bOe(t){let{cwd:e="."}=t;return ge(e,Bv,r=>_Oe(r))}var Bv,j8,M8=y(()=>{"use strict";wt();Bv="SMOKE_PROBE_DEMAND";j8={name:Bv,run:bOe}});function vOe(t){let{cwd:e="."}=t;return ge(e,Hv,r=>SOe(r,e))}function SOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=as(e);if(n===null)return[{detector:Hv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=H_(n,e,o);s.state!=="fresh"&&i.push({detector:Hv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Hv,Gv,VP=y(()=>{"use strict";vl();wt();Hv="STALE_ATTESTATION";Gv={name:Hv,run:vOe}});function wOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return xOe(r)}function xOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:F8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var F8,Zv,WP=y(()=>{"use strict";Ue();F8="DEPENDENCY_CYCLE";Zv={name:F8,run:wOe}});import{appendFileSync as $Oe,existsSync as L8,mkdirSync as kOe,readFileSync as EOe}from"node:fs";import{dirname as AOe,join as TOe}from"node:path";function z8(t){return TOe(t,OOe,ROe)}function U8(t){return KP.add(t),()=>KP.delete(t)}function Za(t,e){let r=z8(t),n=AOe(r);L8(n)||kOe(n,{recursive:!0}),$Oe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of KP)try{i(t,e)}catch{}}function fr(t){let e=z8(t);if(!L8(e))return[];let r=EOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var OOe,ROe,KP,ln=y(()=>{"use strict";OOe=".cladding",ROe="audit.log.jsonl";KP=new Set});import{existsSync as IOe}from"node:fs";import{join as POe}from"node:path";function COe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:JP,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(IOe(POe(e,i.artifact))||n.push({detector:JP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var JP,q8,B8=y(()=>{"use strict";ln();JP="EVIDENCE_MISMATCH";q8={name:JP,run:COe}});import{existsSync as DOe,readFileSync as NOe}from"node:fs";import{join as jOe}from"node:path";function MOe(t){let e=jOe(t,V8);if(!DOe(e))return null;try{let n=((0,Z8.parse)(NOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*G8(t,e){for(let r of t??[])r.startsWith(H8)&&(yield{ref:r,name:r.slice(H8.length),field:e})}function FOe(t){let{cwd:e="."}=t,r=MOe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:YP,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...G8(s.evidence_refs,"evidence_refs"),...G8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:YP,severity:"warn",path:V8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var Z8,YP,H8,V8,W8,K8=y(()=>{"use strict";Z8=St(er(),1);Ue();YP="FIXTURE_REFERENCE_INVALID",H8="fixture:",V8="conformance/fixtures.yaml";W8={name:YP,run:FOe}});import{existsSync as Zl,readFileSync as XP}from"node:fs";import{join as Va}from"node:path";function LOe(t){return ys(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function $p(t){if(!Zl(t))return null;try{return JSON.parse(XP(t,"utf8"))}catch{return null}}function zOe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(XP(r,"utf8"))}catch(c){e.push({detector:ko,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:ko,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=LOe(t);s!==a&&e.push({detector:ko,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function UOe(t,e){for(let r of J8){let n=Va(t,r.path);if(!Zl(n))continue;let i=$p(n);if(!i){e.push({detector:ko,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:ko,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function qOe(t,e){let r=$p(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of J8){let s=Va(t,o.path);if(!Zl(s))continue;let a=$p(s);a?.version&&a.version!==n&&e.push({detector:ko,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(Zl(i)){let o=$p(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:ko,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function BOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function HOe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Zl(r)||!Zl(n))return;let i=BOe(XP(r,"utf8"));if(i.length===0)return;let s=$p(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:ko,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function GOe(t){let{cwd:e="."}=t,r=[];return zOe(e,r),HOe(e,r),UOe(e,r),qOe(e,r),r}var ko,J8,Y8,X8=y(()=>{"use strict";Sp();ko="HARNESS_INTEGRITY",J8=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];Y8={name:ko,run:GOe}});import{existsSync as ZOe,readFileSync as VOe}from"node:fs";import{join as WOe}from"node:path";function JOe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>XOe(r,e))}function YOe(t){let e=WOe(t,"spec/capabilities.yaml");if(!ZOe(e))return!1;try{let r=Q8.default.parse(VOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function XOe(t,e){let r=t.features.length;if(r{"use strict";Q8=St(er(),1);wt();Vv="HOLLOW_GOVERNANCE",KOe=8;e5={name:Vv,run:JOe}});import{existsSync as r5,readFileSync as n5}from"node:fs";import{join as i5}from"node:path";function o5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function tRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function rRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function nRe(t){let e=i5(t,"README.md"),r=i5(t,"docs","dogfood","matrix.md");if(!r5(e)||!r5(r))return[];let n=o5(n5(e,"utf8"),QOe),i=o5(n5(r,"utf8"),eRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=rRe(a);if(c===null)continue;let l=i[s]??"not-run",u=tRe(l);u!==null&&c>u&&o.push({detector:s5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function iRe(t){let{cwd:e="."}=t;return nRe(e)}var s5,QOe,eRe,a5,c5=y(()=>{"use strict";s5="HOST_CLAIM_DRIFT",QOe=//,eRe=//;a5={name:s5,run:iRe}});function oRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return l5(r.features.map(i=>i.id),"feature","spec/features/",n),l5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function l5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:u5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var u5,d5,f5=y(()=>{"use strict";Ue();u5="ID_COLLISION";d5={name:u5,run:oRe}});import{existsSync as kp,readFileSync as QP,readdirSync as eC,statSync as sRe,writeFileSync as m5}from"node:fs";import{join as Eo}from"node:path";function p5(t){if(!kp(t))return 0;try{return eC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function aRe(t){if(!kp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=eC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Eo(n,o),a;try{a=sRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function cRe(t){let e=Eo(t,"spec","capabilities.yaml");if(!kp(e))return 0;try{let r=Wv.default.parse(QP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function _s(t="."){let e=p5(Eo(t,"spec","features")),r=p5(Eo(t,"spec","scenarios")),n=cRe(t),i=aRe(Eo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Vl(t,e){let r=Eo(t,"spec.yaml");if(!kp(r))return;let n=QP(r,"utf8"),i=lRe(n,e);i!==n&&m5(r,i)}function lRe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as r0e}from"node:buffer";import{StringDecoder as n0e}from"node:string_decoder";var iv,i0e,o0e,s0e,wI=y(()=>{on();iv=(t,e,r)=>{if(r)return;if(t)return{transform:i0e.bind(void 0,new TextEncoder)};let n=new n0e(e);return{transform:o0e.bind(void 0,n),final:s0e.bind(void 0,n)}},i0e=function*(t,e){r0e.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},o0e=function*(t,e){yield qt(e)?t.write(e):e},s0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as aK}from"node:util";var xI,ov,cK,a0e,lK,c0e,uK=y(()=>{xI=aK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),ov=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=c0e}=e[r];for await(let i of n(t))yield*ov(i,e,r+1)},cK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*a0e(r,Number(e),t)},a0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*ov(n,r,e+1)},lK=aK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),c0e=function*(t){yield t}});var $I,dK,Ma,lp,l0e,u0e,kI=y(()=>{$I=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dK=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...lp(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},lp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},u0e=function*(t){yield t}});import{Transform as d0e,getDefaultHighWaterMark as fK}from"node:stream";var EI,sv,pK,av=y(()=>{wr();nv();sK();wI();uK();kI();EI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=pK(t,s,o),l=ja(e),u=ja(r),d=l?xI.bind(void 0,ov,a):$I.bind(void 0,Ma),f=l||u?xI.bind(void 0,cK,a):$I.bind(void 0,lp),p=l||u?lK.bind(void 0,a):void 0;return{stream:new d0e({writableObjectMode:n,writableHighWaterMark:fK(n),readableObjectMode:i,readableHighWaterMark:fK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},sv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=pK(s,r,a);t=dK(c,t)}return t},pK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:nK(n,a)},iv(r,s,n),rv(r,o,n,c),{transform:t,final:e},{transform:iK(i,a)},rK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var mK,f0e,p0e,m0e,h0e,hK=y(()=>{av();on();wr();mK=(t,e)=>{for(let r of f0e(t))p0e(t,r,e)},f0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),p0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ms[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>m0e(a,n));r.input=Vf(s)},m0e=(t,e)=>{let r=sv(t,e,"utf8",!0);return h0e(r),Vf(r)},h0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var cv,g0e,y0e,gK,yK,_0e,_K,AI=y(()=>{Pa();wr();Tl();us();cv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Al(r,n)&&!sn.has(e)&&g0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&y0e.has(o))||t.every(({type:i})=>In.has(i))),g0e=t=>t===1||t===2,y0e=new Set(["pipe","overlapped"]),gK=async(t,e,r,n)=>{for await(let i of t)_0e(e)||_K(i,r,n)},yK=(t,e,r)=>{for(let n of t)_K(n,e,r)},_0e=t=>t._readableState.pipes.length>0,_K=(t,e,r)=>{let n=ab(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as b0e,appendFileSync as v0e}from"node:fs";var bK,S0e,w0e,x0e,$0e,k0e,vK=y(()=>{AI();av();nv();on();wr();Na();bK=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>S0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},S0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=iW(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=w0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=x0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});$0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&k0e(b,m,i),S}catch(x){return n.error=x,S}},w0e=(t,e,r,n)=>{try{return sv(t,e,r,!1)}catch(i){return n.error=i,t}},x0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Vf(t)};let s=WG(t,r);return n[o]?{serializedResult:s,finalResult:SI(s,!i[o],e)}:{serializedResult:s}},$0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!cv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=SI(t,!1,s);try{yK(a,e,n)}catch(c){r.error??=c}},k0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Qb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?v0e(n,t):(r.add(o),b0e(n,t))}}});var SK,wK=y(()=>{on();cp();SK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xo(e,r,"all")]:Array.isArray(e)?[xo(t,r,"all"),...e]:qt(t)&&qt(e)?gR([t,e]):`${t}${e}`}});import{once as TI}from"node:events";var xK,E0e,$K,kK,A0e,OI,RI=y(()=>{Ra();xK=async(t,e)=>{let[r,n]=await E0e(t);return e.isForcefullyTerminated??=!1,[r,n]},E0e=async t=>{let[e,r]=await Promise.allSettled([TI(t,"spawn"),TI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?$K(t):r.value},$K=async t=>{try{return await TI(t,"exit")}catch{return $K(t)}},kK=async t=>{let[e,r]=await t;if(!A0e(e,r)&&OI(e,r))throw new ti;return[e,r]},A0e=(t,e)=>t===void 0&&e===void 0,OI=(t,e)=>t!==0||e!==null});var EK,T0e,AK=y(()=>{Ra();Na();RI();EK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=T0e(t,e,r),s=o?.code==="ETIMEDOUT",a=nW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},T0e=(t,e,r)=>t!==void 0?t:OI(e,r)?new ti:void 0});import{spawnSync as O0e}from"node:child_process";var TK,R0e,I0e,P0e,lv,C0e,D0e,N0e,j0e,OK=y(()=>{kR();QR();eI();ap();Jb();QW();cp();hK();vK();Na();wK();AK();TK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=R0e(t,e,r),d=C0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ll(d,c,l)},R0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),a=I0e(r),{file:c,commandArguments:l,options:u}=Mb(t,e,a);P0e(u);let d=YW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},I0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,P0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&lv("ipcInput"),t&&lv("ipc: true"),r&&lv("detached: true"),n&&lv("cancelSignal")},lv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},C0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=D0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=EK(c,r),{output:m,error:h=l}=bK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(SK(m,r),r,"all");return j0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},D0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{mK(o,r);let a=N0e(r);return O0e(...Fb(t,e,a))}catch(a){return Fl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},N0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Wb(e)}),j0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Kb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):sp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as II,on as M0e}from"node:events";var RK,F0e,L0e,z0e,U0e,IK=y(()=>{Cl();tp();ep();RK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Il({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),F0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),F0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{xb(e,i);let o=ps(t,e,r),s=new AbortController;try{return await Promise.race([L0e(o,n,s),z0e(o,r,s),U0e(o,r,s)])}catch(a){throw Pl(t),a}finally{s.abort(),$b(e,i)}},L0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await II(t,"message",{signal:r});return n}for await(let[n]of M0e(t,"message",{signal:r}))if(e(n))return n},z0e=async(t,e,{signal:r})=>{await II(t,"disconnect",{signal:r}),q9(e)},U0e=async(t,e,{signal:r})=>{let[n]=await II(t,"strict:error",{signal:r});throw bb(n,e)}});import{once as CK,on as q0e}from"node:events";var DK,PI,B0e,H0e,G0e,PK,CI=y(()=>{Cl();tp();ep();DK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>PI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),PI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Il({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),xb(e,o);let s=ps(t,e,r),a=new AbortController,c={};return B0e(t,s,a),H0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),G0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},B0e=async(t,e,r)=>{try{await CK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},H0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await CK(t,"strict:error",{signal:r.signal});n.error=bb(i,e),r.abort()}catch{}},G0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of q0e(r,"message",{signal:o.signal}))PK(s),yield c}catch{PK(s)}finally{o.abort(),$b(e,a),n||Pl(t),i&&await t}},PK=({error:t})=>{if(t)throw t}});import NK from"node:process";var jK,MK,FK,DI=y(()=>{Nb();IK();CI();Tb();jK=(t,{ipc:e})=>{Object.assign(t,FK(t,!1,e))},MK=()=>{let t=NK,e=!0,r=NK.channel!==void 0;return{...FK(t,e,r),getCancelSignal:gV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},FK=(t,e,r)=>({sendMessage:Db.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:RK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:DK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Z0e}from"node:child_process";import{PassThrough as V0e,Readable as W0e,Writable as K0e,Duplex as J0e}from"node:stream";var LK,Y0e,up,X0e,Q0e,e$e,t$e,zK=y(()=>{tv();ap();Jb();LK=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{_I(n);let a=new Z0e;Y0e(a,n),Object.assign(a,{readable:X0e,writable:Q0e,duplex:e$e});let c=Fl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=t$e(c,s,i);return{subprocess:a,promise:l}},Y0e=(t,e)=>{let r=up(),n=up(),i=up(),o=Array.from({length:e.length-3},up),s=up(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},up=()=>{let t=new V0e;return t.end(),t},X0e=()=>new W0e({read(){}}),Q0e=()=>new K0e({write(){}}),e$e=()=>new J0e({read(){},write(){}}),t$e=async(t,e,r)=>Ll(t,e,r)});import{createReadStream as UK,createWriteStream as qK}from"node:fs";import{Buffer as r$e}from"node:buffer";import{Readable as dp,Writable as n$e,Duplex as i$e}from"node:stream";var HK,fp,BK,o$e,GK=y(()=>{av();tv();wr();HK=(t,e)=>ev(o$e,t,e,!1),fp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ms[t]}.`)},BK={fileNumber:fp,generator:EI,asyncGenerator:EI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:i$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},o$e={input:{...BK,fileUrl:({value:t})=>({stream:UK(t)}),filePath:({value:{file:t}})=>({stream:UK(t)}),webStream:({value:t})=>({stream:dp.fromWeb(t)}),iterable:({value:t})=>({stream:dp.from(t)}),asyncIterable:({value:t})=>({stream:dp.from(t)}),string:({value:t})=>({stream:dp.from(t)}),uint8Array:({value:t})=>({stream:dp.from(r$e.from(t))})},output:{...BK,fileUrl:({value:t})=>({stream:qK(t)}),filePath:({value:{file:t,append:e}})=>({stream:qK(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:n$e.fromWeb(t)}),iterable:fp,asyncIterable:fp,string:fp,uint8Array:fp}}});import{on as s$e,once as ZK}from"node:events";import{PassThrough as a$e,getDefaultHighWaterMark as c$e}from"node:stream";import{finished as KK}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)jI(i);let e=t.some(({readableObjectMode:i})=>i),r=l$e(t,e),n=new NI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var l$e,NI,u$e,d$e,f$e,jI,p$e,m$e,h$e,g$e,y$e,JK,YK,MI,XK,_$e,uv,VK,WK,dv=y(()=>{l$e=(t,e)=>{if(t.length===0)return c$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},NI=class extends a$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(jI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=u$e(this,this.#t,this.#o);let r=p$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(jI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},u$e=async(t,e,r)=>{uv(t,VK);let n=new AbortController;try{await Promise.race([d$e(t,n),f$e(t,e,r,n)])}finally{n.abort(),uv(t,-VK)}},d$e=async(t,{signal:e})=>{try{await KK(t,{signal:e,cleanup:!0})}catch(r){throw JK(t,r),r}},f$e=async(t,e,r,{signal:n})=>{for await(let[i]of s$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},jI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},p$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{uv(t,WK);let a=new AbortController;try{await Promise.race([m$e(o,e,a),h$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),g$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),uv(t,-WK)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?MI(t):y$e(t))},m$e=async(t,e,{signal:r})=>{try{await t,r.aborted||MI(e)}catch(n){r.aborted||JK(e,n)}},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await KK(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;YK(s)?i.add(e):XK(t,s)}},g$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await ZK(t,i,{signal:o}),!t.readable)return ZK(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},y$e=t=>{t.writable&&t.end()},JK=(t,e)=>{YK(e)?MI(t):XK(t,e)},YK=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",MI=t=>{(t.readable||t.writable)&&t.destroy()},XK=(t,e)=>{t.destroyed||(t.once("error",_$e),t.destroy(e))},_$e=()=>{},uv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},VK=2,WK=1});import{finished as QK}from"node:stream/promises";var Ul,b$e,FI,v$e,LI,fv=y(()=>{bo();Ul=(t,e)=>{t.pipe(e),b$e(t,e),v$e(t,e)},b$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}FI(e)}},FI=t=>{t.writable&&t.end()},v$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}LI(t)}},LI=t=>{t.readable&&t.destroy()}});var e3,S$e,w$e,x$e,$$e,k$e,t3=y(()=>{dv();bo();wb();wr();fv();e3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>In.has(c)))S$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!In.has(c)))x$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fa(o);Ul(s,i)}},S$e=(t,e,r,n)=>{r==="output"?Ul(t.stdio[n],e):Ul(e,t.stdio[n]);let i=w$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},w$e=["stdin","stdout","stderr"],x$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;$$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},$$e=(t,{signal:e})=>{ei(t)&&Ia(t,k$e,e)},k$e=2});var La,r3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var pv,zI,UI,E$e,qI,mv,A$e,BI,HI,GI,n3,vat,Sat,i3=y(()=>{r3();pv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",zI=Symbol.for("signal-exit emitter"),UI=globalThis,E$e=Object.defineProperty.bind(Object),qI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(UI[zI])return UI[zI];E$e(UI,zI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},mv=class{},A$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),BI=class extends mv{onExit(){return()=>{}}load(){}unload(){}},HI=class extends mv{#t=GI.platform==="win32"?"SIGINT":"SIGHUP";#r=new qI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!pv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of La)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,La.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return pv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&pv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},GI=globalThis.process,{onExit:n3,load:vat,unload:Sat}=A$e(pv(GI)?new HI(GI):new BI)});import{addAbortListener as T$e}from"node:events";var o3,s3=y(()=>{i3();o3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=n3(()=>{t.kill()});T$e(n,()=>{i()})}});var c3,O$e,R$e,a3,I$e,l3=y(()=>{hR();lb();fs();kl();c3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=cb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=O$e(r,n,i),{sourceStream:d,sourceError:f}=I$e(t,l),{options:p,fileDescriptors:m}=Di.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},O$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=R$e(t,e,...r),a=Sb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},R$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(a3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||pR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=Y_(r,...n);return{destination:e(a3)(i,o,s),pipeOptions:s}}if(Di.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},a3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),I$e=(t,e)=>{try{return{sourceStream:Nl(t,e)}}catch(r){return{sourceError:r}}}});var d3,P$e,ZI,u3,VI=y(()=>{ap();fv();d3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=P$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw ZI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},P$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return LI(t),n;if(e!==void 0)return FI(r),e},ZI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Fl({error:t,command:u3,escapedCommand:u3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),u3="source.pipe(destination)"});var f3,p3=y(()=>{f3=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as C$e}from"node:stream/promises";var m3,D$e,N$e,j$e,hv,M$e,F$e,h3=y(()=>{dv();wb();fv();m3=(t,e,r)=>{let n=hv.has(e)?N$e(t,e):D$e(t,e);return Ia(t,M$e,r.signal),Ia(e,F$e,r.signal),j$e(e),n},D$e=(t,e)=>{let r=Fa([t]);return Ul(r,e),hv.set(e,r),r},N$e=(t,e)=>{let r=hv.get(e);return r.add(t),r},j$e=async t=>{try{await C$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}hv.delete(t)},hv=new WeakMap,M$e=2,F$e=1});import{aborted as L$e}from"node:util";var g3,z$e,y3=y(()=>{VI();g3=(t,e)=>t===void 0?[]:[z$e(t,e)],z$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await L$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw ZI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var gv,U$e,q$e,_3=y(()=>{yo();l3();VI();p3();h3();y3();gv=(t,...e)=>{if(Ot(e[0]))return gv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=c3(t,...e),i=U$e({...n,destination:r});return i.pipe=gv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},U$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=q$e(t,i);d3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=m3(e,o,d);return await Promise.race([f3(u),...g3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},q$e=(t,e)=>Promise.allSettled([t,e])});import{on as B$e}from"node:events";import{getDefaultHighWaterMark as H$e}from"node:stream";var yv,G$e,WI,Z$e,v3,KI,b3,V$e,W$e,_v=y(()=>{wI();nv();kI();yv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return G$e(e,s),v3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},G$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},WI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Z$e(e,s,t);let a=t.readableObjectMode&&!o;return v3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Z$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},v3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=B$e(t,"data",{signal:e.signal,highWaterMark:b3,highWatermark:b3});return V$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},KI=H$e(!0),b3=KI,V$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=W$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*lp(a)}},W$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[iv(t,r,!e),rv(t,i,!n,{})].filter(Boolean)});import{setImmediate as K$e}from"node:timers/promises";var S3,J$e,Y$e,X$e,JI,w3,YI=y(()=>{Vb();on();AI();_v();Na();cp();S3=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=J$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Y$e(t),d]);return}let f=bI(c,r),p=WI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([X$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},J$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!cv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=WI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await gK(a,t,r,o)},Y$e=async t=>{await K$e(),t.readableFlowing===null&&t.resume()},X$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Bb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Hb(r,{maxBuffer:o})):await Zb(r,{maxBuffer:o})}catch(a){return w3(eW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},JI=async t=>{try{return await t}catch(e){return w3(e)}},w3=({bufferedData:t})=>ZG(t)?new Uint8Array(t):t});import{finished as Q$e}from"node:stream/promises";var pp,eke,tke,rke,nke,ike,XI,bv,x3,vv=y(()=>{pp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=eke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Q$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||nke(a,e,r,n)}finally{s.abort()}},eke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&tke(t,r,n),n},tke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{rke(e,r),n.call(t,...i)}},rke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},nke=(t,e,r,n)=>{if(!ike(t,e,r,n))throw t},ike=(t,e,r,n=!0)=>r.propagating?x3(t)||bv(t):(r.propagating=!0,XI(r,e)===n?x3(t):bv(t)),XI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",bv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",x3=t=>t?.code==="EPIPE"});var $3,QI,eP=y(()=>{YI();vv();$3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>QI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),QI=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=pp(t,e,l);if(XI(l,e)){await u;return}let[d]=await Promise.all([S3({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var k3,E3,oke,ske,tP=y(()=>{dv();eP();k3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,E3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>QI({...oke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:ske(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),oke=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},ske=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var A3,T3,O3=y(()=>{Tl();us();A3=t=>Al(t,"ipc"),T3=(t,e)=>{let r=ab(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var R3,I3,P3=y(()=>{Na();O3();So();CI();R3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=A3(o),a=vo(e,"ipc"),c=vo(r,"ipc");for await(let l of PI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(tW(t,i,c),i.push(l)),s&&T3(l,o);return i},I3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as ake}from"node:events";var C3,cke,lke,uke,D3=y(()=>{Da();WR();LR();VR();bo();wr();YI();P3();JR();tP();eP();RI();vv();C3=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=xK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=$3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=E3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=R3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=cke(h,t,S),D=lke(m,S);try{return await Promise.race([Promise.all([{},kK(_),Promise.all(x),w,T,EV(t,d),...A,...D]),g,uke(t,b),...SV(t,o,f,b),...U9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...bV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>JI(re))),JI(w),I3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},cke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:pp(n,i,r)),lke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ni(o,{checkOpen:!1})&&!ei(o)).map(({type:i,value:o,stream:s=o})=>pp(s,n,e,{isSameDirection:In.has(i),stopOnExit:i==="native"}))),uke=async(t,{signal:e})=>{let[r]=await ake(t,"error",{signal:e});throw r}});var N3,mp,ql,Sv=y(()=>{Dl();N3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),mp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},ql=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as j3}from"node:stream/promises";var rP,M3,nP,iP,wv,xv,oP=y(()=>{vv();rP=async t=>{if(t!==void 0)try{await nP(t)}catch{}},M3=async t=>{if(t!==void 0)try{await iP(t)}catch{}},nP=async t=>{await j3(t,{cleanup:!0,readable:!1,writable:!0})},iP=async t=>{await j3(t,{cleanup:!0,readable:!0,writable:!1})},wv=async(t,e)=>{if(await t,e)throw e},xv=(t,e,r)=>{r&&!bv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as dke}from"node:stream";import{callbackify as fke}from"node:util";var F3,sP,aP,cP,pke,lP,uP,L3,dP=y(()=>{Pa();fs();_v();Dl();Sv();oP();F3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||sn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=aP(a,s),{read:f,onStdoutDataDone:p}=cP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new dke({read:f,destroy:fke(uP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return lP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},sP=(t,e,r)=>{let n=Nl(t,e),i=mp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},aP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:KI},cP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ci(),s=yv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){pke(this,s,o)},onStdoutDataDone:o}},pke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},lP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await iP(t),await n,await rP(i),await e,r.readable&&r.push(null)}catch(o){await rP(i),L3(r,o)}},uP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await ql(r,e)&&(L3(t,n),await wv(e,n))},L3=(t,e)=>{xv(t,t.readable,e)}});import{Writable as mke}from"node:stream";import{callbackify as z3}from"node:util";var U3,fP,pP,hke,gke,mP,hP,q3,gP=y(()=>{fs();Sv();oP();U3=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=fP(t,r,e),s=new mke({...pP(n,t,i),destroy:z3(hP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return mP(n,s),s},fP=(t,e,r)=>{let n=Sb(t,e),i=mp(r,n,"writableFinal"),o=mp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},pP=(t,e,r)=>({write:hke.bind(void 0,t),final:z3(gke.bind(void 0,t,e,r))}),hke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},gke=async(t,e,r)=>{await ql(r,e)&&(t.writable&&t.end(),await e)},mP=async(t,e,r)=>{try{await nP(t),e.writable&&e.end()}catch(n){await M3(r),q3(e,n)}},hP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await ql(r,e),await ql(n,e)&&(q3(t,i),await wv(e,i))},q3=(t,e)=>{xv(t,t.writable,e)}});import{Duplex as yke}from"node:stream";import{callbackify as _ke}from"node:util";var B3,bke,H3=y(()=>{Pa();dP();gP();B3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||sn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=fP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=aP(c,a),{read:g,onStdoutDataDone:b}=cP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new yke({read:g,...pP(u,t,d),destroy:_ke(bke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return lP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),mP(u,_,c),_},bke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([uP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),hP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var yP,vke,G3=y(()=>{Pa();fs();_v();yP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||sn.has(e),s=Nl(t,r),a=yv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return vke(a,s,t)},vke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var Z3,V3=y(()=>{Sv();dP();gP();H3();G3();Z3=(t,{encoding:e})=>{let r=N3();t.readable=F3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=U3.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=B3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=yP.bind(void 0,t,e),t[Symbol.asyncIterator]=yP.bind(void 0,t,e,{})}});var W3,Ske,wke,K3=y(()=>{W3=(t,e)=>{for(let[r,n]of wke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Ske=(async()=>{})().constructor.prototype,wke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Ske,t)])});import{setMaxListeners as xke}from"node:events";import{spawn as $ke}from"node:child_process";var J3,kke,Eke,Ake,Tke,Oke,Y3=y(()=>{Vb();kR();QR();fs();eI();DI();ap();Jb();zK();GK();cp();t3();yb();s3();_3();tP();D3();V3();Dl();K3();J3=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=kke(t,e,r),{subprocess:f,promise:p}=Ake({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=gv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),W3(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},kke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),{file:a,commandArguments:c,options:l}=Mb(t,e,r),u=Eke(l),d=HK(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Eke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Ake=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=$ke(...Fb(t,e,r))}catch(m){return LK({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;xke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];e3(c,a,l),o3(c,r,l);let d={},f=Ci();c.kill=L9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=k3(c,r),Z3(c,r),jK(c,r);let p=Tke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Tke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await C3({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>xo(x,e,w)),_=xo(h,e,"all"),S=Oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ll(S,n,e)},Oke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?sp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ni,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Kb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var $v,Rke,Ike,X3=y(()=>{yo();So();$v=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Rke(n,t[n],i)]));return{...t,...r}},Rke=(t,e,r)=>Ike.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Ike=new Set(["env",...vR])});var hs,Pke,Cke,Q3=y(()=>{yo();hR();eZ();OK();Y3();X3();hs=(t,e,r,n)=>{let i=(s,a,c)=>hs(s,a,r,c),o=(...s)=>Pke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Pke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,$v(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Cke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?TK(a,c,l):J3(a,c,l,i)},Cke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=XG(e)?QG(e,r):[e,...r],[s,a,c]=Y_(...o),l=$v($v(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var eJ,tJ,rJ,Dke,Nke,nJ=y(()=>{eJ=({file:t,commandArguments:e})=>rJ(t,e),tJ=({file:t,commandArguments:e})=>({...rJ(t,e),isSync:!0}),rJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Dke(t);return{file:r,commandArguments:n}},Dke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Nke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Nke=/ +/g});var iJ,oJ,jke,sJ,Mke,aJ,cJ=y(()=>{iJ=(t,e,r)=>{t.sync=e(jke,r),t.s=t.sync},oJ=({options:t})=>sJ(t),jke=({options:t})=>({...sJ(t),isSync:!0}),sJ=t=>({options:{...Mke(t),...t}}),Mke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},aJ={preferLocal:!0}});var uut,We,dut,fut,put,mut,hut,gut,yut,_ut,Fr=y(()=>{Q3();nJ();KR();cJ();DI();uut=hs(()=>({})),We=hs(()=>({isSync:!0})),dut=hs(eJ),fut=hs(tJ),put=hs(xV),mut=hs(oJ,{},aJ,iJ),{sendMessage:hut,getOneMessage:gut,getEachMessage:yut,getCancelSignal:_ut}=MK()});import{existsSync as kv,statSync as Fke}from"node:fs";import{dirname as _P,extname as Lke,isAbsolute as lJ,join as bP,relative as vP,resolve as Ev,sep as zke}from"node:path";function Av(t){return t==="./gradlew"||t==="gradle"}function Uke(t){return(kv(bP(t,"build.gradle.kts"))||kv(bP(t,"build.gradle")))&&kv(bP(t,"gradle.properties"))}function qke(t,e){let n=vP(t,e).split(zke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function gs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Bke(t,e){let r=Ev(t,e),n=r;kv(r)?Fke(r).isFile()&&(n=_P(r)):Lke(r)!==""&&(n=_P(r));let i=vP(t,n);if(i.startsWith("..")||lJ(i))return null;let o=n;for(;;){if(Uke(o))return o;if(Ev(o)===Ev(t))return null;let s=_P(o);if(s===o)return null;let a=vP(t,s);if(a.startsWith("..")||lJ(a))return null;o=s}}function Tv(t,e){let r=Ev(t),n=new Map,i=[];for(let o of e){let s=Bke(r,o);if(!s){i.push(o);continue}let a=qke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Ov=y(()=>{"use strict"});import{existsSync as wP,readFileSync as Hke}from"node:fs";import{join as Bl}from"node:path";function Hl(t="."){let e=Bl(t,".cladding","config.yaml");if(!wP(e))return SP;try{let n=(0,uJ.parse)(Hke(e,"utf8"))?.gate;if(!n)return SP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Gke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return SP}}function dJ(t="."){let e=Hl(t).testReport,r=e?[e,...xP]:xP;return[...new Set(r.map(n=>Bl(t,n)))]}function fJ(t="."){let e=Hl(t).testReport;if(e){let r=Bl(t,e);return wP(r)?r:null}return xP.map(r=>Bl(t,r)).find(r=>wP(r))??null}function pJ(t,e){let r=[],n=!1;for(let i of t){let o=Zke.exec(i);if(o){n=!0;for(let s of e)r.push(gs(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var uJ,Gke,SP,xP,Zke,hp=y(()=>{"use strict";uJ=St(er(),1);Ov();Gke=["type","lint","test","coverage"],SP={scope:"feature"},xP=["test-report.junit.xml",Bl("coverage","junit.xml"),Bl(".cladding","test-report.junit.xml")];Zke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as kP,readFileSync as mJ,readdirSync as Vke,statSync as Wke}from"node:fs";import{join as Rv}from"node:path";function TP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Rv(t,e);if(kP(r))try{if(hJ.test(mJ(r,"utf8")))return!0}catch{}}return!1}function gJ(t){try{return kP(t)&&hJ.test(mJ(t,"utf8"))}catch{return!1}}function yJ(t,e=0){if(e>4||!kP(t))return!1;let r;try{r=Vke(t)}catch{return!1}for(let n of r){let i=Rv(t,n),o=!1;try{o=Wke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(yJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&gJ(i))return!0}return!1}function Yke(t){if(TP(t))return!0;for(let e of Kke)if(gJ(Rv(t,e)))return!0;for(let e of Jke)if(yJ(Rv(t,e)))return!0;return!1}function _J(t="."){let e=Hl(t).coverage;return e||(Yke(t)?"kover":"jacoco")}function bJ(t="."){return EP[_J(t)]}function vJ(t="."){return $P[_J(t)]}var EP,$P,AP,hJ,Kke,Jke,Iv=y(()=>{"use strict";hp();EP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},$P={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},AP=[$P.kover,$P.jacoco],hJ=/kover/i;Kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Jke=["buildSrc","build-logic"]});import{existsSync as yp,readFileSync as wJ,readdirSync as xJ}from"node:fs";import{join as ys}from"node:path";function RP(t){return yp(ys(t,"gradlew"))?"./gradlew":"gradle"}function Xke(t){let e=RP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[bJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Qke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(wJ(ys(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function tEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function iEe(t,e){for(let r of e)if(yp(ys(t,r)))return r}function oEe(t,e){try{return xJ(t).find(n=>n.endsWith(e))}catch{return}}function cEe(t){try{return JSON.parse(wJ(ys(t,"package.json"),"utf8"))}catch{return{}}}function gp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function SJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function lEe(t,e,r){if(gp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of sEe)if(n.configs.some(i=>yp(ys(t,i))))return n.gate;if(aEe.some(n=>yp(ys(t,n)))||r.eslintConfig!==void 0)return e}function dEe(t,e){return uEe.some(r=>yp(ys(t,r)))?!0:e.jest!==void 0}function fEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function OP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function pEe(t,e){let r=cEe(t),n=e.lint?lEe(t,e.lint,r):void 0,i=n?{...e,lint:n}:OP(e,"lint"),o=gp(r,"test"),s=o?fEe(o):void 0;return o&&!s?(i=OP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...gp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&dEe(t,r)?{...i,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(s==="vitest"&&!gp(r,"coverage")&&!SJ(r,"@vitest/coverage-v8")&&!SJ(r,"@vitest/coverage-istanbul")?i=OP(i,"coverage"):s==="vitest"&&gp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of rEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=oEe(t,o):r=iEe(t,[o]),r)break;if(!r||e.requiresSource&&!tEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?pEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return nEe}var Mi,eEe,rEe,nEe,sEe,aEe,uEe,an=y(()=>{"use strict";Iv();Mi=["--offline","--no-install"];eEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);rEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Mi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Mi,"eslint","."]},test:{cmd:"npx",args:[...Mi,"vitest","run"]},coverage:{cmd:"npx",args:[...Mi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Mi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Mi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:Xke},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Qke}],nEe={language:"unknown",manifest:"",gates:{}};sEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Mi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Mi,"oxlint"]}}],aEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"];uEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as mEe,readFileSync as hEe}from"node:fs";import{join as gEe}from"node:path";function za(t){return t.code==="ENOENT"}function Pv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return $J.test(o)||$J.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Gl(t,e){let r=gEe(t,"package.json");if(!mEe(r))return!1;try{return!!JSON.parse(hEe(r,"utf8")).scripts?.[e]}catch{return!1}}var $J,Pn=y(()=>{"use strict";$J=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function yEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Cv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Cv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Pv(i,Cv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Cv,Ua,Dv=y(()=>{"use strict";Fr();an();Pn();Cv="ARCHITECTURE_VIOLATION";Ua={name:Cv,subprocess:!0,run:yEe}});function _Ee(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Pv(i,Nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Nv,qa,jv=y(()=>{"use strict";Fr();an();Pn();Nv="HARDCODED_SECRET";qa={name:Nv,subprocess:!0,run:_Ee}});import{existsSync as IP,readdirSync as kJ}from"node:fs";import{join as Mv}from"node:path";function vEe(t,e){let r=Mv(t,e.path);if(!IP(r))return!0;if(e.isDirectory)try{return kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function SEe(t){let{cwd:e="."}=t,r=[];for(let i of bEe)vEe(e,i)&&r.push({detector:_p,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Mv(e,"spec.yaml");if(IP(n)){let i=$Ee(n),o=i?null:wEe(e);if(i)r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:_p,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=xEe(e);s&&r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function wEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Mv(t,e);if(!IP(r))continue;let n;try{n=kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Oi(Mv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function xEe(t){try{return q(t),null}catch(e){return e.message}}function $Ee(t){let e;try{e=Oi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var _p,bEe,EJ,AJ=y(()=>{"use strict";Ue();U_();_p="ABSENCE_OF_GOVERNANCE",bEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];EJ={name:_p,run:SEe}});function Fv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function PP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Fv(r)==="while",o=EEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Fv(r)}'`}let n=kEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Fv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Fv(r)}'`:null}function AEe(t,e){let r=PP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function TJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...AEe(r,n));return e}var kEe,EEe,CP=y(()=>{"use strict";kEe={event:"when",state:"while",optional:"where",unwanted:"if"},EEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function TEe(t){let{cwd:e="."}=t;return ge(e,Lv,OEe)}function OEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Lv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of TJ(t.features))e.push({detector:Lv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Lv,OJ,RJ=y(()=>{"use strict";CP();wt();Lv="AC_DRIFT";OJ={name:Lv,run:TEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return PJ[n]??IJ}var REe,IEe,PEe,IJ,CEe,DEe,PJ,NEe,CJ,Ba=y(()=>{"use strict";an();REe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,IEe=/^[ \t]*import\s+([\w.]+)/gm,PEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,IJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:REe,importStyle:"relative"},CEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:IEe,importStyle:"dotted"},DEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:PEe,importStyle:"dotted"},PJ={typescript:IJ,kotlin:CEe,python:DEe},NEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],CJ=new Set([...Object.values(PJ).flatMap(t=>t?.extensions??[]),...NEe].map(t=>t.toLowerCase()))});import{existsSync as jEe,readFileSync as MEe,readdirSync as FEe,statSync as LEe}from"node:fs";import{join as NJ,relative as DJ}from"node:path";function zEe(t,e){if(!jEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=FEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=NJ(i,s),c;try{c=LEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function UEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function BEe(t){return qEe.test(t)}function HEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>zEe(NJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=MEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ba();jJ="AI_HINTS_FORBIDDEN_PATTERN";qEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;MJ={name:jJ,run:HEe}});function GEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:LJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var LJ,zJ,UJ=y(()=>{"use strict";Ue();LJ="AC_DUPLICATE_WITHIN_FEATURE";zJ={name:LJ,run:GEe}});import{createRequire as ZEe}from"module";import{basename as VEe,dirname as NP,normalize as WEe,relative as KEe,resolve as JEe,sep as HJ}from"path";import*as YEe from"fs";function XEe(t){let e=WEe(t);return e.length>1&&e[e.length-1]===HJ&&(e=e.substring(0,e.length-1)),e}function GJ(t,e){return t.replace(QEe,e)}function tAe(t){return t==="/"||eAe.test(t)}function DP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=JEe(t)),(n||o)&&(t=XEe(t)),t===".")return"";let s=t[t.length-1]!==i;return GJ(s?t+i:t,i)}function ZJ(t,e){return e+t}function rAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:GJ(KEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function nAe(t){return t}function iAe(t,e,r){return e+t+r}function oAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?rAe(t,e):n?ZJ:nAe}function sAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function aAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function dAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?aAe(t):sAe(t):n&&n.length?lAe:cAe:uAe}function yAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?gAe:r&&r.length?n?fAe:pAe:n?mAe:hAe}function vAe(t){return t.group?bAe:_Ae}function xAe(t){return t.group?SAe:wAe}function EAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?kAe:$Ae}function VJ(t,e,r){if(r.options.useRealPaths)return AAe(e,r);let n=NP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=NP(n)}return r.symlinks.set(t,e),i>1}function AAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function zv(t,e,r,n){e(t&&!n?t:null,r)}function jAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?TAe:PAe:n?e?OAe:NAe:i?e?IAe:DAe:e?RAe:CAe}function LAe(t){return t?FAe:MAe}function BAe(t,e){return new Promise((r,n)=>{JJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function JJ(t,e,r){new KJ(t,e,r).start()}function HAe(t,e){return new KJ(t,e).start()}var qJ,QEe,eAe,cAe,lAe,uAe,fAe,pAe,mAe,hAe,gAe,_Ae,bAe,SAe,wAe,$Ae,kAe,TAe,OAe,RAe,IAe,PAe,CAe,DAe,NAe,WJ,MAe,FAe,zAe,UAe,qAe,KJ,BJ,YJ,XJ,QJ=y(()=>{qJ=ZEe(import.meta.url);QEe=/[\\/]/g;eAe=/^[a-z]:[\\/]$/i;cAe=(t,e)=>{e.push(t||".")},lAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},uAe=()=>{};fAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},pAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},mAe=(t,e,r,n)=>{r.files++},hAe=(t,e)=>{e.push(t)},gAe=()=>{};_Ae=t=>t,bAe=()=>[""].slice(0,0);SAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},wAe=()=>{};$Ae=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&VJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},kAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&VJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};TAe=t=>t.counts,OAe=t=>t.groups,RAe=t=>t.paths,IAe=t=>t.paths.slice(0,t.options.maxFiles),PAe=(t,e,r)=>(zv(e,r,t.counts,t.options.suppressErrors),null),CAe=(t,e,r)=>(zv(e,r,t.paths,t.options.suppressErrors),null),DAe=(t,e,r)=>(zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),NAe=(t,e,r)=>(zv(e,r,t.groups,t.options.suppressErrors),null);WJ={withFileTypes:!0},MAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",WJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},FAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",WJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};zAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},UAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},qAe=class{aborted=!1;abort(){this.aborted=!0}},KJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=jAe(e,this.isSynchronous),this.root=DP(t,e),this.state={root:tAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new UAe,options:e,queue:new zAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new qAe,fs:e.fs||YEe},this.joinPath=oAe(this.root,e),this.pushDirectory=dAe(this.root,e),this.pushFile=yAe(e),this.getArray=vAe(e),this.groupFiles=xAe(e),this.resolveSymlink=EAe(e,this.isSynchronous),this.walkDirectory=LAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=DP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=VEe(_),x=DP(NP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};BJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return BAe(this.root,this.options)}withCallback(t){JJ(this.root,this.options,t)}sync(){return HAe(this.root,this.options)}},YJ=null;try{qJ.resolve("picomatch"),YJ=qJ("picomatch")}catch{}XJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:HJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new BJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new BJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||YJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var bp=v((Sdt,i8)=>{"use strict";var e8="[^\\\\/]",GAe="(?=.)",t8="[^/]",jP="(?:\\/|$)",r8="(?:^|\\/)",MP=`\\.{1,2}${jP}`,ZAe="(?!\\.)",VAe=`(?!${r8}${MP})`,WAe=`(?!\\.{0,1}${jP})`,KAe=`(?!${MP})`,JAe="[^.\\/]",YAe=`${t8}*?`,XAe="/",n8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:GAe,QMARK:t8,END_ANCHOR:jP,DOTS_SLASH:MP,NO_DOT:ZAe,NO_DOTS:VAe,NO_DOT_SLASH:WAe,NO_DOTS_SLASH:KAe,QMARK_NO_DOT:JAe,STAR:YAe,START_ANCHOR:r8,SEP:XAe},QAe={...n8,SLASH_LITERAL:"[\\\\/]",QMARK:e8,STAR:`${e8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},eTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};i8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:eTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?QAe:n8}}});var vp=v(Lr=>{"use strict";var{REGEX_BACKSLASH:tTe,REGEX_REMOVE_BACKSLASH:rTe,REGEX_SPECIAL_CHARS:nTe,REGEX_SPECIAL_CHARS_GLOBAL:iTe}=bp();Lr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Lr.hasRegexChars=t=>nTe.test(t);Lr.isRegexChar=t=>t.length===1&&Lr.hasRegexChars(t);Lr.escapeRegex=t=>t.replace(iTe,"\\$1");Lr.toPosixSlashes=t=>t.replace(tTe,"/");Lr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Lr.removeBackslashes=t=>t.replace(rTe,e=>e==="\\"?"":e);Lr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Lr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Lr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Lr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Lr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var f8=v((xdt,d8)=>{"use strict";var o8=vp(),{CHAR_ASTERISK:FP,CHAR_AT:oTe,CHAR_BACKWARD_SLASH:Sp,CHAR_COMMA:sTe,CHAR_DOT:LP,CHAR_EXCLAMATION_MARK:zP,CHAR_FORWARD_SLASH:u8,CHAR_LEFT_CURLY_BRACE:UP,CHAR_LEFT_PARENTHESES:qP,CHAR_LEFT_SQUARE_BRACKET:aTe,CHAR_PLUS:cTe,CHAR_QUESTION_MARK:s8,CHAR_RIGHT_CURLY_BRACE:lTe,CHAR_RIGHT_PARENTHESES:a8,CHAR_RIGHT_SQUARE_BRACKET:uTe}=bp(),c8=t=>t===u8||t===Sp,l8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},dTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&c8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=o8.removeBackslashes(P)),xe&&_===!0&&(xe=o8.removeBackslashes(xe)));let Pr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,c8(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var wp=bp(),cn=vp(),{MAX_LENGTH:Uv,POSIX_REGEX_SOURCE:fTe,REGEX_NON_SPECIAL_CHARS:pTe,REGEX_SPECIAL_CHARS_BACKREF:mTe,REPLACEMENTS:p8}=wp,hTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>cn.escapeRegex(i)).join("..")}return r},Zl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,m8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},gTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},h8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(gTe(e))return e.replace(/\\(.)/g,"$1")},yTe=t=>{let e=t.map(h8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},_Te=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=h8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?cn.escapeRegex(r[0]):`[${r.map(i=>cn.escapeRegex(i)).join("")}]`}*`},bTe=t=>{let e=0,r=t.trim(),n=BP(r);for(;n;)e++,r=n.body.trim(),n=BP(r);return e},vTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:wp.DEFAULT_MAX_EXTGLOB_RECURSION,n=m8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||yTe(n)))return{risky:!0};for(let i of n){let o=_Te(i);if(o)return{risky:!0,safeOutput:o};if(bTe(i)>r)return{risky:!0}}return{risky:!1}},HP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=p8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=wp.globChars(r.windows),l=wp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=cn.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Pr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},lo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},$i=H=>{$[H]++,xe.push(H)},Qr=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},uo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;$i("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Wde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=vTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,ki=s[H.tokensIndex];ki.type="text",ki.value=ht,ki.output=lt||cn.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let ki=HP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${ki})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Qr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(mTe,(B,Oe,ut,zt,lt,ki)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):ki===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=cn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=fTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=cn.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){$i("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Zl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Wde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Qr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Zl("closing","]"));P=`\\${P}`}else $i("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Zl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Qr("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||cn.hasRegexChars(B))continue;let Oe=cn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){$i("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=hTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Qr("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){uo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){lo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=pTe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){uo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),ki=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!ki){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ei=t[$.index+4];if(Ei&&Ei!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Pr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Pr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ei=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ei})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zl("closing","]"));$.output=cn.escapeLast($.output,"["),Qr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zl("closing",")"));$.output=cn.escapeLast($.output,"("),Qr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zl("closing","}"));$.output=cn.escapeLast($.output,"{"),Qr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};HP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=p8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=wp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=cn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};g8.exports=HP});var v8=v((kdt,b8)=>{"use strict";var STe=f8(),GP=y8(),_8=vp(),wTe=bp(),xTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=xTe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?_8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(_8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):GP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>STe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=GP.fastpaths(t,e)),i.output||(i=GP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=wTe;b8.exports=Rt});var $8=v((Edt,x8)=>{"use strict";var S8=v8(),$Te=vp();function w8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:$Te.isWindows()}),S8(t,e,r)}Object.assign(w8,S8);x8.exports=w8});import{readdir as kTe,readdirSync as ETe,realpath as ATe,realpathSync as TTe,stat as OTe,statSync as RTe}from"fs";import{isAbsolute as ITe,posix as Ha,resolve as PTe}from"path";import{fileURLToPath as CTe}from"url";function jTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&NTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function LTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function T8(t){var e;let r=Vl.default.scan(t,zTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ZTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Vl.default.scan(t);return r.isGlob||r.negated}function xp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function O8(t){return typeof t=="string"?[t]:t??[]}function ZP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=GTe(o);s=ITe(s.replace(WTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=VTe.exec(s))===null||i===void 0?void 0:i[0],l=T8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ha.join(o,...d):o}return s}function KTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(ZP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(ZP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(ZP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function JTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=KTe(t,e,n);t.debug&&xp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(E8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Vl.default)(i.match,f),m=(0,Vl.default)(i.ignore,f),h=jTe(i.match,f),g=k8(r,d,o),b=o?g:k8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new XJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&xp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return xp(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&xp("internal properties:",{...n,root:d}),[x,r!==d&&!o&<e(r,d)]}function YTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function QTe(t){let e={...XTe,...t};return e.cwd=(e.cwd instanceof URL?CTe(e.cwd):PTe(e.cwd)).replace(E8,"/"),e.ignore=O8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||kTe,readdirSync:e.fs.readdirSync||ETe,realpath:e.fs.realpath||ATe,realpathSync:e.fs.realpathSync||TTe,stat:e.fs.stat||OTe,statSync:e.fs.statSync||RTe}),e.debug&&xp("globbing with options:",e),e}function eOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=DTe(t)||typeof t=="string",i=O8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=QTe(n?e:t);return i.length>0?JTe(o,i):[]}function _s(t,e){let[r,n]=eOe(t,e);return r?YTe(r.sync(),n):[]}var Vl,DTe,E8,A8,NTe,MTe,FTe,zTe,UTe,qTe,BTe,HTe,GTe,VTe,WTe,XTe,$p=y(()=>{QJ();Vl=St($8(),1),DTe=Array.isArray,E8=/\\/g,A8=process.platform==="win32",NTe=/^(\/?\.\.)+$/;MTe=/^[A-Z]:\/$/i,FTe=A8?t=>MTe.test(t):t=>t==="/";zTe={parts:!0};UTe=/(?t.replace(UTe,"\\$&"),HTe=t=>t.replace(qTe,"\\$&"),GTe=A8?HTe:BTe;VTe=/^(\/?\.\.)+/,WTe=/\\(?=[()[\]{}!*+?@|])/g;XTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as kp,readFileSync as tOe,readdirSync as rOe,statSync as R8}from"node:fs";import{join as Ga}from"node:path";function nOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Fi(e,n),o=[],{layers:s,forbiddenImports:a}=VP(r);return(s.size>0||a.length>0)&&!kp(Ga(e,i.mainRoot))?[{detector:Ep,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(iOe(e,i,s,o),oOe(e,i,s,o)),a.length>0&&sOe(e,i,a,o),o)}function VP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function iOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of rOe(o)){let a=Ga(o,s);R8(a).isDirectory()&&(r.has(s)||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function oOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of r){let a=Ga(o,s);kp(a)&&R8(a).isDirectory()||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function sOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!kp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=tOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];aOe(p,s.to,e.importStyle)&&n.push({detector:Ep,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function aOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ep,I8,WP=y(()=>{"use strict";$p();Ue();Ba();Ep="ARCHITECTURE_FROM_SPEC";I8={name:Ep,run:nOe}});import{existsSync as cOe,readFileSync as lOe}from"node:fs";import{join as uOe}from"node:path";function fOe(t){let{cwd:e="."}=t,r=uOe(e,"spec/capabilities.yaml");if(!cOe(r))return[];let n;try{let u=lOe(r,"utf8"),d=P8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";P8=St(er(),1);Ue();qv="CAPABILITIES_FEATURE_MAPPING",dOe=8;C8={name:qv,run:fOe}});import{existsSync as pOe,readFileSync as mOe}from"node:fs";import{join as hOe}from"node:path";function gOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function yOe(t){let{cwd:e="."}=t;return ge(e,KP,r=>_Oe(r,e))}function _Oe(t,e){let r=Fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=hOe(e,o);if(!pOe(s))continue;let a=mOe(s,"utf8");gOe(a)||n.push({detector:KP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var KP,N8,j8=y(()=>{"use strict";Ba();wt();KP="CONVENTION_DRIFT";N8={name:KP,run:yOe}});import{existsSync as JP,readFileSync as M8}from"node:fs";import{join as Bv}from"node:path";function bOe(t){return JSON.parse(t).total?.lines?.pct??0}function F8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function wOe(t,e){if(!Av(dt(t).gates.coverage?.cmd))return null;let r;try{r=Tv(t,e)}catch(c){return[{detector:$o,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=AP.find(d=>JP(Bv(c.dir,d)));if(!l){s.push(c.path);continue}let u=F8(M8(Bv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:$o,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=L8(n,i);return a0?[{detector:$o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function xOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=wOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Fi(e,r),i=dt(e).language==="kotlin"?AP.find(a=>JP(Bv(e,a)))??vJ(e):n.coverageSummary,o=Bv(e,i);if(!JP(o))return[{detector:$o,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=M8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?vOe(a):n.coverageFormat==="cobertura-xml"?SOe(a):bOe(a)}catch(a){return[{detector:$o,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:$o,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Hv?[]:[{detector:$o,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Hv}%`}]}var $o,Hv,z8,U8=y(()=>{"use strict";Ue();Iv();Ba();Ov();an();$o="COVERAGE_DROP",Hv=70;z8={name:$o,run:xOe}});import{existsSync as $Oe}from"node:fs";import{join as kOe}from"node:path";function AOe(t){let{cwd:e="."}=t;return ge(e,Gv,r=>TOe(r,e))}function TOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Gv="DELIVERABLE_INTEGRITY",EOe=8;q8={name:Gv,run:AOe}});function OOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Zv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function ROe(t){let e=OOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Zv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function IOe(t){let{cwd:e="."}=t;return ge(e,Zv,r=>ROe(r))}var Zv,H8,G8=y(()=>{"use strict";wt();Zv="SMOKE_PROBE_DEMAND";H8={name:Zv,run:IOe}});function POe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>COe(r,e))}function COe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=cs(e);if(n===null)return[{detector:Vv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=V_(n,e,o);s.state!=="fresh"&&i.push({detector:Vv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Vv,Wv,YP=y(()=>{"use strict";wl();wt();Vv="STALE_ATTESTATION";Wv={name:Vv,run:POe}});function DOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return NOe(r)}function NOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:Z8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var Z8,Kv,XP=y(()=>{"use strict";Ue();Z8="DEPENDENCY_CYCLE";Kv={name:Z8,run:DOe}});import{appendFileSync as jOe,existsSync as V8,mkdirSync as MOe,readFileSync as FOe}from"node:fs";import{dirname as LOe,join as zOe}from"node:path";function W8(t){return zOe(t,UOe,qOe)}function K8(t){return QP.add(t),()=>QP.delete(t)}function Za(t,e){let r=W8(t),n=LOe(r);V8(n)||MOe(n,{recursive:!0}),jOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of QP)try{i(t,e)}catch{}}function fr(t){let e=W8(t);if(!V8(e))return[];let r=FOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var UOe,qOe,QP,ln=y(()=>{"use strict";UOe=".cladding",qOe="audit.log.jsonl";QP=new Set});import{existsSync as BOe}from"node:fs";import{join as HOe}from"node:path";function GOe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:eC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(BOe(HOe(e,i.artifact))||n.push({detector:eC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var eC,J8,Y8=y(()=>{"use strict";ln();eC="EVIDENCE_MISMATCH";J8={name:eC,run:GOe}});import{existsSync as ZOe,readFileSync as VOe}from"node:fs";import{join as WOe}from"node:path";function KOe(t){let e=WOe(t,t5);if(!ZOe(e))return null;try{let n=((0,e5.parse)(VOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*Q8(t,e){for(let r of t??[])r.startsWith(X8)&&(yield{ref:r,name:r.slice(X8.length),field:e})}function JOe(t){let{cwd:e="."}=t,r=KOe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:tC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...Q8(s.evidence_refs,"evidence_refs"),...Q8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:tC,severity:"warn",path:t5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var e5,tC,X8,t5,r5,n5=y(()=>{"use strict";e5=St(er(),1);Ue();tC="FIXTURE_REFERENCE_INVALID",X8="fixture:",t5="conformance/fixtures.yaml";r5={name:tC,run:JOe}});import{existsSync as Wl,readFileSync as rC}from"node:fs";import{join as Va}from"node:path";function YOe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Ap(t){if(!Wl(t))return null;try{return JSON.parse(rC(t,"utf8"))}catch{return null}}function XOe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(rC(r,"utf8"))}catch(c){e.push({detector:ko,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:ko,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=YOe(t);s!==a&&e.push({detector:ko,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function QOe(t,e){for(let r of i5){let n=Va(t,r.path);if(!Wl(n))continue;let i=Ap(n);if(!i){e.push({detector:ko,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:ko,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function eRe(t,e){let r=Ap(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of i5){let s=Va(t,o.path);if(!Wl(s))continue;let a=Ap(s);a?.version&&a.version!==n&&e.push({detector:ko,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(Wl(i)){let o=Ap(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:ko,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function tRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function rRe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Wl(r)||!Wl(n))return;let i=tRe(rC(r,"utf8"));if(i.length===0)return;let s=Ap(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:ko,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function nRe(t){let{cwd:e="."}=t,r=[];return XOe(e,r),rRe(e,r),QOe(e,r),eRe(e,r),r}var ko,i5,o5,s5=y(()=>{"use strict";$p();ko="HARNESS_INTEGRITY",i5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];o5={name:ko,run:nRe}});import{existsSync as iRe,readFileSync as oRe}from"node:fs";import{join as sRe}from"node:path";function cRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>uRe(r,e))}function lRe(t){let e=sRe(t,"spec/capabilities.yaml");if(!iRe(e))return!1;try{let r=a5.default.parse(oRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function uRe(t,e){let r=t.features.length;if(r{"use strict";a5=St(er(),1);wt();Jv="HOLLOW_GOVERNANCE",aRe=8;c5={name:Jv,run:cRe}});import{existsSync as u5,readFileSync as d5}from"node:fs";import{join as f5}from"node:path";function p5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function pRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function mRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function hRe(t){let e=f5(t,"README.md"),r=f5(t,"docs","dogfood","matrix.md");if(!u5(e)||!u5(r))return[];let n=p5(d5(e,"utf8"),dRe),i=p5(d5(r,"utf8"),fRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=mRe(a);if(c===null)continue;let l=i[s]??"not-run",u=pRe(l);u!==null&&c>u&&o.push({detector:m5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function gRe(t){let{cwd:e="."}=t;return hRe(e)}var m5,dRe,fRe,h5,g5=y(()=>{"use strict";m5="HOST_CLAIM_DRIFT",dRe=//,fRe=//;h5={name:m5,run:gRe}});function yRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return y5(r.features.map(i=>i.id),"feature","spec/features/",n),y5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function y5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:_5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var _5,b5,v5=y(()=>{"use strict";Ue();_5="ID_COLLISION";b5={name:_5,run:yRe}});import{existsSync as Tp,readFileSync as nC,readdirSync as iC,statSync as _Re,writeFileSync as w5}from"node:fs";import{join as Eo}from"node:path";function S5(t){if(!Tp(t))return 0;try{return iC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function bRe(t){if(!Tp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=iC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Eo(n,o),a;try{a=_Re(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function vRe(t){let e=Eo(t,"spec","capabilities.yaml");if(!Tp(e))return 0;try{let r=Yv.default.parse(nC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=S5(Eo(t,"spec","features")),r=S5(Eo(t,"spec","scenarios")),n=vRe(t),i=bRe(Eo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Kl(t,e){let r=Eo(t,"spec.yaml");if(!Tp(r))return;let n=nC(r,"utf8"),i=SRe(n,e);i!==n&&w5(r,i)}function SRe(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`],s=d=>r===`\r @@ -270,51 +271,51 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function Wa(t="."){let e=Eo(t,"spec","features");if(!kp(e))return!1;let r=[];for(let i of eC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Wv.parse)(QP(Eo(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function Wa(t="."){let e=Eo(t,"spec","features");if(!Tp(e))return!1;let r=[];for(let i of iC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Yv.parse)(nC(Eo(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return m5(Eo(t,"spec","index.yaml"),n,"utf8"),!0}var Wv,Ep=y(()=>{"use strict";Wv=St(er(),1)});import{existsSync as h5,readFileSync as g5,readdirSync as uRe}from"node:fs";import{join as tC}from"node:path";function dRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=_s(e),i=r.inventory;if(!i){let s=y5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return rC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...rC(e),{detector:Ap,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of y5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Ap,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...rC(e)),o}function rC(t){let e=tC(t,"spec","index.yaml"),r=tC(t,"spec","features");if(!h5(e)||!h5(r))return[];let n=new Map;try{for(let l of g5(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of uRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=g5(tC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Ap,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Ap,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Ap,y5,_5,b5=y(()=>{"use strict";Ep();Ue();Ap="INVENTORY_DRIFT",y5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];_5={name:Ap,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function gRe(t){let{cwd:e="."}=t,r=mRe(e,"src","spec","schema.json"),n=[];if(fRe(r)){let i;try{i=JSON.parse(pRe(r,"utf8"))}catch(o){n.push({detector:Tp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of hRe)i.required?.includes(o)||n.push({detector:Tp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Tp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==v5&&n.push({detector:Tp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${v5}'`})}catch{}return n}var Tp,hRe,v5,S5,w5=y(()=>{"use strict";Ue();Tp="META_INTEGRITY",hRe=["schema","project","features"],v5="0.1";S5={name:Tp,run:gRe}});function yRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return x5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),x5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function x5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:$5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var $5,k5,E5=y(()=>{"use strict";Ue();$5="SLUG_CONFLICT";k5={name:$5,run:yRe}});function Wl(t){return t==="planned"||t==="in_progress"}var Kv=y(()=>{"use strict"});import{existsSync as _Re}from"node:fs";import{join as bRe}from"node:path";function vRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>SRe(r,e))}function SRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=bRe(e,i);_Re(o)||r.push(wRe(n.id,i,n.status))}return r}function wRe(t,e,r){return Wl(r)?{detector:Jv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Jv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Jv,Yv,nC=y(()=>{"use strict";Kv();wt();Jv="MISSING_IMPLEMENTATION";Yv={name:Jv,run:vRe}});function xRe(t){let{cwd:e="."}=t;return ge(e,iC,$Re)}function $Re(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:iC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var iC,Xv,oC=y(()=>{"use strict";wt();iC="MISSING_TESTS";Xv={name:iC,run:xRe}});import{existsSync as kRe,readFileSync as ERe}from"node:fs";import{join as A5}from"node:path";function T5(t){if(kRe(t))try{return JSON.parse(ERe(t,"utf8"))}catch{return}}function RRe(t){let{cwd:e="."}=t,r=T5(A5(e,ARe)),n=T5(A5(e,TRe));if(!r||!n)return[{detector:sC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>ORe&&i.push({detector:sC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var sC,ARe,TRe,ORe,O5,R5=y(()=>{"use strict";sC="PERFORMANCE_DRIFT",ARe="perf/baseline.json",TRe="perf/current.json",ORe=10;O5={name:sC,run:RRe}});import{existsSync as IRe}from"node:fs";import{join as PRe}from"node:path";function DRe(t){let{cwd:e="."}=t;return ge(e,aC,r=>jRe(r,e))}function NRe(t,e){return(t.modules??[]).some(r=>IRe(PRe(e,r)))}function jRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||NRe(s,e)||r.push(s.id);let n=CRe;if(r.length<=n)return[];let i=r.slice(0,I5).join(", "),o=r.length>I5?", \u2026":"";return[{detector:aC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var aC,CRe,I5,P5,C5=y(()=>{"use strict";wt();aC="PLANNED_BACKLOG",CRe=5,I5=8;P5={name:aC,run:DRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function qRe(t){let{cwd:e="."}=t;return ge(e,cC,r=>BRe(r,e))}function BRe(t,e){if(t.features.lengthn.includes(i))?[{detector:cC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var cC,zRe,URe,D5,N5=y(()=>{"use strict";wt();cC="PROJECT_CONTEXT_DRIFT",zRe=8,URe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];D5={name:cC,run:qRe}});function j5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Qv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function HRe(t){let{cwd:e="."}=t;return ge(e,Qv,GRe)}function GRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...j5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Qv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...j5(e,n.features,`scenario ${n.id}.features`));return r}var Qv,eS,lC=y(()=>{"use strict";wt();Qv="REFERENCE_INTEGRITY";eS={name:Qv,run:HRe}});function Op(t=""){return new RegExp(ZRe,t)}var ZRe,uC=y(()=>{"use strict";ZRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as VRe,readdirSync as WRe,readFileSync as KRe,statSync as JRe,writeFileSync as YRe}from"node:fs";import{dirname as XRe,join as Rp,normalize as QRe,relative as eIe}from"node:path";function oIe(t){let e=[];for(let r of t.matchAll(iIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Op("g"))??[])e.push(n);return[...new Set(e)].sort()}function sIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function M5(t){return t.split("\\").join("/")}function aIe(t){return tIe.some(e=>t===e||t.startsWith(`${e}/`))}function cIe(t){let e=Rp(t,"docs");if(!VRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=WRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Rp(i,s),c;try{c=JRe(a)}catch{continue}let l=M5(eIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function lIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=QRe(Rp(XRe(t),e));return M5(r)}function Ip(t="."){let e=[];for(let r of cIe(t)){let n;try{n=KRe(Rp(t,r),"utf8")}catch{continue}let i=sIe(n),o=oIe(i);if(aIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(rIe)?[]:i.match(Op("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(nIe)){let d=lIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function F5(t="."){let e=Ip(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return YRe(Rp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return w5(Eo(t,"spec","index.yaml"),n,"utf8"),!0}var Yv,Op=y(()=>{"use strict";Yv=St(er(),1)});import{existsSync as x5,readFileSync as $5,readdirSync as wRe}from"node:fs";import{join as oC}from"node:path";function xRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=k5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return sC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...sC(e),{detector:Rp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of k5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Rp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...sC(e)),o}function sC(t){let e=oC(t,"spec","index.yaml"),r=oC(t,"spec","features");if(!x5(e)||!x5(r))return[];let n=new Map;try{for(let l of $5(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of wRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=$5(oC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Rp,k5,E5,A5=y(()=>{"use strict";Op();Ue();Rp="INVENTORY_DRIFT",k5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];E5={name:Rp,run:xRe}});import{existsSync as $Re,readFileSync as kRe}from"node:fs";import{join as ERe}from"node:path";function TRe(t){let{cwd:e="."}=t,r=ERe(e,"src","spec","schema.json"),n=[];if($Re(r)){let i;try{i=JSON.parse(kRe(r,"utf8"))}catch(o){n.push({detector:Ip,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of ARe)i.required?.includes(o)||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==T5&&n.push({detector:Ip,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${T5}'`})}catch{}return n}var Ip,ARe,T5,O5,R5=y(()=>{"use strict";Ue();Ip="META_INTEGRITY",ARe=["schema","project","features"],T5="0.1";O5={name:Ip,run:TRe}});function ORe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return I5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),I5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function I5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:P5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var P5,C5,D5=y(()=>{"use strict";Ue();P5="SLUG_CONFLICT";C5={name:P5,run:ORe}});function Jl(t){return t==="planned"||t==="in_progress"}var Xv=y(()=>{"use strict"});import{existsSync as RRe}from"node:fs";import{join as IRe}from"node:path";function PRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>CRe(r,e))}function CRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=IRe(e,i);RRe(o)||r.push(DRe(n.id,i,n.status))}return r}function DRe(t,e,r){return Jl(r)?{detector:Qv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Qv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Qv,eS,aC=y(()=>{"use strict";Xv();wt();Qv="MISSING_IMPLEMENTATION";eS={name:Qv,run:PRe}});function NRe(t){let{cwd:e="."}=t;return ge(e,cC,jRe)}function jRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:cC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var cC,tS,lC=y(()=>{"use strict";wt();cC="MISSING_TESTS";tS={name:cC,run:NRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as N5}from"node:path";function j5(t){if(MRe(t))try{return JSON.parse(FRe(t,"utf8"))}catch{return}}function qRe(t){let{cwd:e="."}=t,r=j5(N5(e,LRe)),n=j5(N5(e,zRe));if(!r||!n)return[{detector:uC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>URe&&i.push({detector:uC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var uC,LRe,zRe,URe,M5,F5=y(()=>{"use strict";uC="PERFORMANCE_DRIFT",LRe="perf/baseline.json",zRe="perf/current.json",URe=10;M5={name:uC,run:qRe}});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function ZRe(t){let{cwd:e="."}=t;return ge(e,dC,r=>WRe(r,e))}function VRe(t,e){return(t.modules??[]).some(r=>BRe(HRe(e,r)))}function WRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||VRe(s,e)||r.push(s.id);let n=GRe;if(r.length<=n)return[];let i=r.slice(0,L5).join(", "),o=r.length>L5?", \u2026":"";return[{detector:dC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var dC,GRe,L5,z5,U5=y(()=>{"use strict";wt();dC="PLANNED_BACKLOG",GRe=5,L5=8;z5={name:dC,run:ZRe}});import{existsSync as KRe,readFileSync as JRe}from"node:fs";import{join as YRe}from"node:path";function eIe(t){let{cwd:e="."}=t;return ge(e,fC,r=>tIe(r,e))}function tIe(t,e){if(t.features.lengthn.includes(i))?[{detector:fC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var fC,XRe,QRe,q5,B5=y(()=>{"use strict";wt();fC="PROJECT_CONTEXT_DRIFT",XRe=8,QRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];q5={name:fC,run:eIe}});function H5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:rS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function rIe(t){let{cwd:e="."}=t;return ge(e,rS,nIe)}function nIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...H5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:rS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...H5(e,n.features,`scenario ${n.id}.features`));return r}var rS,nS,pC=y(()=>{"use strict";wt();rS="REFERENCE_INTEGRITY";nS={name:rS,run:rIe}});function Pp(t=""){return new RegExp(iIe,t)}var iIe,mC=y(()=>{"use strict";iIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as oIe,readdirSync as sIe,readFileSync as aIe,statSync as cIe,writeFileSync as lIe}from"node:fs";import{dirname as uIe,join as Cp,normalize as dIe,relative as fIe}from"node:path";function yIe(t){let e=[];for(let r of t.matchAll(gIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Pp("g"))??[])e.push(n);return[...new Set(e)].sort()}function _Ie(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function G5(t){return t.split("\\").join("/")}function bIe(t){return pIe.some(e=>t===e||t.startsWith(`${e}/`))}function vIe(t){let e=Cp(t,"docs");if(!oIe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=sIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Cp(i,s),c;try{c=cIe(a)}catch{continue}let l=G5(fIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function SIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=dIe(Cp(uIe(t),e));return G5(r)}function Dp(t="."){let e=[];for(let r of vIe(t)){let n;try{n=aIe(Cp(t,r),"utf8")}catch{continue}let i=_Ie(n),o=yIe(i);if(bIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(mIe)?[]:i.match(Pp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(hIe)){let d=SIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function Z5(t="."){let e=Dp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return lIe(Cp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var tIe,rIe,nIe,iIe,tS=y(()=>{"use strict";uC();tIe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],rIe="clad-doc-links: ignore",nIe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,iIe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as uIe}from"node:fs";import{join as dIe}from"node:path";function fIe(t){let{cwd:e="."}=t;return ge(e,rS,r=>pIe(r,e))}function pIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Ip(e).docs){for(let o of i.doc_links)uIe(dIe(e,o))||n.push({detector:rS,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:rS,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var rS,nS,dC=y(()=>{"use strict";tS();wt();rS="DOC_LINK_INTEGRITY";nS={name:rS,run:fIe}});function mIe(t){let{cwd:e="."}=t;return ge(e,Pp,r=>hIe(r))}function hIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=L5,o=t.project.onboarding_seeded===!0&&!i;r>=L5&&n.length===0&&e.push({detector:Pp,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let a of n)(a.features??[]).length===0&&e.push({detector:Pp,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Pp,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Pp,L5,z5,U5=y(()=>{"use strict";wt();Pp="SCENARIO_COVERAGE",L5=8;z5={name:Pp,run:mIe}});import{createHash as gIe}from"node:crypto";function yIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Cp(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??q5),sample:yIe(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(q5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Dp(t){return(t.features??[]).filter(e=>e.status==="done").length}function _Ie(t,e){return e<=0?!1:e>=1?!0:parseInt(gIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var q5,iS=y(()=>{"use strict";q5=["unwanted"]});import{chmodSync as bIe,existsSync as H5,readFileSync as vIe,readdirSync as SIe,statSync as G5,unlinkSync as wIe,utimesSync as xIe,writeFileSync as $Ie}from"node:fs";import{join as Z5}from"node:path";import V5 from"node:process";function kIe(t){return nJ(t).map(e=>{try{let r=G5(e);return r.isFile()?{path:e,body:vIe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function EIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!H5(r.path))continue;if(!G5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}wIe(r.path);continue}$Ie(r.path,r.body),r.mode!==void 0&&bIe(r.path,r.mode),r.atime&&r.mtime&&xIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function AIe(t){let e=!1,r=n=>{for(let i of SIe(n,{withFileTypes:!0})){if(e)return;let o=Z5(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function fC(t={}){let{cwd:e="."}=t,r=Z5(e,bs);if(!H5(r)||!AIe(r))return{stage:Ka,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${bs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Ka,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=kIe(e)}catch(d){return{stage:Ka,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,bs];try{s=We(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=EIe(o);if(l.length>0)return{stage:Ka,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Ka,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=Nt(Ka,i.cmd,s,c);return u||Yt(Ka,s)}var Ka,bs,TIe,pC=y(()=>{"use strict";Fr();an();fp();Pn();Ka="stage_2.3",bs="tests/oracle";TIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${V5.argv[1]}`;if(TIe){let t=fC();console.log(JSON.stringify(t)),V5.exit(t.exitCode)}});import{existsSync as OIe}from"node:fs";import{join as RIe}from"node:path";function IIe(t){let{cwd:e="."}=t;return ge(e,ii,r=>PIe(r,e))}function PIe(t,e){let r=[],n=Cp(t.project,Dp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?fr(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Np(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:ii,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${bs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!OIe(RIe(e,f))){r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${bs}/`)||r.push({detector:ii,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${bs}/ \u2014 stage_2.3 only runs ${bs}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ii,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:ii,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:ii,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var ii,W5,K5=y(()=>{"use strict";ln();iS();pC();wt();ii="SPEC_CONFORMANCE";W5={name:ii,run:IIe}});function CIe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:mC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>J5&&i.push({detector:mC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${J5})`})}return i}var mC,J5,Y5,X5=y(()=>{"use strict";ln();mC="STALE_EVIDENCE",J5=90;Y5={name:mC,run:CIe}});import{existsSync as Q5}from"node:fs";import{join as eY}from"node:path";function DIe(t){let{cwd:e="."}=t;return ge(e,Kl,r=>NIe(r,e))}function NIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Kl,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Kl,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>Q5(eY(e,o)));i.length>0&&r.push({detector:Kl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Wl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>Q5(eY(e,i)))&&r.push({detector:Kl,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var Kl,oS,hC=y(()=>{"use strict";Kv();wt();Kl="STALE_SPECIFICATION";oS={name:Kl,run:DIe}});import{existsSync as tY,statSync as rY}from"node:fs";import{join as nY}from"node:path";function MIe(t,e){let r=0;for(let n of e){let i=nY(t,n);if(!tY(i))continue;let o=rY(i).mtimeMs;o>r&&(r=o)}return r}function FIe(t){let{cwd:e="."}=t;return ge(e,gC,r=>LIe(r,e))}function LIe(t,e){let r=Fi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=MIe(e,n);if(i===0)return[];let o=ys([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=nY(e,a);if(!tY(c))continue;let l=rY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>jIe&&s.push({detector:gC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var gC,jIe,sS,yC=y(()=>{"use strict";Sp();Ba();wt();gC="STALE_TESTS",jIe=30;sS={name:gC,run:FIe}});import{existsSync as zIe}from"node:fs";import{join as UIe}from"node:path";function qIe(t){let{cwd:e="."}=t;return ge(e,jp,r=>BIe(r,e))}function BIe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:jp,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!zIe(UIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:jp,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:jp,severity:Wl(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var jp,aS,_C=y(()=>{"use strict";Kv();wt();jp="STATUS_DRIFT";aS={name:jp,run:qIe}});function HIe(t){let{cwd:e="."}=t;return ge(e,cS,r=>GIe(r,e))}function GIe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:cS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:cS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var cS,iY,oY=y(()=>{"use strict";an();wt();cS="TECH_STACK_MISMATCH";iY={name:cS,run:HIe}});function KIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function JIe(t){let{cwd:e="."}=t;return ge(e,bC,r=>YIe(r,e))}function YIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ys([...KIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:bC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var bC,sY,ZIe,VIe,WIe,lS,vC=y(()=>{"use strict";Sp();HP();wt();bC="UNMAPPED_ARTIFACT",sY=["src/stages/**/*.ts","src/spec/**/*.ts"],ZIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},VIe={kotlin:"src/main/kotlin"},WIe=8;lS={name:bC,run:JIe}});import{existsSync as aY}from"node:fs";import{join as cY}from"node:path";function QIe(t){return XIe.some(e=>t.startsWith(e))}function ePe(t){let{cwd:e="."}=t;return ge(e,SC,r=>tPe(r,e))}function tPe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(QIe(o))continue;let s=o.split("#",1)[0];aY(cY(e,o))||s&&aY(cY(e,s))||r.push({detector:SC,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`}function Lx(t){return`${JSON.stringify(t,null,2)} +`}function hte(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${dte(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(fte);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(fte);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${dte(s)}.md`,`${a.join(` +`)}`)}return o}function fte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as sqe}from"node:fs";import{dirname as aqe,join as Rj}from"node:path";import{fileURLToPath as cqe}from"node:url";var Ij=aqe(cqe(import.meta.url));function gte(t){for(let e of[Rj(Ij,"viewer",t),Rj(Ij,"..","graph","viewer",t),Rj(Ij,"..","..","dist","viewer",t)])try{return sqe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function yte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -896,21 +901,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}WP();dC();nC();oC();lC();VP();yC();_C();vC();wC();Jm();uC();Ue();var YUe=[Xv,uS,Yv,lS,eS,nS,Zv,aS,sS,Gv];function XUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Op().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Fx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of YUe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of XUe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Tj();Ue();Ii();var eqe=new Set(["mermaid","dot","json","obsidian","html"]);function dte(t={}){try{let e=t.format??"mermaid";if(!eqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=wc(n,".");if(t.focus){let s=Px(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Ix(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ate(i);for(let[c,l]of a){let u=QUe(s,c);Oj(Ij(u),{recursive:!0}),Rj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Mx(i,Fx(i,"."));Oj(Ij(t.out),{recursive:!0}),Rj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?ste(i):r==="json"?jx(i):ote(i);t.out?(Oj(Ij(t.out),{recursive:!0}),Rj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function fte(){try{let t=wc(q(),".");process.stdout.write(ute(Lx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Jm();import{createServer as tqe}from"node:http";import{existsSync as rqe,watch as nqe}from"node:fs";import{join as iqe}from"node:path";Ue();Ii();function oqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}XP();hC();aC();lC();pC();YP();SC();wC();$C();EC();Qm();mC();Ue();var lqe=[tS,pS,eS,fS,nS,sS,Kv,uS,lS,Wv];function uqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Pp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Ux(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of lqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of uqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Pj();Ue();Ii();var fqe=new Set(["mermaid","dot","json","obsidian","html"]);function bte(t={}){try{let e=t.format??"mermaid";if(!fqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=wc(n,".");if(t.focus){let s=Nx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Dx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=hte(i);for(let[c,l]of a){let u=dqe(s,c);Cj(Nj(u),{recursive:!0}),Dj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=zx(i,Ux(i,"."));Cj(Nj(t.out),{recursive:!0}),Dj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?mte(i):r==="json"?Lx(i):pte(i);t.out?(Cj(Nj(t.out),{recursive:!0}),Dj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function vte(){try{let t=wc(q(),".");process.stdout.write(_te(qx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Qm();import{createServer as pqe}from"node:http";import{existsSync as mqe,watch as hqe}from"node:fs";import{join as gqe}from"node:path";Ue();Ii();function yqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=tqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=jx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Fx(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected +`)}catch{r.delete(u)}},o=pqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=Lx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Ux(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected -`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Mx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=iqe(e,u);if(rqe(d))try{let f=nqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=zx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=gqe(e,u);if(mqe(d))try{let f=hqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function pte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await oqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var sqe=["stage_1.1","stage_2.1","stage_2.3"];function aqe(t){return(t.features??[]).filter(e=>e.status==="done")}function cqe(t,e){let r=aqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function mte(t,e){let r=[];for(let n of sqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=cqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}wS();import hte from"node:process";function lqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function zx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=lqe(n,t);i.pass||r.push(i)}return r}ln();var Pj="stage_4.1";function Cj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Pj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=zx(r);if(n.length===0)return{stage:Pj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Pj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var uqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hte.argv[1]}`;if(uqe){let t=Cj();console.log(JSON.stringify(t)),hte.exit(t.exitCode)}Sl();import{randomBytes as dqe}from"node:crypto";import{unlinkSync as fqe}from"node:fs";import{tmpdir as pqe}from"node:os";import{join as mqe,resolve as Dj}from"node:path";import hqe from"node:process";var Br=null;function gte(t){Br={cwd:Dj(t),run:null,jsonFile:null}}function Nj(){return Br!==null}function jj(t,e){if(!Br||Br.cwd!==Dj(t))return null;if(Br.run)return Br.run;let r=mqe(pqe(),`clad-shared-vitest-${hqe.pid}-${dqe(6).toString("hex")}.json`);Br.jsonFile=r;let n=e(r);return Br.run={proc:n,jsonFile:r},Br.run}function yte(t){return!Br||Br.cwd!==Dj(t)?null:Br.run}function Mj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function _te(){let t=Br?.jsonFile;if(Br=null,t)try{fqe(t)}catch{}}Fr();import bte from"node:process";var Ux="stage_1.4";function Fj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ux,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Ux,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ux,pass:!0,exitCode:0}:{stage:Ux,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var gqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bte.argv[1]}`;if(gqe){let t=Fj();console.log(JSON.stringify(t)),bte.exit(t.exitCode)}Fr();import vte from"node:process";Ym();Pn();var qx="stage_2.2";function Lj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Yi("coverage",t))}catch(c){return{stage:qx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:qx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=yte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(qx,r,s,n);return a||Yt(qx,s)}var bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vte.argv[1]}`;if(bqe){let t=Lj();console.log(JSON.stringify(t)),vte.exit(t.exitCode)}Fp();zj();Fr();an();Pn();import wte from"node:process";var Gx="stage_3.2";function Uj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Gx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bl(e,o[o.length-1]))return{stage:Gx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Gx,i,s,o);return a||Yt(Gx,s)}var Lqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wte.argv[1]}`;if(Lqe){let t=Uj();console.log(JSON.stringify(t)),wte.exit(t.exitCode)}Fr();Ue();Pn();import{existsSync as zqe}from"node:fs";import{resolve as $te}from"node:path";import kte from"node:process";var di="stage_2.4",qj=5e3,Uqe=3e4;function Bj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:di,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return Bqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:di,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:di,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=$te(e,r.path);if(!zqe(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??qj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(di,r.path,c);if(l)return l;if(c.timedOut)return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:di,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var xte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},qqe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function Bqe(t,e,r){let n=Math.min(e.length*qj,Uqe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(Hqe(t,s,r))}return Gqe(o)}function Hqe(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?$te(t,a):a,u=qj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function Gqe(t){let e="skip";for(let o of t)xte[o.disposition]>xte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${qqe[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:di,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:di,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var Zqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kte.argv[1]}`;if(Zqe){let t=Bj();console.log(JSON.stringify(t)),kte.exit(t.exitCode)}Fr();an();Pn();import Ete from"node:process";var Zx="stage_3.1";function Hj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Zx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bl(e,o[o.length-1]))return{stage:Zx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Zx,i,s,o);return a||Yt(Zx,s)}var Vqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ete.argv[1]}`;if(Vqe){let t=Hj();console.log(JSON.stringify(t)),Ete.exit(t.exitCode)}pC();Gj();Zj();Fr();Bx();import{randomBytes as e4e}from"node:crypto";import{unlinkSync as t4e}from"node:fs";import{tmpdir as r4e}from"node:os";import{join as n4e}from"node:path";import Wj from"node:process";Ym();Pn();Ue();import{readFileSync as Jqe}from"node:fs";import{resolve as Ote}from"node:path";function Yqe(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Ote(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function Xqe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function Qqe(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=Xqe(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Ote(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Vj(t,e){try{let r=Yqe(Jqe(t,"utf8"));return r?Qqe(q(e),r,e):[]}catch{return[]}}var Hr="stage_2.1";function Rte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Ite(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Pte(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function i4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Rte(n,i))return null;let o=n,s=i,a=jj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Hr,n,c,s))return null;let u=Yt(Hr,c);if(Mj(u)==="fallback")return null;if(r){let d=Vj(l,e);if(d.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Hr,pass:!0,exitCode:0}}function o4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Ite(n,i))return null;let o=n,s=i,a=jj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Hr,o,a.proc,s))return null;let c=Yt(Hr,a.proc);if(Mj(c)==="fallback")return null;if(r&&Pte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Hr,pass:!0,exitCode:0}}function Kj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Yi("test",t))}catch(d){return{stage:Hr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Hr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Rte(n,i),a=Ite(n,i),c=r&&s;if(Nj()&&s){let d=i4e(t,e,c);if(d)return d}if(Nj()&&a){let d=o4e(t,e);if(d)return d}let l,u=i;c&&(l=n4e(r4e(),`clad-vitest-${Wj.pid}-${e4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Hr,n,d,u);if(f)return f;let p=Pu("unit",Yt(Hr,d),d);if(r&&p.pass&&Pte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Vj(l,e);if(m.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{t4e(l)}catch{}}}var s4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Wj.argv[1]}`;if(s4e){let t=Kj();console.log(JSON.stringify(t)),Wj.exit(t.exitCode)}Fr();an();Pn();import Cte from"node:process";var Kx="stage_3.3";function Jj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Kx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Bl(e,o[o.length-1]))return{stage:Kx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Kx,i,s,o);return a||Yt(Kx,s)}var a4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(a4e){let t=Jj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}hC();Ff();_a();Xj();Ep();tS();var zte=St(er(),1);import{existsSync as Qj,readFileSync as _4e,readdirSync as Lte,statSync as b4e,writeFileSync as v4e}from"node:fs";import{basename as rh,join as nh,relative as Fte}from"node:path";var S4e=["self-dogfood:","fixture:","derived:"],Ute=/\.(test|spec)\.[jt]sx?$/;function qte(t,e=t,r=[]){let n;try{n=Lte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=nh(e,i);try{b4e(o).isDirectory()?qte(t,o,r):Ute.test(i)&&r.push(o)}catch{continue}}return r}function Bte(t="."){let e=nh(t,"spec","features"),r=nh(t,"tests"),n=[],i=[];if(!Qj(e)||!Qj(r))return{repaired:n,suggested:i};let o=qte(r),s=new Map;for(let a of o){let c=Fte(t,a).split("\\").join("/"),l=s.get(rh(a))??[];l.push(c),s.set(rh(a),l)}for(let a of Lte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=nh(e,a),l,u;try{l=_4e(c,"utf8"),u=(0,zte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(S4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Qj(nh(t,b)))continue;let _=s.get(rh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>rh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Fte(t,h).split("\\").join("/")).find(h=>{let g=rh(h).replace(Ute,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Ste(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await yqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var _qe=["stage_1.1","stage_2.1","stage_2.3"];function bqe(t){return(t.features??[]).filter(e=>e.status==="done")}function vqe(t,e){let r=bqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function wte(t,e){let r=[];for(let n of _qe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=vqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}kS();import xte from"node:process";function Sqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Bx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Sqe(n,t);i.pass||r.push(i)}return r}ln();var jj="stage_4.1";function Mj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:jj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Bx(r);if(n.length===0)return{stage:jj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:jj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var wqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xte.argv[1]}`;if(wqe){let t=Mj();console.log(JSON.stringify(t)),xte.exit(t.exitCode)}xl();import{randomBytes as xqe}from"node:crypto";import{unlinkSync as $qe}from"node:fs";import{tmpdir as kqe}from"node:os";import{join as Eqe,resolve as Fj}from"node:path";import Aqe from"node:process";var Br=null;function $te(t){Br={cwd:Fj(t),run:null,jsonFile:null}}function Lj(){return Br!==null}function zj(t,e){if(!Br||Br.cwd!==Fj(t))return null;if(Br.run)return Br.run;let r=Eqe(kqe(),`clad-shared-vitest-${Aqe.pid}-${xqe(6).toString("hex")}.json`);Br.jsonFile=r;let n=e(r);return Br.run={proc:n,jsonFile:r},Br.run}function kte(t){return!Br||Br.cwd!==Fj(t)?null:Br.run}function Uj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ete(){let t=Br?.jsonFile;if(Br=null,t)try{$qe(t)}catch{}}Fr();import Ate from"node:process";var Hx="stage_1.4";function qj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Hx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Hx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Hx,pass:!0,exitCode:0}:{stage:Hx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Tqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ate.argv[1]}`;if(Tqe){let t=qj();console.log(JSON.stringify(t)),Ate.exit(t.exitCode)}Fr();import Tte from"node:process";eh();Pn();var Gx="stage_2.2";function Bj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Yi("coverage",t))}catch(c){return{stage:Gx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Gx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=kte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Gx,r,s,n);return a||Yt(Gx,s)}var Iqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tte.argv[1]}`;if(Iqe){let t=Bj();console.log(JSON.stringify(t)),Tte.exit(t.exitCode)}Up();Hj();Fr();an();Pn();import Rte from"node:process";var Wx="stage_3.2";function Gj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Wx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Gl(e,o[o.length-1]))return{stage:Wx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Wx,i,s,o);return a||Yt(Wx,s)}var Yqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(Yqe){let t=Gj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Fr();Ue();Pn();import{existsSync as Xqe}from"node:fs";import{resolve as Pte}from"node:path";import Cte from"node:process";var di="stage_2.4",Zj=5e3,Qqe=3e4;function Vj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:di,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return t4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:di,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:di,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Pte(e,r.path);if(!Xqe(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Zj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(di,r.path,c);if(l)return l;if(c.timedOut)return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:di,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Ite={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},e4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function t4e(t,e,r){let n=Math.min(e.length*Zj,Qqe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(r4e(t,s,r))}return n4e(o)}function r4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Pte(t,a):a,u=Zj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function n4e(t){let e="skip";for(let o of t)Ite[o.disposition]>Ite[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${e4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:di,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:di,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var i4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(i4e){let t=Vj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}Fr();an();Pn();import Dte from"node:process";var Kx="stage_3.1";function Wj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Kx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Gl(e,o[o.length-1]))return{stage:Kx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Kx,i,s,o);return a||Yt(Kx,s)}var o4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Dte.argv[1]}`;if(o4e){let t=Wj();console.log(JSON.stringify(t)),Dte.exit(t.exitCode)}yC();Kj();Jj();Fr();Zx();import{randomBytes as f4e}from"node:crypto";import{unlinkSync as p4e}from"node:fs";import{tmpdir as m4e}from"node:os";import{join as h4e}from"node:path";import Xj from"node:process";eh();Pn();Ue();import{readFileSync as c4e}from"node:fs";import{resolve as Mte}from"node:path";function l4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Mte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function u4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function d4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=u4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Mte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Yj(t,e){try{let r=l4e(c4e(t,"utf8"));return r?d4e(q(e),r,e):[]}catch{return[]}}var Hr="stage_2.1";function Fte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Lte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function zte(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function g4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Fte(n,i))return null;let o=n,s=i,a=zj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Hr,n,c,s))return null;let u=Yt(Hr,c);if(Uj(u)==="fallback")return null;if(r){let d=Yj(l,e);if(d.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Hr,pass:!0,exitCode:0}}function y4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Lte(n,i))return null;let o=n,s=i,a=zj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Hr,o,a.proc,s))return null;let c=Yt(Hr,a.proc);if(Uj(c)==="fallback")return null;if(r&&zte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Hr,pass:!0,exitCode:0}}function Qj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Yi("test",t))}catch(d){return{stage:Hr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Hr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Fte(n,i),a=Lte(n,i),c=r&&s;if(Lj()&&s){let d=g4e(t,e,c);if(d)return d}if(Lj()&&a){let d=y4e(t,e);if(d)return d}let l,u=i;c&&(l=h4e(m4e(),`clad-vitest-${Xj.pid}-${f4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Hr,n,d,u);if(f)return f;let p=Du("unit",Yt(Hr,d),d);if(r&&p.pass&&zte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Yj(l,e);if(m.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{p4e(l)}catch{}}}var _4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xj.argv[1]}`;if(_4e){let t=Qj();console.log(JSON.stringify(t)),Xj.exit(t.exitCode)}Fr();an();Pn();import Ute from"node:process";var Xx="stage_3.3";function eM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Gl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var b4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ute.argv[1]}`;if(b4e){let t=eM();console.log(JSON.stringify(t)),Ute.exit(t.exitCode)}bC();zf();ba();rM();Op();iS();var Wte=St(er(),1);import{existsSync as nM,readFileSync as R4e,readdirSync as Vte,statSync as I4e,writeFileSync as P4e}from"node:fs";import{basename as oh,join as sh,relative as Zte}from"node:path";var C4e=["self-dogfood:","fixture:","derived:"],Kte=/\.(test|spec)\.[jt]sx?$/;function Jte(t,e=t,r=[]){let n;try{n=Vte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=sh(e,i);try{I4e(o).isDirectory()?Jte(t,o,r):Kte.test(i)&&r.push(o)}catch{continue}}return r}function Yte(t="."){let e=sh(t,"spec","features"),r=sh(t,"tests"),n=[],i=[];if(!nM(e)||!nM(r))return{repaired:n,suggested:i};let o=Jte(r),s=new Map;for(let a of o){let c=Zte(t,a).split("\\").join("/"),l=s.get(oh(a))??[];l.push(c),s.set(oh(a),l)}for(let a of Vte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=sh(e,a),l,u;try{l=R4e(c,"utf8"),u=(0,Wte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(C4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(nM(sh(t,b)))continue;let _=s.get(oh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>oh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Zte(t,h).split("\\").join("/")).find(h=>{let g=oh(h).replace(Kte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&v4e(c,l,"utf8")}return{repaired:n,suggested:i}}vl();import{existsSync as w4e,readFileSync as x4e}from"node:fs";import{join as $4e}from"node:path";function k4e(t,e){let r=$4e(t,e);if(!w4e(r))return[];let n=[];for(let i of x4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Hte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>k4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Gte(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}iS();Ue();ln();Ii();ln();vl();var eM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],E4e=[...eM,"att"];function A4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function T4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":H_(e,r,t).state==="fresh"?"\u2713":"!"}function Qx(t,e="."){let r=as(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...eM.map(o=>A4e(i,o,e)),T4e(i,r,e)]}));return{columns:E4e,rows:n}}function Zte(t,e=".",r={}){let n=r.internal??!1,i=Qx(t,e),o=[...eM.map(c=>n?c.replace("stage_",""):O4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function O4e(t){return Ta(t).slice(0,3)}async function r5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(ade(),sde)),Promise.resolve().then(()=>(fde(),dde)),Promise.resolve().then(()=>(Qp(),w7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Yee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Kee(s,a,c),initialize:hj,prepareClarify:(s,{cwd:a})=>Jee(a,s),clarify:bj,resolveReview:(s,{cwd:a})=>Gee(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function n5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await hj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&P4e(c,l,"utf8")}return{repaired:n,suggested:i}}wl();import{existsSync as D4e,readFileSync as N4e}from"node:fs";import{join as j4e}from"node:path";function M4e(t,e){let r=j4e(t,e);if(!D4e(r))return[];let n=[];for(let i of N4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Xte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>M4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Qte(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}aS();Ue();ln();Ii();ln();wl();var iM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],F4e=[...iM,"att"];function L4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Bx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function z4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":V_(e,r,t).state==="fresh"?"\u2713":"!"}function r0(t,e="."){let r=cs(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...iM.map(o=>L4e(i,o,e)),z4e(i,r,e)]}));return{columns:F4e,rows:n}}function ere(t,e=".",r={}){let n=r.internal??!1,i=r0(t,e),o=[...iM.map(c=>n?c.replace("stage_",""):U4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function U4e(t){return Ta(t).slice(0,3)}async function m5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(hde(),mde)),Promise.resolve().then(()=>(vde(),bde)),Promise.resolve().then(()=>(rm(),R7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ote(s),prepareInit:({cwd:s,mode:a,intent:c})=>nte(s,a,c),initialize:bj,prepareClarify:(s,{cwd:a})=>ite(a,s),clarify:xj,resolveReview:(s,{cwd:a})=>Qee(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function h5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await bj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} `),G.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){G.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())G.stdout.write(` ${o+1}. ${s} @@ -921,32 +926,32 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&v4e(c,l,"u `),G.stdout.write(` e.g. clad init payment SaaS for B2B `),G.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));G.exit(0)}async function i5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Mde(),jde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>oR(l,s)),c=`${mG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function o5e(t={}){try{let e=q();if(ya("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=_s(".");Vl(".",r),Wa("."),F5(".");let n=ru(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Bte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=Xx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=oS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function s5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=A_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function a5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=T_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}O_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} +`));G.exit(0)}async function g5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Gde(),Hde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>lR(l,s)),c=`${bG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function y5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Kl(".",r),Wa("."),Z5(".");let n=iu(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Yte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=t0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=cS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function _5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=R_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function b5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=I_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}P_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} `):G.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),G.exit(0)}async function c5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await WC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function l5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await ZX(".",{wireHosts:async()=>(await WC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` +`),G.exit(0)}async function v5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await XC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function S5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await e7(".",{wireHosts:async()=>(await XC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),kA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var u5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function kA(t){let e=t.tier??"all",r=t.silent===!0,n=u5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>eh(i)],["stage_1.2",()=>Qm(i)],["stage_1.3",()=>oi({...i,strict:t.strict})],["stage_1.4",Fj],["stage_1.5",rc],["stage_1.6",Vp],["stage_2.1",()=>Kj({...i,strict:t.strict})],["stage_2.2",()=>Lj(i)],["stage_2.3",fC],["stage_2.4",Bj],["stage_3.1",Hj],["stage_3.2",Uj],["stage_3.3",Jj],["stage_4.1",Cj],["stage_4.2",th]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ci(d)?"fail":"skip",u=[];G_("."),gte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=CX(p);ci(h)&&(c=!0,a=Math.max(a,DX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),ci(h)&&_5e(p))}}finally{V_(),_te()}if(t.strict)try{let d=q();for(let f of mte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!ci(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>ci(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ya("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{NG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function d5e(t){try{let e=q(),r=fl(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} -`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function f5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} -`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function p5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=dS(e,o=>{try{return Lde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function m5e(t={}){try{if(t.sessions){ete(t);return}if(t.trend!==void 0&&t.trend!==!1){tte(t);return}let e=q(),n=CH(e,o=>{try{return Lde(o,"utf8")}catch{return null}},"."),i=NH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${pl}`];G.stdout.write(`${c.join(` +`),TA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var w5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function TA(t){let e=t.tier??"all",r=t.silent===!0,n=w5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>nh(i)],["stage_1.2",()=>rh(i)],["stage_1.3",()=>oi({...i,strict:t.strict})],["stage_1.4",qj],["stage_1.5",rc],["stage_1.6",Jp],["stage_2.1",()=>Qj({...i,strict:t.strict})],["stage_2.2",()=>Bj(i)],["stage_2.3",gC],["stage_2.4",Vj],["stage_3.1",Wj],["stage_3.2",Gj],["stage_3.3",eM],["stage_4.1",Mj],["stage_4.2",ih]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ci(d)?"fail":"skip",u=[];W_("."),$te(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=UX(p);ci(h)&&(c=!0,a=Math.max(a,qX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),ci(h)&&R5e(p))}}finally{J_(),Ete()}if(t.strict)try{let d=q();for(let f of wte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!ci(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>ci(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{BG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function x5e(t){try{let e=q(),r=ml(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} +`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function $5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} +`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function k5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=mS(e,o=>{try{return Vde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function E5e(t={}){try{if(t.sessions){cte(t);return}if(t.trend!==void 0&&t.trend!==!1){lte(t);return}let e=q(),n=FH(e,o=>{try{return Vde(o,"utf8")}catch{return null}},"."),i=zH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${hl}`];G.stdout.write(`${c.join(` `)} -`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function h5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=kA({...t,focusModules:e});if(!t.json){let n=pX(".");n&&G.stdout.write(`\u2139 ${n} -`)}G.exitCode=r.worst}function g5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=nX(".",t,{checkStages:kA,onIndex:Wa,gitOpInProgress:kO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function y5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=B5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function A5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=TA({...t,focusModules:e});if(!t.json){let n=SX(".");n&&G.stdout.write(`\u2139 ${n} +`)}G.exitCode=r.worst}function T5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=dX(".",t,{checkStages:TA,onIndex:Wa,gitOpInProgress:OO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function O5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=Y5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),G.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";G.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}G.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Hte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${Gte(i)} -`),G.exit(0)}function _5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Fde(_l(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] +`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Xte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${Qte(i)} +`),G.exit(0)}function R5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Zde(vl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&G.stdout.write(` \u2026 and ${n.length-3} more finding(s) `),t.hint&&G.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Fde(e.trim(),160)} -`)}}function Fde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function b5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(Qx(e,"."),null,2)} -`),G.exitCode=0;return}G.stdout.write(`${Zte(e,".",{internal:t.internal})} -`),G.exit(0)}function v5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function S5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=Qx(i,e),s={gitHead:va(e),version:Xl(),generatedAt:t.now??new Date().toISOString()},a=gl(i),c;try{let l=t.since??rs(e),u=ns(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ml(u),auditMarkdown:hl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=AG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{t5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${v5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function w5e(t){let e=HA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function x5e(){let t=new $4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(n5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(i5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(o5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(c5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(l5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(h5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(s5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(g5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>y5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(a5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(b5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(d5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>f5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>UX(r,{checkStages:kA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>p5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>m5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>dte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>fte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{pte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>pG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>$Y(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>S5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(w5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(PX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(r5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){QY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}AY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(Wee),t}var $5e=!!globalThis.__CLADDING_BUNDLED,k5e=$5e||import.meta.url===`file://${G.argv[1]}`;k5e&&x5e().parse();export{u5e as TIER_STAGES,x5e as createProgram,S5e as runBundleCommand,h5e as runCheckCommand,kA as runCheckStages,s5e as runCheckpointCommand,d5e as runContextCommand,g5e as runDoneCommand,f5e as runImpactCommand,p5e as runInferDepsCommand,n5e as runInitCommand,m5e as runMeasureCommand,y5e as runOracleCommand,a5e as runRollbackCommand,w5e as runRouteCommand,i5e as runRunCommand,r5e as runServeCommand,c5e as runSetupCommand,b5e as runStatusCommand,o5e as runSyncCommand,l5e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Zde(e.trim(),160)} +`)}}function Zde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function I5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(r0(e,"."),null,2)} +`),G.exitCode=0;return}G.stdout.write(`${ere(e,".",{internal:t.internal})} +`),G.exit(0)}function P5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function C5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=r0(i,e),s={gitHead:Sa(e),version:eu(),generatedAt:t.now??new Date().toISOString()},a=_l(i),c;try{let l=t.since??rs(e),u=ns(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:gl(u),auditMarkdown:yl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{p5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${P5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function D5e(t){let e=VA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function N5e(){let t=new T4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(h5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(g5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(y5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(v5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(S5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(A5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(_5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(T5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>O5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(b5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(I5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(x5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>$5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>KX(r,{checkStages:TA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>k5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>E5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>bte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>vte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Ste(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>_G(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>PY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>C5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(D5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(zX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(m5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){aX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}NY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(rte),t}var j5e=!!globalThis.__CLADDING_BUNDLED,M5e=j5e||import.meta.url===`file://${G.argv[1]}`;M5e&&N5e().parse();export{w5e as TIER_STAGES,N5e as createProgram,C5e as runBundleCommand,A5e as runCheckCommand,TA as runCheckStages,_5e as runCheckpointCommand,x5e as runContextCommand,T5e as runDoneCommand,$5e as runImpactCommand,k5e as runInferDepsCommand,h5e as runInitCommand,E5e as runMeasureCommand,O5e as runOracleCommand,b5e as runRollbackCommand,D5e as runRouteCommand,g5e as runRunCommand,m5e as runServeCommand,v5e as runSetupCommand,I5e as runStatusCommand,y5e as runSyncCommand,S5e as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index d584a432..a3f88d8b 100644 --- a/spec.yaml +++ b/spec.yaml @@ -54,7 +54,7 @@ project: # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 271 + features: 272 scenarios: 2 capabilities: 6 - test_files: 248 + test_files: 249 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index e98085a0..8a426873 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -20,12 +20,12 @@ attested_modules: CHANGELOG.md: 033d721cd4fe05a4 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 490eab86b9c0d208 - README.ja.md: 3c4f3453ba97a3a6 - README.ko.html: dd48adf81a1d382c - README.ko.md: 383011eabecf55a2 - README.md: c84d37f3d8726f5c - README.zh.md: 014fe3859fdbb8dc + README.html: 56adb19dd6f4f7b0 + README.ja.md: 28eddff1f60c71c1 + README.ko.html: 23a412d68e7affbd + README.ko.md: 5dacfa067b26329a + README.md: f6c11815b54592e6 + README.zh.md: 61771611b221bf71 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -117,7 +117,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: ea944be3d843f018 + spec.yaml: 7a38d9f04c46dd69 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -145,7 +145,7 @@ attested_modules: src/agents/orchestrator.md: 1b758de0bdab8eb0 src/agents/planner.md: d1f895a20fb3a3ed src/agents/reviewer.md: cdf7469a3e58b438 - src/changelog/collect.ts: a6c936a7b8c34e2a + src/changelog/collect.ts: bb0830526334da9f src/changelog/render.ts: 83dd2d95f24ca68c src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f @@ -163,7 +163,7 @@ attested_modules: src/cli/init.ts: 91cf7be2b7427fbf src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 - src/cli/report.ts: 911f859b2446834b + src/cli/report.ts: bf44afa516ade7f3 src/cli/scan/architecture.ts: c9cfd5445ea77e45 src/cli/scan/conventions.ts: 577468c0fc3fdf6a src/cli/scan/dispatcher.ts: 97bd3f12cece4fc4 @@ -184,7 +184,7 @@ attested_modules: src/cli/update.ts: b0151396c9a0f6ca src/cli/verdict.ts: 85a4ef27292b9169 src/core/checkpoint.ts: 63300c2764533b6c - src/core/git-ops.ts: 4544bde493a0628f + src/core/git-ops.ts: c144e5cc253822b3 src/core/postmortem.ts: 73be29d5e8a16fd4 src/core/telemetry-summary.ts: 6782bfaa6c3ecfa6 src/drive: a4d0f0eb87fed960 @@ -228,8 +228,9 @@ attested_modules: src/oracle/payload.ts: 0171633d758ceed8 src/oracle/policy.ts: 8919ad927bd59b08 src/oracle/record.ts: 0b9c124225abe1ac + src/report/ac-delta.ts: d5f219cee7691d01 src/report/bundle.ts: f8a2fb6c2d02326f - src/report/report.ts: 234d0e0637153478 + src/report/report.ts: 983dae356d42af0b src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 @@ -245,7 +246,7 @@ attested_modules: src/spec/load.ts: 9fe2fe74053bf7e3 src/spec/new.ts: 4c91f6d41acaab69 src/spec/parse.ts: 1eab9a28c9359a45 - src/spec/reverse-index.ts: d8b003eb8f1918c8 + src/spec/reverse-index.ts: fa54d7203a02799a src/spec/schema.json: 848951cd01d7f82f src/spec/test-ref-repair.ts: 5ce823b479aaaca3 src/spec/types.ts: 5799bc9fc1e00553 @@ -583,6 +584,7 @@ attested_features: F-5b9f9f: ok F-5cac007a: ok F-5d3ed2: ok + F-5dfbac9c: ok F-5f6b45: ok F-600272d7: ok F-63b989e5: ok diff --git a/spec/capabilities.yaml b/spec/capabilities.yaml index 88b62505..66cf4859 100644 --- a/spec/capabilities.yaml +++ b/spec/capabilities.yaml @@ -17,7 +17,7 @@ capabilities: title: "Harness CLI (clad)" summary: "14 verbs covering init, scan, refine, sync, check, drive, serve, doctor, …" surface: tool - features: [F-09d68b, F-bb15e6, F-7afbd4, F-6ba22c5c] + features: [F-09d68b, F-bb15e6, F-7afbd4, F-6ba22c5c, F-5dfbac9c] - id: spec-governance title: "Spec governance (4-tier SSoT)" summary: "Tier A/B/C/D model with explicit refresh authority + banner convention" diff --git a/spec/features/review-packet-ac-delta-5dfbac9c.yaml b/spec/features/review-packet-ac-delta-5dfbac9c.yaml new file mode 100644 index 00000000..9777ee50 --- /dev/null +++ b/spec/features/review-packet-ac-delta-5dfbac9c.yaml @@ -0,0 +1,54 @@ +id: F-5dfbac9c +slug: review-packet-ac-delta +title: "Review packet shows how the contract itself moved" +status: done +modules: + - src/changelog/collect.ts + - src/report/ac-delta.ts + - src/report/report.ts + - src/cli/report.ts +acceptance_criteria: + - id: AC-a2278f11 + ears: event + condition: "when a review packet is rendered for a git range" + text: "When a review packet is rendered for a git range, then the system shall enumerate every feature spec entry the range touched regardless of that entry's status, so entries still planned or in progress reach the reviewer." + test_refs: ["tests/changelog/collect.test.ts"] + notes: "WHY: the changelog collector is a SHIPPED filter — it keeps only done/archived transitions and drops planned/in_progress outright. Measured on a live corpus, 74% of the range's spec entries fell into that hole, which would make two of the three new sections structurally unbuildable." + - id: AC-c32cbab2 + ears: ubiquitous + text: "The system shall classify each acceptance criterion in the range as new, rewritten, removed, or unchanged by joining the base and head revisions on the criterion id, counting a difference in text, EARS pattern, or condition as a rewrite and ignoring differences that are only whitespace." + test_refs: ["tests/report/ac-delta.test.ts"] + notes: "WHY: a criterion keeps its id across a rewrite — verified on a live reversal where the text flipped polarity while the id held — so the id is a sound join key and the rewrite is invisible to any check that only compares code against the current spec." + - id: AC-1a6cb22f + ears: event + condition: "when the base of the range is resolved" + text: "When the base of the range is resolved, then the system shall use the merge base of the given ref and HEAD for both the spec comparison and the changed-file set, so edits made on the base branch itself are not attributed to the range under review." + test_refs: ["tests/report/report-cli.test.ts"] + notes: "WHY: a two-tree compare against a diverged ref reports the base branch's own work as this range's doing. Measured on a live repository, four unrelated features were misattributed this way." + - id: AC-4b6fe145 + ears: unwanted + condition: "if the merge base cannot be computed" + text: "If the merge base cannot be computed, then the system shall fall back to the given ref and still render the packet, rather than failing." + test_refs: ["tests/report/report-cli.test.ts"] + notes: "WHY: CI checks out at depth 1, where merge-base exits non-zero; unrelated histories do the same. Rendering must degrade, not stop." + - id: AC-e68c868a + ears: ubiquitous + text: "The system shall report, for each acceptance criterion, whether each declared test reference also changed within the range, distinguishing a concrete path that did not change from a placeholder reference that names no real test file." + test_refs: ["tests/report/report.test.ts"] + notes: "WHY: a placeholder reference is written by the harness itself as an unconfirmed suggestion; rendering it as an unchanged test would present a harness guess as a reviewed fact. The existing path normalizer already separates the two and must be reused rather than reimplemented." + - id: AC-8e748acb + ears: unwanted + condition: "if the new sections surface a discrepancy" + text: "If the new sections surface a discrepancy, then the system shall leave the report's exit code unchanged and block nothing." + test_refs: ["tests/report/report-cli.test.ts"] + notes: "WHY: the review packet renders and never disposes. Every judgement stays with the reviewer and with the existing gate." + - id: AC-4faef94d + ears: ubiquitous + text: "The system shall order every delta row by acceptance-criterion id and carry no wall-clock value, so two runs over the same repository state produce byte-identical output." + test_refs: ["tests/report/report.test.ts"] + notes: "WHY: the packet is an audit artifact; reproducibility is what makes it citable. Extends the determinism contract the existing report already holds." +design_impact: + classification: additive + rationale: "Extends the existing review-packet verb with two sections computed from data the spec already holds; no new capability, no architecture change, no project-context change. Binds to the harness CLI capability that owns the verb." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index 90a96aa8..5ef0feaf 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -151,6 +151,7 @@ features: F-5b9f9f: {slug: spec-yaml-inventory-and-hints, status: done, modules: 6} F-5cac007a: {slug: init-onboarding-english-source, status: done, modules: 3} F-5d3ed2: {slug: postmortem-on-rollback, status: done, modules: 2} + F-5dfbac9c: {slug: review-packet-ac-delta, status: done, modules: 4} F-5f6b45: {slug: init-path-intent, status: done, modules: 2} F-600272d7: {slug: orchestrator-contract-card, status: done, modules: 2} F-63b989e5: {slug: impact-card-language-parity, status: done, modules: 2} diff --git a/src/changelog/collect.ts b/src/changelog/collect.ts index 1ae26625..55427063 100644 --- a/src/changelog/collect.ts +++ b/src/changelog/collect.ts @@ -222,6 +222,70 @@ function isFeatureShard(path: string): boolean { return path.startsWith('spec/features/') && (path.endsWith('.yaml') || path.endsWith('.yml')); } +/** One feature spec entry as it stood at both ends of a range (AC-a2278f11). */ +export interface SpecEntryRevision { + /** Repo-relative path of the entry at HEAD (or at the ref, when deleted). */ + readonly path: string; + readonly id: string; + readonly slug?: string; + readonly title: string; + /** Status at the ref; null when the entry was added within the range. */ + readonly statusBefore: string | null; + /** Status at HEAD; null when the entry was deleted within the range. */ + readonly statusAfter: string | null; + readonly baseAcs: readonly AcceptanceCriterion[]; + readonly headAcs: readonly AcceptanceCriterion[]; +} + +/** + * Every feature spec entry the range touched, at BOTH revisions, regardless of + * status — the review packet's input. + * + * WHY this exists alongside classifyShards: that one is a *shipped* filter. It + * keeps only done/archived lifecycle transitions and drops `planned` / + * `in_progress` entries outright, which is right for a changelog and wrong for + * a reviewer. Measured on a live corpus, 74% of a range's touched entries sat + * in those two states — a review packet built on the changelog's population + * would silently omit most of what the range actually did to the spec. + * + * Same cost discipline as its sibling: ONE `git diff --name-status` classifies + * the candidate set, and `git show` runs only for entries that existed at the + * ref. Sorted by id, so callers serialize deterministically. + */ +export function collectSpecEntryRevisions(cwd: string, sinceRef: string): readonly SpecEntryRevision[] { + assertValidRef(cwd, sinceRef); + const raw = git(cwd, ['diff', '--name-status', `${sinceRef}..HEAD`, '--', 'spec/']); + const out: SpecEntryRevision[] = []; + for (const line of raw.split('\n')) { + if (line.trim().length === 0) continue; + const fields = line.split('\t'); + const status = fields[0] ?? ''; + const oldPath = fields[1] ?? ''; + const newPath = fields.length > 2 ? (fields[2] ?? '') : oldPath; + if (!isFeatureShard(newPath) && !isFeatureShard(oldPath)) continue; + + const added = status.startsWith('A'); + const deleted = status.startsWith('D'); + const head = added || !deleted ? parseShard(readWorktreeOrNull(cwd, newPath)) : null; + const base = added ? null : parseShard(gitShowOrNull(cwd, sinceRef, oldPath)); + const anchor = head ?? base; + if (!anchor) continue; + + out.push({ + path: deleted ? oldPath : newPath, + id: anchor.id, + ...(anchor.slug ? {slug: anchor.slug} : {}), + title: anchor.title, + statusBefore: base ? base.status : null, + statusAfter: head ? head.status : null, + baseAcs: base?.acceptance_criteria ?? [], + headAcs: head?.acceptance_criteria ?? [], + }); + } + out.sort((a, b) => a.id.localeCompare(b.id)); + return out; +} + function toEntry(doc: ShardDoc, change: FeatureChangeKind): ChangelogFeature { const acceptance = (doc.acceptance_criteria ?? []) .map((ac) => acSentence(ac)) diff --git a/src/cli/report.ts b/src/cli/report.ts index 088111d8..72acdd99 100644 --- a/src/cli/report.ts +++ b/src/cli/report.ts @@ -20,8 +20,13 @@ import {execFileSync} from 'node:child_process'; import process from 'node:process'; -import {collectChangelog, defaultSinceRef, type ChangelogManifest} from '../changelog/collect.js'; -import {refExists} from '../core/git-ops.js'; +import { + collectChangelog, + collectSpecEntryRevisions, + defaultSinceRef, + type ChangelogManifest, +} from '../changelog/collect.js'; +import {mergeBaseWithHead, refExists} from '../core/git-ops.js'; import {latestEventOfType} from '../events/log.js'; import {buildImpactSlice, ledgerOf} from '../optimizer/reverse-slice.js'; import { @@ -87,11 +92,11 @@ function assertRefResolves(cwd: string, ref: string): void { } } -/** Changed source files in `..HEAD`, deduped + sorted. Empty on git failure. */ -function changedSourceFiles(cwd: string, sinceRef: string): readonly string[] { +/** Every path that changed in `..HEAD`, deduped + sorted. Empty on git failure. */ +function changedPaths(cwd: string, baseRef: string): readonly string[] { let raw: string; try { - raw = execFileSync('git', ['diff', '--name-only', `${sinceRef}..HEAD`], { + raw = execFileSync('git', ['diff', '--name-only', `${baseRef}..HEAD`], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], @@ -104,8 +109,7 @@ function changedSourceFiles(cwd: string, sinceRef: string): readonly string[] { raw .split('\n') .map((l) => l.trim()) - .filter((l) => l.length > 0) - .filter(isReviewableSourcePath), + .filter((l) => l.length > 0), ), ].sort((a, b) => a.localeCompare(b)); } @@ -136,21 +140,31 @@ function gatherGateState(cwd: string): GateStateInput { function gatherInputs( cwd: string, spec: Spec, - sinceRef: string, + baseRef: string, manifest: ChangelogManifest, ): ReportInputs { const ri = reverseIndexOf(spec); const ledgerEmpty = ledgerOf(ri).depends_on_edges === 0; const byId = new Map((spec.features ?? []).map((f) => [f.id, f])); - const codeChanges: CodeChangeInput[] = changedSourceFiles(cwd, sinceRef).map((path) => { - const slice = buildImpactSlice(spec, path); - if ('not_found' in slice) return {path, owners: [], testRefs: []}; - const owners = (slice.focus.owners ?? []).map((id) => ownerOf(id, byId)); - return {path, owners, testRefs: slice.test_refs}; - }); + const allChanged = changedPaths(cwd, baseRef); + const codeChanges: CodeChangeInput[] = allChanged + .filter(isReviewableSourcePath) + .map((path) => { + const slice = buildImpactSlice(spec, path); + if ('not_found' in slice) return {path, owners: [], testRefs: []}; + const owners = (slice.focus.owners ?? []).map((id) => ownerOf(id, byId)); + return {path, owners, testRefs: slice.test_refs}; + }); - return {specChanges: manifest, codeChanges, ledgerEmpty, gate: gatherGateState(cwd)}; + return { + specChanges: manifest, + codeChanges, + ledgerEmpty, + gate: gatherGateState(cwd), + specEntries: collectSpecEntryRevisions(cwd, baseRef), + changedPaths: allChanged, + }; } /** Handler for `clad report --since [--format md|sarif|json]`. */ @@ -184,9 +198,16 @@ export function runReportCommand(opts: ReportCommandOptions): void { const {findings} = runDrift({cwd}); out = `${JSON.stringify(toSarif(findings), null, 2)}\n`; } else { - const manifest = collectChangelog(cwd, sinceRef); + // Anchor on the FORK POINT, not the ref's tip (AC-1a6cb22f). Diffing two + // tips charges the base branch's own commits to the range under review; + // on a live repository that misattributed four untouched features. A + // shallow clone (CI checks out at depth 1) has no merge base, so the + // helper falls back to the ref itself and the packet still renders + // (AC-4b6fe145). + const baseRef = mergeBaseWithHead(cwd, sinceRef); + const manifest = collectChangelog(cwd, baseRef); const spec = loadSpec(cwd); - const model = buildReportModel(gatherInputs(cwd, spec, sinceRef, manifest)); + const model = buildReportModel(gatherInputs(cwd, spec, baseRef, manifest)); out = format === 'json' ? `${JSON.stringify({since: sinceRef, head: manifest.head, ...model}, null, 2)}\n` diff --git a/src/core/git-ops.ts b/src/core/git-ops.ts index 33fc4761..add30da4 100644 --- a/src/core/git-ops.ts +++ b/src/core/git-ops.ts @@ -91,3 +91,31 @@ export function resolveRefToCommit(cwd: string, ref: string): string | null { export function refExists(cwd: string, ref: string): boolean { return resolveRefToCommit(cwd, ref) !== null; } + +/** + * Resolves the merge base of `ref` and HEAD — the commit where the branch under + * review actually diverged — falling back to `ref` itself when git cannot + * compute one. + * + * WHY this matters for a review packet: comparing two tips instead of the fork + * point charges the BASE branch's own commits to the range under review. On a + * live repository that misattributed four untouched features as "code changed + * with no spec movement" — the loudest verdict the packet can print. + * + * WHY it must degrade rather than fail: `git merge-base` exits non-zero on a + * shallow clone (CI checks out at depth 1) and on unrelated histories. A packet + * that refuses to render there would be worse than one anchored slightly wide, + * so the raw ref is the fallback and rendering always proceeds. Never throws. + */ +export function mergeBaseWithHead(cwd: string, ref: string): string { + try { + const sha = execFileSync('git', ['merge-base', ref, 'HEAD'], { + cwd, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'ignore'], + }).trim(); + return sha.length > 0 ? sha : ref; + } catch { + return ref; + } +} diff --git a/src/report/ac-delta.ts b/src/report/ac-delta.ts new file mode 100644 index 00000000..bf63ba99 --- /dev/null +++ b/src/report/ac-delta.ts @@ -0,0 +1,145 @@ +// Cladding · report · how the contract itself moved across a range (F-5dfbac9c) +// +// Every drift detector compares code against the spec as it stands NOW. That +// makes one class of change structurally invisible: rewrite an acceptance +// criterion to match what you built, and code and spec agree, so nothing fires. +// The reversal is real, it is in git, and no reviewer will find it by hand — +// it takes a per-criterion diff of two revisions of the same spec entry. +// +// This module is that diff. Given each touched entry at both ends of the range +// it classifies every criterion as new / rewritten / removed / unchanged, and +// reports the entry's status transition alongside — because a criterion +// rewritten in the same motion that marks the feature done is the case that +// most deserves a second look. +// +// Pure: no I/O, no git, no clock. The CLI gathers the two revisions; this +// decides what changed. Rows sort by criterion id so the packet serializes +// byte-identically for a fixed repository state (AC-4faef94d). +// +// Layer: `report` is foundation-tier (spec/architecture.yaml) — it must never +// import stages/drive/cli/serve. + +import type {SpecEntryRevision} from '../changelog/collect.js'; +import type {AcceptanceCriterion} from '../spec/types.js'; + +/** How one acceptance criterion moved across the range. */ +export type AcChangeKind = 'new' | 'rewritten' | 'removed' | 'unchanged'; + +/** One criterion's verdict, plus the EARS pattern shift when it changed. */ +export interface AcDeltaRow { + readonly id: string; + readonly kind: AcChangeKind; + /** EARS pattern at HEAD (at the ref, for a removed criterion). */ + readonly ears?: string; + /** Set only when the EARS pattern itself changed — e.g. `state → unwanted`. */ + readonly earsShift?: string; +} + +/** Every criterion of one spec entry, with the entry's status transition. */ +export interface SpecEntryDelta { + readonly id: string; + readonly title: string; + readonly path: string; + readonly statusBefore: string | null; + readonly statusAfter: string | null; + readonly rows: readonly AcDeltaRow[]; + readonly counts: Readonly>; +} + +/** + * Collapses runs of whitespace and trims, so reflowing a criterion across + * lines — or fixing a stray double space — never reads as a rewrite. This is + * the "whitespace-only differences are ignored" half of AC-c32cbab2. + */ +function norm(value: string | undefined): string { + return (value ?? '').replace(/\s+/g, ' ').trim(); +} + +/** + * Field separator for the comparison key — a character that cannot occur inside + * any authored field, so a statement ending where the next field begins can never + * make two different contracts read alike. Written as an escape: a raw control + * byte in source would make git treat the file as binary. + */ +const FIELD_SEPARATOR = '\u0000'; + +/** + * The comparison key for a criterion: its statement, its EARS pattern, and its + * trigger condition. Those three are the contract. `notes` is deliberately + * EXCLUDED — it is the free-prose field authors actually use, and treating an + * expanded rationale as a contract rewrite would make the signal fire on the + * one habit worth encouraging. + */ +function contractKey(ac: AcceptanceCriterion): string { + return [norm(ac.text), norm(ac.ears), norm(ac.condition)].join(FIELD_SEPARATOR); +} + +function byId(acs: readonly AcceptanceCriterion[]): Map { + const map = new Map(); + for (const ac of acs) if (ac.id && !map.has(ac.id)) map.set(ac.id, ac); + return map; +} + +/** + * Classifies one spec entry's criteria across the range. + * + * The join key is the criterion id, which survives a rewrite: on the live + * reversal that motivated this feature the text flipped polarity + * (`shall run kill-server` → `shall never issue kill-server`) and the EARS + * pattern went `state → unwanted` while the id held. That is exactly the case + * a text-similarity join would miss and an id join catches. + */ +function deltaOf(entry: SpecEntryRevision): SpecEntryDelta { + const base = byId(entry.baseAcs); + const head = byId(entry.headAcs); + const rows: AcDeltaRow[] = []; + + for (const [id, ac] of head) { + const was = base.get(id); + if (!was) { + rows.push({id, kind: 'new', ...(ac.ears ? {ears: ac.ears} : {})}); + continue; + } + if (contractKey(ac) === contractKey(was)) { + rows.push({id, kind: 'unchanged', ...(ac.ears ? {ears: ac.ears} : {})}); + continue; + } + const shifted = norm(ac.ears) !== norm(was.ears); + rows.push({ + id, + kind: 'rewritten', + ...(ac.ears ? {ears: ac.ears} : {}), + ...(shifted ? {earsShift: `${was.ears ?? '(none)'} → ${ac.ears ?? '(none)'}`} : {}), + }); + } + + for (const [id, ac] of base) { + if (!head.has(id)) rows.push({id, kind: 'removed', ...(ac.ears ? {ears: ac.ears} : {})}); + } + + rows.sort((a, b) => a.id.localeCompare(b.id)); + + const counts: Record = {new: 0, rewritten: 0, removed: 0, unchanged: 0}; + for (const r of rows) counts[r.kind] += 1; + + return { + id: entry.id, + title: entry.title, + path: entry.path, + statusBefore: entry.statusBefore, + statusAfter: entry.statusAfter, + rows, + counts, + }; +} + +/** + * Builds the per-entry criterion deltas for a range, sorted by feature id. + * Entries whose criteria are ALL unchanged are kept: a reviewer reading + * "8 unchanged" learns something different from an entry that is simply absent. + */ +export function buildSpecEntryDeltas( + entries: readonly SpecEntryRevision[], +): readonly SpecEntryDelta[] { + return entries.map(deltaOf).sort((a, b) => a.id.localeCompare(b.id)); +} diff --git a/src/report/report.ts b/src/report/report.ts index 25f7f8e1..ce8829c8 100644 --- a/src/report/report.ts +++ b/src/report/report.ts @@ -27,7 +27,10 @@ // no stage runners. The CLI verb (src/cli/report.ts) is the thin impure wrapper // that gathers git/spec/detector state and feeds this renderer. -import type {ChangelogManifest} from '../changelog/collect.js'; +import type {ChangelogManifest, SpecEntryRevision} from '../changelog/collect.js'; +import {testRefPath} from '../spec/reverse-index.js'; + +import {buildSpecEntryDeltas, type SpecEntryDelta} from './ac-delta.js'; /** A feature that owns a changed file — id + title, plus slug for shard lookup. */ export interface OwningFeature { @@ -58,6 +61,18 @@ export interface GateStateInput { } | null; } +/** Whether an acceptance criterion's declared test moved with the code. */ +export type TestRefState = 'co-changed' | 'unchanged' | 'placeholder'; + +/** One declared test reference of one criterion, and how it fared in the range. */ +export interface TestRefRow { + readonly featureId: string; + readonly acId: string; + /** The reference as authored (anchor included) — what the reviewer must find. */ + readonly ref: string; + readonly state: TestRefState; +} + /** Everything the pure model needs — the CLI composes it impurely. */ export interface ReportInputs { readonly specChanges: ChangelogManifest; @@ -65,6 +80,10 @@ export interface ReportInputs { /** True when the project declares zero depends_on edges (blank ledger). */ readonly ledgerEmpty: boolean; readonly gate: GateStateInput; + /** Every feature spec entry the range touched, at both revisions. */ + readonly specEntries?: readonly SpecEntryRevision[]; + /** Every path that changed in the range — the co-change oracle. */ + readonly changedPaths?: readonly string[]; } /** The deterministic, fully-sorted review-packet model. */ @@ -78,6 +97,10 @@ export interface ReportModel { readonly regressionSet: readonly string[]; readonly ledgerEmpty: boolean; readonly gate: GateStateInput; + /** Per-entry acceptance-criterion movement, sorted by feature id. */ + readonly specEntryDeltas: readonly SpecEntryDelta[]; + /** Declared tests of the touched entries, with their co-change state. */ + readonly testRefRows: readonly TestRefRow[]; } /** Stable identifiers stamped into the header — the range + HEAD for a fixed state. */ @@ -113,6 +136,39 @@ function normalizeOwners(owners: readonly OwningFeature[]): readonly OwningFeatu * changed files into owned / unowned, sorts everything, and computes the * deduped regression set. Pure — no I/O, no clock. */ +/** + * Resolves each declared test reference of the touched entries to one of three + * states. + * + * The third state is load-bearing. `clad sync` writes `derived:` refs into + * spec entries as unconfirmed suggestions; rendering one as "declared but did + * not change" would present a harness guess as a reviewed fact. The shared + * normalizer (src/spec/reverse-index.ts) is what tells the two apart — the same + * rule the citation index uses, so the packet and the index can never disagree. + */ +function buildTestRefRows( + entries: readonly SpecEntryRevision[], + changed: ReadonlySet, +): readonly TestRefRow[] { + const rows: TestRefRow[] = []; + for (const entry of entries) { + for (const ac of entry.headAcs) { + for (const ref of ac.test_refs ?? []) { + const path = testRefPath(ref); + const state: TestRefState = + path === null ? 'placeholder' : changed.has(path) ? 'co-changed' : 'unchanged'; + rows.push({featureId: entry.id, acId: ac.id, ref, state}); + } + } + } + return rows.sort( + (a, b) => + a.featureId.localeCompare(b.featureId) || + a.acId.localeCompare(b.acId) || + a.ref.localeCompare(b.ref), + ); +} + export function buildReportModel(inputs: ReportInputs): ReportModel { const withOwners = inputs.codeChanges.map((c) => ({...c, owners: normalizeOwners(c.owners)})); @@ -129,6 +185,9 @@ export function buildReportModel(inputs: ReportInputs): ReportModel { ...new Set(inputs.codeChanges.flatMap((c) => c.testRefs)), ].sort((a, b) => a.localeCompare(b)); + const specEntries = inputs.specEntries ?? []; + const changed = new Set(inputs.changedPaths ?? []); + return { specChanges: inputs.specChanges, codeChanges, @@ -136,6 +195,8 @@ export function buildReportModel(inputs: ReportInputs): ReportModel { regressionSet, ledgerEmpty: inputs.ledgerEmpty, gate: inputs.gate, + specEntryDeltas: buildSpecEntryDeltas(specEntries), + testRefRows: buildTestRefRows(specEntries, changed), }; } @@ -204,6 +265,78 @@ function renderRegressionSet(model: ReportModel): string { return lines.join('\n'); } +/** `planned → done`, or a bare status when the entry only existed at one end. */ +function statusTransition(d: SpecEntryDelta): string { + if (d.statusBefore === null) return `added as ${d.statusAfter ?? 'unknown'}`; + if (d.statusAfter === null) return `was ${d.statusBefore}, now deleted`; + return d.statusBefore === d.statusAfter + ? d.statusAfter + : `${d.statusBefore} → ${d.statusAfter}`; +} + +/** + * Renders the "## How the acceptance criteria moved" section — the answer to + * "did the requirement change, or did the code?" that no drift detector can + * give, because detectors only ever see the spec as it stands now. + */ +function renderSpecEntryDeltas(model: ReportModel): string { + const lines: string[] = ['## How the acceptance criteria moved']; + if (model.specEntryDeltas.length === 0) { + lines.push('', '_No feature spec entry changed in this range._'); + return lines.join('\n'); + } + lines.push( + '', + '_Each criterion compared against its own earlier revision, matched by id. A rewrite here is invisible to every drift check, because the code was changed to match it._', + ); + for (const d of model.specEntryDeltas) { + const c = d.counts; + lines.push('', `### "${d.title}" (${d.id}) — ${statusTransition(d)}`, ''); + lines.push( + `- new ${c.new} · rewritten ${c.rewritten} · removed ${c.removed} · unchanged ${c.unchanged}`, + ); + for (const r of d.rows) { + if (r.kind === 'unchanged') continue; + const shift = r.earsShift ? ` — pattern ${r.earsShift}` : ''; + lines.push(`- ${r.kind.toUpperCase()} ${r.id}${shift}`); + } + } + return lines.join('\n'); +} + +/** + * Renders the "## Declared tests" section: for every criterion of a touched + * entry, whether the test it names also moved in this range. + * + * It grades nothing. Whether a test genuinely verifies its criterion is not + * mechanically decidable — three separate rules were measured against real + * corpora and each misfired on legitimate code — so the packet shows what was + * declared and leaves the judgement with the reviewer. + */ +function renderTestRefs(model: ReportModel): string { + const lines: string[] = ['## Declared tests']; + if (model.testRefRows.length === 0) { + lines.push('', '_No touched entry declares a test._'); + return lines.join('\n'); + } + lines.push( + '', + '_`changed` = the named file also moved in this range. `unchanged` = declared, untouched. `no file` = a placeholder the harness suggested, not a test that exists._', + '', + ); + let current = ''; + for (const row of model.testRefRows) { + if (row.featureId !== current) { + current = row.featureId; + lines.push(`- ${row.featureId}`); + } + const label = + row.state === 'co-changed' ? 'changed' : row.state === 'unchanged' ? 'unchanged' : 'no file'; + lines.push(` - ${row.acId} · ${row.ref} — ${label}`); + } + return lines.join('\n'); +} + /** Renders the "## Gate & attestation" section. */ function renderGate(gate: GateStateInput): string { const lines: string[] = ['## Gate & attestation', '']; @@ -242,8 +375,12 @@ export function renderReportMarkdown(model: ReportModel, meta: ReportMeta): stri '', renderSpecChanges(model.specChanges), '', + renderSpecEntryDeltas(model), + '', renderCodeChanges(model), '', + renderTestRefs(model), + '', renderRegressionSet(model), '', renderGate(model.gate), diff --git a/src/spec/reverse-index.ts b/src/spec/reverse-index.ts index 1cc594e4..daced8f9 100644 --- a/src/spec/reverse-index.ts +++ b/src/spec/reverse-index.ts @@ -46,8 +46,13 @@ const PSEUDO_REF_PREFIXES = ['derived:', 'fixture:', 'script:', 'self-dogfood:'] * Normalises a test_ref to its file path, or null when it is a pseudo-ref. * Real refs look like `tests/foo.test.ts#a test name` — the `#anchor` (the * vitest test title) is dropped so all refs to the same file collapse to one key. + * + * Exported as the single normalizer every consumer shares: the review packet + * needs the same pseudo-ref/anchor handling to tell "a declared test that did + * not change" apart from "no real test declared at all", and a second private + * copy of this rule would drift from the citation index it must agree with. */ -function testRefPath(ref: string): string | null { +export function testRefPath(ref: string): string | null { for (const prefix of PSEUDO_REF_PREFIXES) { if (ref.startsWith(prefix)) return null; } diff --git a/tests/changelog/collect.test.ts b/tests/changelog/collect.test.ts index e0ed900a..32e99b49 100644 --- a/tests/changelog/collect.test.ts +++ b/tests/changelog/collect.test.ts @@ -16,7 +16,7 @@ import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {collectChangelog, defaultSinceRef} from '../../src/changelog/collect.js'; +import {collectChangelog, collectSpecEntryRevisions, defaultSinceRef} from '../../src/changelog/collect.js'; function git(dir: string, args: readonly string[]): string { return execFileSync('git', [...args], {cwd: dir, encoding: 'utf8'}); @@ -208,3 +208,128 @@ describe('changelog/collect', () => { } }); }); + +describe('AC-a2278f11 · every touched spec entry, regardless of status', () => { + let dir: string; + + /** A spec entry with an arbitrary criterion list — the shard() helper pins one AC. */ + function entryWith( + file: string, + id: string, + status: string, + acs: readonly {id: string; text: string; ears?: string}[], + ): void { + writeFileSync( + join(dir, 'spec', 'features', file), + [ + `id: ${id}`, + `slug: ${file.replace(/-[a-f0-9]+\.yaml$/, '')}`, + `title: "Entry ${id}"`, + `status: ${status}`, + 'acceptance_criteria:', + ...acs.flatMap((a) => [ + ` - id: ${a.id}`, + ` ears: ${a.ears ?? 'ubiquitous'}`, + ` text: "${a.text}"`, + ]), + '', + ].join('\n'), + ); + } + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-entryrev-')); + initRepo(dir); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + specYaml(dir, 2); + entryWith('still-planned-aaa001.yaml', 'F-aaa001', 'planned', [ + {id: 'AC-000001', text: 'The system shall hold the original promise.'}, + ]); + entryWith('goes-done-bbb002.yaml', 'F-bbb002', 'planned', [ + {id: 'AC-000002', text: 'The system shall always run the cleanup.', ears: 'state'}, + ]); + commitAll(dir, 'baseline'); + git(dir, ['tag', 'v0']); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('an entry that stays planned is carried, though the changelog drops it', () => { + entryWith('still-planned-aaa001.yaml', 'F-aaa001', 'planned', [ + {id: 'AC-000001', text: 'The system shall hold a REVISED promise.'}, + ]); + commitAll(dir, 'refine while planned'); + + // The changelog is a shipped-changes filter: no lifecycle transition, no entry. + const shipped = collectChangelog(dir, 'v0').groups.flatMap((g) => g.features).map((f) => f.id); + expect(shipped).not.toContain('F-aaa001'); + + // The review packet's population must still see it. + const revs = collectSpecEntryRevisions(dir, 'v0'); + expect(revs.map((r) => r.id)).toContain('F-aaa001'); + }); + + test('both revisions of the criteria come back, so a rewrite is computable', () => { + entryWith('goes-done-bbb002.yaml', 'F-bbb002', 'done', [ + {id: 'AC-000002', text: 'The system shall never run the cleanup.', ears: 'unwanted'}, + ]); + commitAll(dir, 'flip the contract and mark done'); + + const rev = collectSpecEntryRevisions(dir, 'v0').find((r) => r.id === 'F-bbb002'); + expect(rev?.statusBefore).toBe('planned'); + expect(rev?.statusAfter).toBe('done'); + expect(rev?.baseAcs[0]?.text).toContain('always run the cleanup'); + expect(rev?.headAcs[0]?.text).toContain('never run the cleanup'); + expect(rev?.baseAcs[0]?.ears).toBe('state'); + expect(rev?.headAcs[0]?.ears).toBe('unwanted'); + }); + + test('an entry added within the range has no base revision', () => { + entryWith('fresh-ccc003.yaml', 'F-ccc003', 'in_progress', [ + {id: 'AC-000003', text: 'The system shall be new here.'}, + ]); + commitAll(dir, 'add an entry'); + + const rev = collectSpecEntryRevisions(dir, 'v0').find((r) => r.id === 'F-ccc003'); + expect(rev?.statusBefore).toBeNull(); + expect(rev?.baseAcs).toEqual([]); + expect(rev?.headAcs).toHaveLength(1); + }); + + test('a deleted entry keeps its base revision and reports no head status', () => { + rmSync(join(dir, 'spec', 'features', 'still-planned-aaa001.yaml')); + commitAll(dir, 'remove an entry'); + + const rev = collectSpecEntryRevisions(dir, 'v0').find((r) => r.id === 'F-aaa001'); + expect(rev?.statusAfter).toBeNull(); + expect(rev?.baseAcs).toHaveLength(1); + expect(rev?.headAcs).toEqual([]); + }); + + test('an untouched entry is absent — the range, not the whole spec', () => { + entryWith('goes-done-bbb002.yaml', 'F-bbb002', 'done', [ + {id: 'AC-000002', text: 'The system shall always run the cleanup.', ears: 'state'}, + ]); + commitAll(dir, 'touch only one entry'); + + expect(collectSpecEntryRevisions(dir, 'v0').map((r) => r.id)).toEqual(['F-bbb002']); + }); + + test('results sort by feature id and repeat byte-identically', () => { + entryWith('zeta-zzz009.yaml', 'F-zzz009', 'planned', [{id: 'AC-000009', text: 'Z.'}]); + entryWith('still-planned-aaa001.yaml', 'F-aaa001', 'in_progress', [ + {id: 'AC-000001', text: 'The system shall hold the original promise.'}, + ]); + commitAll(dir, 'two entries'); + + const once = collectSpecEntryRevisions(dir, 'v0'); + expect(once.map((r) => r.id)).toEqual(['F-aaa001', 'F-zzz009']); + expect(JSON.stringify(once)).toBe(JSON.stringify(collectSpecEntryRevisions(dir, 'v0'))); + }); + + test('an unresolvable ref is an error, never a silently empty population', () => { + expect(() => collectSpecEntryRevisions(dir, 'no-such-ref')).toThrow(/does not resolve/); + }); +}); diff --git a/tests/report/ac-delta.test.ts b/tests/report/ac-delta.test.ts new file mode 100644 index 00000000..8747d0e9 --- /dev/null +++ b/tests/report/ac-delta.test.ts @@ -0,0 +1,163 @@ +// Cladding · unit tests for src/report/ac-delta.ts (F-5dfbac9c) +// +// Written from the acceptance criteria, not the implementation body: synthetic +// revision pairs in, a classification out. +// - AC-c32cbab2 · new / rewritten / removed / unchanged, joined on criterion +// id; a differing text, EARS pattern, or condition is a +// rewrite; a whitespace-only difference is not +// - AC-4faef94d · rows ordered by criterion id, no wall-clock, byte-stable + +import {describe, expect, test} from 'vitest'; + +import type {SpecEntryRevision} from '../../src/changelog/collect.js'; +import {buildSpecEntryDeltas} from '../../src/report/ac-delta.js'; +import type {AcceptanceCriterion} from '../../src/spec/types.js'; + +function ac(id: string, over: Partial = {}): AcceptanceCriterion { + return {id, text: 'the system shall do the thing', ears: 'ubiquitous', ...over}; +} + +function entry( + baseAcs: readonly AcceptanceCriterion[], + headAcs: readonly AcceptanceCriterion[], + over: Partial = {}, +): SpecEntryRevision { + return { + path: 'spec/features/thing-abcd1234.yaml', + id: 'F-abcd1234', + title: 'A thing', + statusBefore: 'planned', + statusAfter: 'done', + baseAcs, + headAcs, + ...over, + }; +} + +/** The single row for `id`, asserted to exist. */ +function row(deltas: ReturnType, id: string) { + const found = deltas[0]?.rows.find((r) => r.id === id); + expect(found, `expected a row for ${id}`).toBeDefined(); + return found!; +} + +describe('AC-c32cbab2 · classifying how each criterion moved', () => { + test('a criterion absent at the base is new', () => { + const d = buildSpecEntryDeltas([entry([], [ac('AC-0001')])]); + expect(row(d, 'AC-0001').kind).toBe('new'); + expect(d[0]?.counts.new).toBe(1); + }); + + test('a criterion absent at HEAD is removed — a silent deletion still reports', () => { + const d = buildSpecEntryDeltas([entry([ac('AC-0001')], [])]); + expect(row(d, 'AC-0001').kind).toBe('removed'); + expect(d[0]?.counts.removed).toBe(1); + }); + + test('an identical criterion is unchanged', () => { + const d = buildSpecEntryDeltas([entry([ac('AC-0001')], [ac('AC-0001')])]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('changed statement text is a rewrite', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {text: 'shall always run the kill'})], [ac('AC-0001', {text: 'shall never run the kill'})]), + ]); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('changed trigger condition is a rewrite even when the text is identical', () => { + const d = buildSpecEntryDeltas([ + entry( + [ac('AC-0001', {ears: 'event', condition: 'when the app exits'})], + [ac('AC-0001', {ears: 'event', condition: 'when the device disconnects'})], + ), + ]); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('a changed EARS pattern is a rewrite and names the shift', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {ears: 'state'})], [ac('AC-0001', {ears: 'unwanted'})]), + ]); + const r = row(d, 'AC-0001'); + expect(r.kind).toBe('rewritten'); + expect(r.earsShift).toBe('state → unwanted'); + }); + + test('an unshifted rewrite carries no pattern annotation', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {text: 'one'})], [ac('AC-0001', {text: 'two'})]), + ]); + expect(row(d, 'AC-0001').earsShift).toBeUndefined(); + }); + + test('whitespace-only differences are not a rewrite — reflowing a line is not a contract change', () => { + const d = buildSpecEntryDeltas([ + entry( + [ac('AC-0001', {text: 'the system shall do\n the thing'})], + [ac('AC-0001', {text: 'the system shall do the thing'})], + ), + ]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('an expanded rationale alone is not a rewrite — notes are outside the contract key', () => { + const d = buildSpecEntryDeltas([ + entry([ac('AC-0001', {notes: 'brief'})], [ac('AC-0001', {notes: 'a much longer WHY'})]), + ]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + + test('the id is the join key — a polarity flip under a held id reads as one rewrite, not add+remove', () => { + // The live reversal that motivated the feature: text flipped, pattern moved + // state → unwanted, id unchanged. + const d = buildSpecEntryDeltas([ + entry( + [ac('AC-d7eb3f', {ears: 'state', text: 'the system shall still run adb kill-server'})], + [ac('AC-d7eb3f', {ears: 'unwanted', text: 'the system shall never issue adb kill-server'})], + ), + ]); + expect(d[0]?.counts).toEqual({new: 0, rewritten: 1, removed: 0, unchanged: 0}); + }); + + test('the status transition rides along with the delta', () => { + const d = buildSpecEntryDeltas([entry([], [], {statusBefore: 'planned', statusAfter: 'done'})]); + expect(d[0]?.statusBefore).toBe('planned'); + expect(d[0]?.statusAfter).toBe('done'); + }); + + test('an entry added within the range has a null base status', () => { + const d = buildSpecEntryDeltas([entry([], [ac('AC-0001')], {statusBefore: null})]); + expect(d[0]?.statusBefore).toBeNull(); + expect(row(d, 'AC-0001').kind).toBe('new'); + }); +}); + +describe('AC-4faef94d · deterministic ordering', () => { + test('rows sort by criterion id regardless of authored order', () => { + const d = buildSpecEntryDeltas([ + entry([], [ac('AC-zzzz'), ac('AC-aaaa'), ac('AC-mmmm')]), + ]); + expect(d[0]?.rows.map((r) => r.id)).toEqual(['AC-aaaa', 'AC-mmmm', 'AC-zzzz']); + }); + + test('entries sort by feature id', () => { + const d = buildSpecEntryDeltas([ + entry([], [], {id: 'F-cccc'}), + entry([], [], {id: 'F-aaaa'}), + ]); + expect(d.map((x) => x.id)).toEqual(['F-aaaa', 'F-cccc']); + }); + + test('two builds over the same input serialize byte-identically', () => { + const input = [entry([ac('AC-0002')], [ac('AC-0001'), ac('AC-0002', {text: 'moved'})])]; + expect(JSON.stringify(buildSpecEntryDeltas(input))).toBe( + JSON.stringify(buildSpecEntryDeltas(input)), + ); + }); + + test('an empty range yields an empty delta, not a throw', () => { + expect(buildSpecEntryDeltas([])).toEqual([]); + }); +}); diff --git a/tests/report/report-cli.test.ts b/tests/report/report-cli.test.ts index 0bccd59c..99a8be8a 100644 --- a/tests/report/report-cli.test.ts +++ b/tests/report/report-cli.test.ts @@ -180,3 +180,115 @@ describe('clad report — pipe safety (structural pin)', () => { expect(src).not.toContain('process.exit(0)'); }); }); + +describe('AC-1a6cb22f / AC-4b6fe145 / AC-8e748acb · anchoring the range on the fork point', () => { + let dir: string; + + function mkShard(id: string, slug: string, status: string, text: string): string { + return [ + `id: ${id}`, + `slug: ${slug}`, + `title: "${slug}"`, + `status: ${status}`, + 'acceptance_criteria:', + ' - id: AC-000001', + ' ears: ubiquitous', + ` text: "${text}"`, + '', + ].join('\n'); + } + + beforeAll(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-report-fork-')); + git(dir, ['init', '-q']); + git(dir, ['config', 'user.email', 'test@example.com']); + git(dir, ['config', 'user.name', 'test']); + git(dir, ['config', 'commit.gpgsign', 'false']); + git(dir, ['config', 'init.defaultBranch', 'main']); + git(dir, ['checkout', '-q', '-b', 'main']); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + + writeFileSync(join(dir, 'spec.yaml'), SPEC_YAML); + writeFileSync( + join(dir, 'spec', 'features', 'mine-aaaa1111.yaml'), + mkShard('F-aaaa1111', 'mine', 'planned', 'The system shall do my thing.'), + ); + writeFileSync( + join(dir, 'spec', 'features', 'theirs-bbbb2222.yaml'), + mkShard('F-bbbb2222', 'theirs', 'planned', 'The system shall do their thing.'), + ); + git(dir, ['add', '-A']); + git(dir, ['commit', '-q', '-m', 'baseline']); + git(dir, ['tag', 'v0']); + + // The BASE branch moves on after the fork — someone else rewrites their + // own entry's criterion. This must never be charged to our branch. + writeFileSync( + join(dir, 'spec', 'features', 'theirs-bbbb2222.yaml'), + mkShard('F-bbbb2222', 'theirs', 'done', 'The system shall do their thing DIFFERENTLY.'), + ); + git(dir, ['add', '-A']); + git(dir, ['commit', '-q', '-m', 'their work on main']); + + // Our branch forks from v0 and rewrites only our own entry. + git(dir, ['checkout', '-q', '-b', 'feature/mine', 'v0']); + writeFileSync( + join(dir, 'spec', 'features', 'mine-aaaa1111.yaml'), + mkShard('F-aaaa1111', 'mine', 'done', 'The system shall do my thing REVISED.'), + ); + git(dir, ['add', '-A']); + git(dir, ['commit', '-q', '-m', 'my work']); + }); + + afterAll(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test("AC-1a6cb22f · the base branch's own rewrite is not attributed to this range", () => { + const ran = runClad(dir, ['report', '--since', 'main', '--format', 'json']); + expect(ran.status).toBe(0); + const model = JSON.parse(ran.stdout) as { + specEntryDeltas: {id: string; counts: {rewritten: number}}[]; + }; + const ids = model.specEntryDeltas.map((d) => d.id); + expect(ids).toContain('F-aaaa1111'); + // Diffing tip-to-tip would report F-bbbb2222 as REMOVED-and-rewritten here; + // anchoring on the merge base leaves their work out of our packet. + expect(ids).not.toContain('F-bbbb2222'); + }); + + test('AC-1a6cb22f · our own rewrite is still reported', () => { + const ran = runClad(dir, ['report', '--since', 'main', '--format', 'json']); + const model = JSON.parse(ran.stdout) as { + specEntryDeltas: {id: string; counts: {rewritten: number}}[]; + }; + expect(model.specEntryDeltas.find((d) => d.id === 'F-aaaa1111')?.counts.rewritten).toBe(1); + }); + + test('AC-4b6fe145 · a shallow clone with no merge base still renders a packet', () => { + const shallow = mkdtempSync(join(tmpdir(), 'clad-report-shallow-')); + try { + execFileSync('git', ['clone', '-q', '--depth', '1', `file://${dir}`, shallow, '--branch', 'feature/mine'], { + encoding: 'utf8', + }); + const head = execFileSync('git', ['rev-parse', 'HEAD'], {cwd: shallow, encoding: 'utf8'}).trim(); + // No history to walk: `git merge-base HEAD` cannot resolve a fork + // point here, so the helper must fall back to the ref rather than fail. + const ran = runClad(shallow, ['report', '--since', head, '--format', 'md']); + expect(ran.status).toBe(0); + expect(ran.stdout).toContain('## How the acceptance criteria moved'); + } finally { + rmSync(shallow, {recursive: true, force: true}); + } + }); + + test('AC-8e748acb · a rewritten criterion does not change the exit code', () => { + const withRewrite = runClad(dir, ['report', '--since', 'v0']); + expect(withRewrite.status).toBe(0); + expect(withRewrite.stdout).toContain('REWRITTEN AC-000001'); + + // Same command from a state with no spec movement at all — same exit code. + const noMovement = runClad(dir, ['report', '--since', 'HEAD']); + expect(noMovement.status).toBe(0); + }); +}); diff --git a/tests/report/report.test.ts b/tests/report/report.test.ts index 59959ca8..425a10bb 100644 --- a/tests/report/report.test.ts +++ b/tests/report/report.test.ts @@ -10,7 +10,7 @@ import {describe, expect, test} from 'vitest'; -import type {ChangelogManifest} from '../../src/changelog/collect.js'; +import type {ChangelogManifest, SpecEntryRevision} from '../../src/changelog/collect.js'; import { buildReportModel, renderReportMarkdown, @@ -217,3 +217,133 @@ describe('report/report — blank-ledger disclosure (AC-41572299)', () => { expect(md).not.toContain('dependency ledger is empty'); }); }); + +describe('AC-e68c868a · declared tests and whether they moved with the code', () => { + /** One touched entry whose single criterion declares `refs`. */ + function entryDeclaring(refs: readonly string[]): SpecEntryRevision { + return { + path: 'spec/features/thing-abcd1234.yaml', + id: 'F-abcd1234', + title: 'A thing', + statusBefore: 'planned', + statusAfter: 'done', + baseAcs: [], + headAcs: [{id: 'AC-0001', text: 'shall do the thing', test_refs: refs}], + }; + } + + function statesFor(refs: readonly string[], changed: readonly string[]) { + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(refs)], changedPaths: changed}), + ); + return model.testRefRows.map((r) => r.state); + } + + test('a declared test that also changed in the range reads as co-changed', () => { + expect(statesFor(['tests/thing.test.ts'], ['tests/thing.test.ts'])).toEqual(['co-changed']); + }); + + test('a declared test that did not change reads as unchanged', () => { + expect(statesFor(['tests/thing.test.ts'], ['src/thing.ts'])).toEqual(['unchanged']); + }); + + test('an anchored reference resolves on its file path, not the whole string', () => { + expect(statesFor(['tests/thing.test.ts#some case'], ['tests/thing.test.ts'])).toEqual([ + 'co-changed', + ]); + }); + + test('a harness-written placeholder is never reported as an untouched test', () => { + // `clad sync` writes `derived:` refs as unconfirmed suggestions. Rendering + // one as "declared but did not change" would pass a harness guess off as a + // reviewed fact. + for (const pseudo of ['derived:tests/thing.test.ts', 'fixture:NAME', 'script:build', 'self-dogfood:x']) { + expect(statesFor([pseudo], [])).toEqual(['placeholder']); + } + }); + + test('the row keeps the reference exactly as authored, anchor included', () => { + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(['tests/thing.test.ts#some case'])], changedPaths: []}), + ); + expect(model.testRefRows[0]?.ref).toBe('tests/thing.test.ts#some case'); + expect(model.testRefRows[0]?.acId).toBe('AC-0001'); + expect(model.testRefRows[0]?.featureId).toBe('F-abcd1234'); + }); + + test('rows sort by feature, then criterion, then reference', () => { + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(['tests/z.test.ts', 'tests/a.test.ts'])], changedPaths: []}), + ); + expect(model.testRefRows.map((r) => r.ref)).toEqual(['tests/a.test.ts', 'tests/z.test.ts']); + }); + + test('the section renders and states which files moved', () => { + const md = renderReportMarkdown( + buildReportModel( + mkInputs({specEntries: [entryDeclaring(['tests/thing.test.ts'])], changedPaths: ['tests/thing.test.ts']}), + ), + META, + ); + expect(md).toContain('## Declared tests'); + expect(md).toContain('tests/thing.test.ts'); + }); + + test('a range with no touched entry says so rather than rendering an empty list', () => { + const md = renderReportMarkdown(buildReportModel(mkInputs()), META); + expect(md).toContain('No touched entry declares a test.'); + }); + + test('the packet grades nothing — a production path declared as a test gets the same states as any other', () => { + // Whether a declared test genuinely verifies its criterion is not + // mechanically decidable, so the packet reports movement and withholds + // judgement. A criterion pointing at production source must therefore be + // described exactly like one pointing at a test file. + const model = buildReportModel( + mkInputs({specEntries: [entryDeclaring(['src/thing.ts'])], changedPaths: []}), + ); + expect(model.testRefRows.map((r) => r.state)).toEqual(['unchanged']); + + const md = renderReportMarkdown(model, META); + const section = md.slice(md.indexOf('## Declared tests')); + for (const verdict of ['circular', 'vacuous', 'invalid', 'FAIL', 'suspect']) { + expect(section).not.toContain(verdict); + } + }); +}); + +describe('AC-c32cbab2 · the criterion-movement section in the rendered packet', () => { + test('the section names the status transition and every non-unchanged criterion', () => { + const md = renderReportMarkdown( + buildReportModel( + mkInputs({ + specEntries: [ + { + path: 'spec/features/thing-abcd1234.yaml', + id: 'F-abcd1234', + title: 'A thing', + statusBefore: 'planned', + statusAfter: 'done', + baseAcs: [{id: 'AC-0001', text: 'shall always', ears: 'state'}], + headAcs: [ + {id: 'AC-0001', text: 'shall never', ears: 'unwanted'}, + {id: 'AC-0002', text: 'a fresh one'}, + ], + }, + ], + }), + ), + META, + ); + expect(md).toContain('## How the acceptance criteria moved'); + expect(md).toContain('planned → done'); + expect(md).toContain('REWRITTEN AC-0001'); + expect(md).toContain('state → unwanted'); + expect(md).toContain('NEW AC-0002'); + }); + + test('a range that moved no spec entry says so', () => { + const md = renderReportMarkdown(buildReportModel(mkInputs()), META); + expect(md).toContain('No feature spec entry changed in this range.'); + }); +}); From 37e8a0346af741919d369283894630242266526b Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Mon, 3 Aug 2026 11:53:50 +0900 Subject: [PATCH 2/8] fix(arch): scan source, not build output, for circular dependencies (F-2c02991f) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bundler's output legitimately contains mutual imports — that is what bundling produces. The architecture gate was scanning it anyway, so it reported cycles that exist in no hand-written file and blocked the gate on them. One adopter hit this five times. Every one of the five was inside a version-ignored Vite bundle: 100% false with respect to source. They could not find the cause, recorded the wrong one, and the issue is still open sixteen days later; they eventually worked around it alone with a hand-written .madgerc buried in an unrelated commit. A second adopter reproduces the same shape today, four cycles for four, all in dist/assets. The TS/JS arch gate now excludes generated build output — dist, build, out, coverage, target, .next, .nuxt, .output, .svelte-kit, .vite — anchored at the repository root, so a source directory that merely happens to be named build/ deeper in the tree is still scanned. It does not do this when the project configures the scanner itself. madge REPLACES its configured excludeRegExp with the command-line flag rather than merging, so passing ours unconditionally would silently delete an adopter's own rules — including the workaround the adopter above is currently relying on. The scan root deliberately stays the repository root. Narrowing it to a named source directory was measured to be worse than the defect it fixes: a missing directory makes madge exit ENOENT, which classifies as a scanner setup gap and skips the whole stage — a green gate that checked nothing. One adopter's front-end has exactly that layout. Measured, before and after: adopter front-end 4 cycles -> 0 (209 -> 197 files scanned); cladding itself 0 -> 0 (992 -> 596), i.e. no false negatives; the guarded adopter is untouched. The change can only remove findings, never add one. docs/gate-scope.md now names .madgerc and package.json#madge as the override — the word "madgerc" appeared nowhere in this repository before, which is why the adopter had to discover it alone. Co-Authored-By: Claude Opus 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- docs/gate-scope.md | 15 + plugins/claude-code/dist/clad.js | 526 +++++++++--------- spec.yaml | 2 +- spec/attestation.yaml | 19 +- ...arch-gate-skips-build-output-2c02991f.yaml | 35 ++ spec/index.yaml | 1 + src/stages/toolchain/detect.ts | 53 +- tests/stages/toolchain.test.ts | 80 ++- 14 files changed, 468 insertions(+), 287 deletions(-) create mode 100644 spec/features/arch-gate-skips-build-output-2c02991f.yaml diff --git a/README.html b/README.html index 7dc971b3..f26b9d1c 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2774/2774
+
2779/2779
all pass
diff --git a/README.ja.md b/README.ja.md index 93319d2c..eb543de0 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 | 15 段階 · 41 detectors | 272(268 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 | 15 段階 · 41 detectors | 273(269 done) | 248 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 31fe3c14..06b40fba 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2774/2774
+
2779/2779
all pass
diff --git a/README.ko.md b/README.ko.md index 0a59bd22..030ef196 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 · all pass | 15 단계 · 41 detectors | 272 · 268 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | 248 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index dd9064e6..074bb223 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 | 15 stages · 41 detectors | 272 (268 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 | 15 stages · 41 detectors | 273 (269 done) | 248 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 0522792c..b37e8c65 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2774 / 2774 | 15 阶段 · 41 检测器 | 272(268 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 | 15 阶段 · 41 检测器 | 273(269 done) | 248 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/gate-scope.md b/docs/gate-scope.md index e145ec00..8c347bc3 100644 --- a/docs/gate-scope.md +++ b/docs/gate-scope.md @@ -110,6 +110,21 @@ gate: Precedence, highest first: explicit per-call `cmd` override → `gate.commands` → auto module-scope → repo gate. +## Architecture stage — what it scans in a TS/JS project + +The circular-dependency scan runs from the repository root and **skips generated +build output** — `dist/`, `build/`, `out/`, `coverage/`, `target/`, `.next/`, +`.nuxt/`, `.output/`, `.svelte-kit/`, `.vite/` — matched at the root only, so a +source directory that merely happens to be named `build/` deeper in the tree is +still scanned. A bundler's output legitimately contains mutual imports, and +scanning it reports cycles that exist in no hand-written file. + +**To control this yourself**, declare a `.madgerc` (or a `madge` block in +`package.json`) with your own `excludeRegExp`. When you do, cladding passes no +exclusion of its own and your rules are the only ones in force — madge *replaces* +its configured exclusions with a command-line flag rather than merging them, so +the two cannot coexist. + ## Backward compatibility Non-Gradle languages, modules-less features, and `gate.scope: repo` all run diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 0f50d030..f285b93d 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,11 +4,11 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var Kde=Object.create;var OA=Object.defineProperty;var Jde=Object.getOwnPropertyDescriptor;var Yde=Object.getOwnPropertyNames;var Xde=Object.getPrototypeOf,Qde=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{for(var r in e)OA(t,r,{get:e[r],enumerable:!0})},efe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Yde(e))!Qde.call(t,i)&&i!==r&&OA(t,i,{get:()=>e[i],enumerable:!(n=Jde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Kde(Xde(t)):{},efe(e||!t||!t.__esModule?OA(r,"default",{value:t,enumerable:!0}):r,t));var af=v(IA=>{var wy=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},RA=class extends wy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};IA.CommanderError=wy;IA.InvalidArgumentError=RA});var xy=v(CA=>{var{InvalidArgumentError:tfe}=af(),PA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new tfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function rfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}CA.Argument=PA;CA.humanReadableArgName=rfe});var jA=v(NA=>{var{humanReadableArgName:nfe}=xy(),DA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>nfe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +var Kde=Object.create;var OA=Object.defineProperty;var Jde=Object.getOwnPropertyDescriptor;var Yde=Object.getOwnPropertyNames;var Xde=Object.getPrototypeOf,Qde=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{for(var r in e)OA(t,r,{get:e[r],enumerable:!0})},efe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Yde(e))!Qde.call(t,i)&&i!==r&&OA(t,i,{get:()=>e[i],enumerable:!(n=Jde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Kde(Xde(t)):{},efe(e||!t||!t.__esModule?OA(r,"default",{value:t,enumerable:!0}):r,t));var cf=v(IA=>{var wy=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},RA=class extends wy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};IA.CommanderError=wy;IA.InvalidArgumentError=RA});var xy=v(CA=>{var{InvalidArgumentError:tfe}=cf(),PA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new tfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function rfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}CA.Argument=PA;CA.humanReadableArgName=rfe});var jA=v(NA=>{var{humanReadableArgName:nfe}=xy(),DA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>nfe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` `)}displayWidth(e){return h4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function h4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}NA.Help=DA;NA.stripColor=h4});var zA=v(LA=>{var{InvalidArgumentError:ife}=af(),MA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ofe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ife(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?g4(this.name().replace(/^no-/,"")):g4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},FA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function g4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function ofe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function h4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}NA.Help=DA;NA.stripColor=h4});var zA=v(LA=>{var{InvalidArgumentError:ife}=cf(),MA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ofe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ife(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?g4(this.name().replace(/^no-/,"")):g4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},FA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function g4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function ofe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} @@ -16,7 +16,7 @@ ${s}`)}boxWrap(e,r){if(r{function sfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function afe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=sfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}y4.suggestSimilar=afe});var w4=v(GA=>{var cfe=Ge("node:events").EventEmitter,UA=Ge("node:child_process"),fo=Ge("node:path"),$y=Ge("node:fs"),Be=Ge("node:process"),{Argument:lfe,humanReadableArgName:ufe}=xy(),{CommanderError:qA}=af(),{Help:dfe,stripColor:ffe}=jA(),{Option:b4,DualOptions:pfe}=zA(),{suggestSimilar:v4}=_4(),BA=class t extends cfe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>HA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>HA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>ffe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new dfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +(Did you mean ${n[0]}?)`:""}y4.suggestSimilar=afe});var w4=v(GA=>{var cfe=Ge("node:events").EventEmitter,UA=Ge("node:child_process"),fo=Ge("node:path"),$y=Ge("node:fs"),Be=Ge("node:process"),{Argument:lfe,humanReadableArgName:ufe}=xy(),{CommanderError:qA}=cf(),{Help:dfe,stripColor:ffe}=jA(),{Option:b4,DualOptions:pfe}=zA(),{suggestSimilar:v4}=_4(),BA=class t extends cfe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>HA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>HA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>ffe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new dfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new lfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new qA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new b4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof b4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. @@ -29,23 +29,23 @@ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._life `),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new pfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=v4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=v4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>ufe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=fo.basename(e,fo.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function S4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function HA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}GA.Command=BA;GA.useColor=HA});var E4=v(An=>{var{Argument:x4}=xy(),{Command:ZA}=w4(),{CommanderError:mfe,InvalidArgumentError:$4}=af(),{Help:hfe}=jA(),{Option:k4}=zA();An.program=new ZA;An.createCommand=t=>new ZA(t);An.createOption=(t,e)=>new k4(t,e);An.createArgument=(t,e)=>new x4(t,e);An.Command=ZA;An.Option=k4;An.Argument=x4;An.Help=hfe;An.CommanderError=mfe;An.InvalidArgumentError=$4;An.InvalidOptionArgumentError=$4});var De=v(Qt=>{"use strict";var WA=Symbol.for("yaml.alias"),R4=Symbol.for("yaml.document"),ky=Symbol.for("yaml.map"),I4=Symbol.for("yaml.pair"),KA=Symbol.for("yaml.scalar"),Ey=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),Sfe=t=>!!t&&typeof t=="object"&&t[po]===WA,wfe=t=>!!t&&typeof t=="object"&&t[po]===R4,xfe=t=>!!t&&typeof t=="object"&&t[po]===ky,$fe=t=>!!t&&typeof t=="object"&&t[po]===I4,P4=t=>!!t&&typeof t=="object"&&t[po]===KA,kfe=t=>!!t&&typeof t=="object"&&t[po]===Ey;function C4(t){if(t&&typeof t=="object")switch(t[po]){case ky:case Ey:return!0}return!1}function Efe(t){if(t&&typeof t=="object")switch(t[po]){case WA:case ky:case KA:case Ey:return!0}return!1}var Afe=t=>(P4(t)||C4(t))&&!!t.anchor;Qt.ALIAS=WA;Qt.DOC=R4;Qt.MAP=ky;Qt.NODE_TYPE=po;Qt.PAIR=I4;Qt.SCALAR=KA;Qt.SEQ=Ey;Qt.hasAnchor=Afe;Qt.isAlias=Sfe;Qt.isCollection=C4;Qt.isDocument=wfe;Qt.isMap=xfe;Qt.isNode=Efe;Qt.isPair=$fe;Qt.isScalar=P4;Qt.isSeq=kfe});var cf=v(JA=>{"use strict";var Ut=De(),Dr=Symbol("break visit"),D4=Symbol("skip children"),Ai=Symbol("remove node");function Ay(t,e){let r=N4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}Ay.BREAK=Dr;Ay.SKIP=D4;Ay.REMOVE=Ai;function Qc(t,e,r,n){let i=j4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return M4(t,n,i),Qc(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var F4=De(),Tfe=cf(),Ofe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rfe=t=>t.replace(/[!,[\]{}]/g,e=>Ofe[e]),lf=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Rfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&F4.isNode(e.contents)){let o={};Tfe.visit(e.contents,(s,a)=>{F4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};lf.defaultYaml={explicit:!1,version:"1.2"};lf.defaultTags={"!!":"tag:yaml.org,2002:"};L4.Directives=lf});var Oy=v(uf=>{"use strict";var z4=De(),Ife=cf();function Pfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function U4(t){let e=new Set;return Ife.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function q4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Cfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=U4(t));let s=q4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(z4.isScalar(s.node)||z4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}uf.anchorIsValid=Pfe;uf.anchorNames=U4;uf.createNodeAnchors=Cfe;uf.findNewAnchor=q4});var XA=v(B4=>{"use strict";function df(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Dfe=De();function H4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>H4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Dfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}G4.toJS=H4});var Ry=v(V4=>{"use strict";var Nfe=XA(),Z4=De(),jfe=Zo(),QA=class{constructor(e){Object.defineProperty(this,Z4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!Z4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=jfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Nfe.applyReviver(o,{"":a},"",a):a}};V4.NodeBase=QA});var ff=v(W4=>{"use strict";var Mfe=Oy(),Ffe=cf(),tl=De(),Lfe=Ry(),zfe=Zo(),eT=class extends Lfe.NodeBase{constructor(e){super(tl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Ffe.visit(e,{Node:(o,s)=>{(tl.isAlias(s)||tl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(zfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Iy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Mfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Iy(t,e,r){if(tl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(tl.isCollection(e)){let n=0;for(let i of e.items){let o=Iy(t,i,r);o>n&&(n=o)}return n}else if(tl.isPair(e)){let n=Iy(t,e.key,r),i=Iy(t,e.value,r);return Math.max(n,i)}return 1}W4.Alias=eT});var Dt=v(tT=>{"use strict";var Ufe=De(),qfe=Ry(),Bfe=Zo(),Hfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends qfe.NodeBase{constructor(e){super(Ufe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Bfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Vo.BLOCK_FOLDED="BLOCK_FOLDED";Vo.BLOCK_LITERAL="BLOCK_LITERAL";Vo.PLAIN="PLAIN";Vo.QUOTE_DOUBLE="QUOTE_DOUBLE";Vo.QUOTE_SINGLE="QUOTE_SINGLE";tT.Scalar=Vo;tT.isScalarValue=Hfe});var pf=v(J4=>{"use strict";var Gfe=ff(),fa=De(),K4=Dt(),Zfe="tag:yaml.org,2002:";function Vfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Wfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Gfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Zfe+e.slice(2));let l=Vfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new K4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new K4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}J4.createNode=Wfe});var Cy=v(Py=>{"use strict";var Kfe=pf(),Ti=De(),Jfe=Ry();function rT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Kfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Y4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nT=class extends Jfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Y4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Ti.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Ti.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Py.Collection=nT;Py.collectionFromPath=rT;Py.isEmptyPath=Y4});var mf=v(Dy=>{"use strict";var Yfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function iT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Xfe=(t,e,r)=>t.endsWith(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function S4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function HA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}GA.Command=BA;GA.useColor=HA});var E4=v(An=>{var{Argument:x4}=xy(),{Command:ZA}=w4(),{CommanderError:mfe,InvalidArgumentError:$4}=cf(),{Help:hfe}=jA(),{Option:k4}=zA();An.program=new ZA;An.createCommand=t=>new ZA(t);An.createOption=(t,e)=>new k4(t,e);An.createArgument=(t,e)=>new x4(t,e);An.Command=ZA;An.Option=k4;An.Argument=x4;An.Help=hfe;An.CommanderError=mfe;An.InvalidArgumentError=$4;An.InvalidOptionArgumentError=$4});var De=v(Qt=>{"use strict";var WA=Symbol.for("yaml.alias"),R4=Symbol.for("yaml.document"),ky=Symbol.for("yaml.map"),I4=Symbol.for("yaml.pair"),KA=Symbol.for("yaml.scalar"),Ey=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),Sfe=t=>!!t&&typeof t=="object"&&t[po]===WA,wfe=t=>!!t&&typeof t=="object"&&t[po]===R4,xfe=t=>!!t&&typeof t=="object"&&t[po]===ky,$fe=t=>!!t&&typeof t=="object"&&t[po]===I4,P4=t=>!!t&&typeof t=="object"&&t[po]===KA,kfe=t=>!!t&&typeof t=="object"&&t[po]===Ey;function C4(t){if(t&&typeof t=="object")switch(t[po]){case ky:case Ey:return!0}return!1}function Efe(t){if(t&&typeof t=="object")switch(t[po]){case WA:case ky:case KA:case Ey:return!0}return!1}var Afe=t=>(P4(t)||C4(t))&&!!t.anchor;Qt.ALIAS=WA;Qt.DOC=R4;Qt.MAP=ky;Qt.NODE_TYPE=po;Qt.PAIR=I4;Qt.SCALAR=KA;Qt.SEQ=Ey;Qt.hasAnchor=Afe;Qt.isAlias=Sfe;Qt.isCollection=C4;Qt.isDocument=wfe;Qt.isMap=xfe;Qt.isNode=Efe;Qt.isPair=$fe;Qt.isScalar=P4;Qt.isSeq=kfe});var lf=v(JA=>{"use strict";var Ut=De(),Dr=Symbol("break visit"),D4=Symbol("skip children"),Ai=Symbol("remove node");function Ay(t,e){let r=N4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}Ay.BREAK=Dr;Ay.SKIP=D4;Ay.REMOVE=Ai;function Qc(t,e,r,n){let i=j4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return M4(t,n,i),Qc(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var F4=De(),Tfe=lf(),Ofe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rfe=t=>t.replace(/[!,[\]{}]/g,e=>Ofe[e]),uf=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Rfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&F4.isNode(e.contents)){let o={};Tfe.visit(e.contents,(s,a)=>{F4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};uf.defaultYaml={explicit:!1,version:"1.2"};uf.defaultTags={"!!":"tag:yaml.org,2002:"};L4.Directives=uf});var Oy=v(df=>{"use strict";var z4=De(),Ife=lf();function Pfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function U4(t){let e=new Set;return Ife.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function q4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Cfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=U4(t));let s=q4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(z4.isScalar(s.node)||z4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}df.anchorIsValid=Pfe;df.anchorNames=U4;df.createNodeAnchors=Cfe;df.findNewAnchor=q4});var XA=v(B4=>{"use strict";function ff(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Dfe=De();function H4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>H4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Dfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}G4.toJS=H4});var Ry=v(V4=>{"use strict";var Nfe=XA(),Z4=De(),jfe=Vo(),QA=class{constructor(e){Object.defineProperty(this,Z4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!Z4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=jfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Nfe.applyReviver(o,{"":a},"",a):a}};V4.NodeBase=QA});var pf=v(W4=>{"use strict";var Mfe=Oy(),Ffe=lf(),tl=De(),Lfe=Ry(),zfe=Vo(),eT=class extends Lfe.NodeBase{constructor(e){super(tl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Ffe.visit(e,{Node:(o,s)=>{(tl.isAlias(s)||tl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(zfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Iy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Mfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Iy(t,e,r){if(tl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(tl.isCollection(e)){let n=0;for(let i of e.items){let o=Iy(t,i,r);o>n&&(n=o)}return n}else if(tl.isPair(e)){let n=Iy(t,e.key,r),i=Iy(t,e.value,r);return Math.max(n,i)}return 1}W4.Alias=eT});var Dt=v(tT=>{"use strict";var Ufe=De(),qfe=Ry(),Bfe=Vo(),Hfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends qfe.NodeBase{constructor(e){super(Ufe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Bfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";tT.Scalar=Wo;tT.isScalarValue=Hfe});var mf=v(J4=>{"use strict";var Gfe=pf(),fa=De(),K4=Dt(),Zfe="tag:yaml.org,2002:";function Vfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Wfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Gfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Zfe+e.slice(2));let l=Vfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new K4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new K4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}J4.createNode=Wfe});var Cy=v(Py=>{"use strict";var Kfe=mf(),Ti=De(),Jfe=Ry();function rT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Kfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Y4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nT=class extends Jfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Y4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Ti.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Ti.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Py.Collection=nT;Py.collectionFromPath=rT;Py.isEmptyPath=Y4});var hf=v(Dy=>{"use strict";var Yfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function iT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Xfe=(t,e,r)=>t.endsWith(` `)?iT(r,e):r.includes(` `)?` -`+iT(r,e):(t.endsWith(" ")?"":" ")+r;Dy.indentComment=iT;Dy.lineComment=Xfe;Dy.stringifyComment=Yfe});var Q4=v(hf=>{"use strict";var Qfe="flow",oT="block",Ny="quoted";function epe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===oT&&(h=X4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Ny&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`+iT(r,e):(t.endsWith(" ")?"":" ")+r;Dy.indentComment=iT;Dy.lineComment=Xfe;Dy.stringifyComment=Yfe});var Q4=v(gf=>{"use strict";var Qfe="flow",oT="block",Ny="quoted";function epe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===oT&&(h=X4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Ny&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` `)r===oT&&(h=X4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` `&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Ny){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Jn=Dt(),Wo=Q4(),My=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Fy=t=>/^(%|---|\.\.\.)/m.test(t);function tpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function gf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Fy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length{"use strict";var Jn=Dt(),Ko=Q4(),My=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Fy=t=>/^(%|---|\.\.\.)/m.test(t);function tpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function yf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Fy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length{O=!0});let A=Wo.foldFlowLines(`${_}${w}${p}`,l,Wo.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=My(n,!0);s!=="folded"&&e!==Jn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Ko.foldFlowLines(`${_}${w}${p}`,l,Ko.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function rpe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` `)||u&&/[[\]{},]/.test(o))return rl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` `)?rl(o,e):jy(t,e,r,n);if(!a&&!u&&i!==Jn.Scalar.PLAIN&&o.includes(` `))return jy(t,e,r,n);if(Fy(o)){if(c==="")return e.forceBlockIndent=!0,jy(t,e,r,n);if(a&&c===l)return rl(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return rl(o,e)}return a?d:Wo.foldFlowLines(d,c,Wo.FOLD_FLOW,My(e,!1))}function npe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):jy(s,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return gf(s.value,e);case Jn.Scalar.QUOTE_SINGLE:return sT(s.value,e);case Jn.Scalar.PLAIN:return rpe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}e6.stringifyString=npe});var _f=v(cT=>{"use strict";var ipe=Oy(),Ko=De(),ope=mf(),spe=yf();function ape(t,e){let r=Object.assign({blockQuote:!0,commentString:ope.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function cpe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Ko.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function lpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&ipe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function upe(t,e,r,n){if(Ko.isPair(t))return t.toString(e,r,n);if(Ko.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Ko.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=cpe(e.doc.schema.tags,o));let s=lpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Ko.isScalar(o)?spe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Ko.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}cT.createStringifyContext=ape;cT.stringify=upe});var i6=v(n6=>{"use strict";var mo=De(),t6=Dt(),r6=_f(),bf=mf();function dpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=mo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mo.isCollection(t)||!mo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||mo.isCollection(t)||(mo.isScalar(t)?t.type===t6.Scalar.BLOCK_FOLDED||t.type===t6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=r6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=bf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=bf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=bf.lineComment(g,r.indent,l(f))));let b,_,S;mo.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&mo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=r6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return rl(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,My(e,!1))}function npe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):jy(s,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return yf(s.value,e);case Jn.Scalar.QUOTE_SINGLE:return sT(s.value,e);case Jn.Scalar.PLAIN:return rpe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}e6.stringifyString=npe});var bf=v(cT=>{"use strict";var ipe=Oy(),Jo=De(),ope=hf(),spe=_f();function ape(t,e){let r=Object.assign({blockQuote:!0,commentString:ope.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function cpe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function lpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&ipe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function upe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=cpe(e.doc.schema.tags,o));let s=lpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?spe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}cT.createStringifyContext=ape;cT.stringify=upe});var i6=v(n6=>{"use strict";var mo=De(),t6=Dt(),r6=bf(),vf=hf();function dpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=mo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mo.isCollection(t)||!mo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||mo.isCollection(t)||(mo.isScalar(t)?t.type===t6.Scalar.BLOCK_FOLDED||t.type===t6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=r6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=vf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=vf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=vf.lineComment(g,r.indent,l(f))));let b,_,S;mo.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&mo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=r6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${bf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${vf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` ${r.indent}`}else if(!p&&mo.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let re=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var o6=Ge("process");function fpe(t,...e){t==="debug"&&console.log(...e)}function ppe(t,e){(t==="debug"||t==="warn")&&(typeof o6.emitWarning=="function"?o6.emitWarning(e):console.warn(e))}lT.debug=fpe;lT.warn=ppe});var By=v(qy=>{"use strict";var Uy=De(),s6=Dt(),Ly="<<",zy={identify:t=>t===Ly||typeof t=="symbol"&&t.description===Ly,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new s6.Scalar(Symbol(Ly)),{addToJSMap:a6}),stringify:()=>Ly},mpe=(t,e)=>(zy.identify(e)||Uy.isScalar(e)&&(!e.type||e.type===s6.Scalar.PLAIN)&&zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===zy.tag&&r.default);function a6(t,e,r){let n=c6(t,r);if(Uy.isSeq(n))for(let i of n.items)dT(t,e,i);else if(Array.isArray(n))for(let i of n)dT(t,e,i);else dT(t,e,n)}function dT(t,e,r){let n=c6(t,r);if(!Uy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function c6(t,e){return t&&Uy.isAlias(e)?e.resolve(t.doc,t):e}qy.addMergeToJSMap=a6;qy.isMergeKey=mpe;qy.merge=zy});var pT=v(d6=>{"use strict";var hpe=uT(),l6=By(),gpe=_f(),u6=De(),fT=Zo();function ype(t,e,{key:r,value:n}){if(u6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(l6.isMergeKey(t,r))l6.addMergeToJSMap(t,e,n);else{let i=fT.toJS(r,"",t);if(e instanceof Map)e.set(i,fT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=_pe(r,i,t),s=fT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function _pe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(u6.isNode(t)&&r?.doc){let n=gpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),hpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}d6.addPairToJSMap=ype});var Jo=v(mT=>{"use strict";var f6=pf(),bpe=i6(),vpe=pT(),Hy=De();function Spe(t,e,r){let n=f6.createNode(t,void 0,r),i=f6.createNode(e,void 0,r);return new Gy(n,i)}var Gy=class t{constructor(e,r=null){Object.defineProperty(this,Hy.NODE_TYPE,{value:Hy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Hy.isNode(r)&&(r=r.clone(e)),Hy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return vpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?bpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};mT.Pair=Gy;mT.createPair=Spe});var hT=v(m6=>{"use strict";var pa=De(),p6=_f(),Zy=mf();function wpe(t,e,r){return(e.inFlow??t.flow?$pe:xpe)(t,e,r)}function xpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Zy.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var o6=Ge("process");function fpe(t,...e){t==="debug"&&console.log(...e)}function ppe(t,e){(t==="debug"||t==="warn")&&(typeof o6.emitWarning=="function"?o6.emitWarning(e):console.warn(e))}lT.debug=fpe;lT.warn=ppe});var By=v(qy=>{"use strict";var Uy=De(),s6=Dt(),Ly="<<",zy={identify:t=>t===Ly||typeof t=="symbol"&&t.description===Ly,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new s6.Scalar(Symbol(Ly)),{addToJSMap:a6}),stringify:()=>Ly},mpe=(t,e)=>(zy.identify(e)||Uy.isScalar(e)&&(!e.type||e.type===s6.Scalar.PLAIN)&&zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===zy.tag&&r.default);function a6(t,e,r){let n=c6(t,r);if(Uy.isSeq(n))for(let i of n.items)dT(t,e,i);else if(Array.isArray(n))for(let i of n)dT(t,e,i);else dT(t,e,n)}function dT(t,e,r){let n=c6(t,r);if(!Uy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function c6(t,e){return t&&Uy.isAlias(e)?e.resolve(t.doc,t):e}qy.addMergeToJSMap=a6;qy.isMergeKey=mpe;qy.merge=zy});var pT=v(d6=>{"use strict";var hpe=uT(),l6=By(),gpe=bf(),u6=De(),fT=Vo();function ype(t,e,{key:r,value:n}){if(u6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(l6.isMergeKey(t,r))l6.addMergeToJSMap(t,e,n);else{let i=fT.toJS(r,"",t);if(e instanceof Map)e.set(i,fT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=_pe(r,i,t),s=fT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function _pe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(u6.isNode(t)&&r?.doc){let n=gpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),hpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}d6.addPairToJSMap=ype});var Yo=v(mT=>{"use strict";var f6=mf(),bpe=i6(),vpe=pT(),Hy=De();function Spe(t,e,r){let n=f6.createNode(t,void 0,r),i=f6.createNode(e,void 0,r);return new Gy(n,i)}var Gy=class t{constructor(e,r=null){Object.defineProperty(this,Hy.NODE_TYPE,{value:Hy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Hy.isNode(r)&&(r=r.clone(e)),Hy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return vpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?bpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};mT.Pair=Gy;mT.createPair=Spe});var hT=v(m6=>{"use strict";var pa=De(),p6=bf(),Zy=hf();function wpe(t,e,r){return(e.inFlow??t.flow?$pe:xpe)(t,e,r)}function xpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Zy.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` `)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Zy.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Vy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Zy.indentComment(e(n),t);r.push(o.trimStart())}}m6.stringifyCollection=wpe});var Xo=v(yT=>{"use strict";var kpe=hT(),Epe=pT(),Ape=Cy(),Yo=De(),Wy=Jo(),Tpe=Dt();function vf(t,e){let r=Yo.isScalar(e)?e.value:e;for(let n of t)if(Yo.isPair(n)&&(n.key===e||n.key===r||Yo.isScalar(n.key)&&n.key.value===r))return n}var gT=class extends Ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Wy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Yo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Wy.Pair(e,e?.value):n=new Wy.Pair(e.key,e.value);let i=vf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&Tpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=vf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=vf(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!vf(this.items,e)}set(e,r){this.add(new Wy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Epe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Yo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),kpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};yT.YAMLMap=gT;yT.findPair=vf});var nl=v(g6=>{"use strict";var Ope=De(),h6=Xo(),Rpe={collection:"map",default:!0,nodeClass:h6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ope.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>h6.YAMLMap.from(t,e,r)};g6.map=Rpe});var Qo=v(y6=>{"use strict";var Ipe=pf(),Ppe=hT(),Cpe=Cy(),Jy=De(),Dpe=Dt(),Npe=Zo(),_T=class extends Cpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ky(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ky(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Jy.isScalar(i)?i.value:i}has(e){let r=Ky(e);return typeof r=="number"&&r=0?e:null}y6.YAMLSeq=_T});var il=v(b6=>{"use strict";var jpe=De(),_6=Qo(),Mpe={collection:"seq",default:!0,nodeClass:_6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return jpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>_6.YAMLSeq.from(t,e,r)};b6.seq=Mpe});var Sf=v(v6=>{"use strict";var Fpe=yf(),Lpe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Fpe.stringifyString(t,e,r,n)}};v6.string=Lpe});var Yy=v(x6=>{"use strict";var S6=Dt(),w6={identify:t=>t==null,createNode:()=>new S6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&w6.test.test(t)?t:e.options.nullStr};x6.nullTag=w6});var bT=v(k6=>{"use strict";var zpe=Dt(),$6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new zpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&$6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};k6.boolTag=$6});var ol=v(E6=>{"use strict";function Upe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}E6.stringifyNumber=Upe});var ST=v(Xy=>{"use strict";var qpe=Dt(),vT=ol(),Bpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vT.stringifyNumber},Hpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():vT.stringifyNumber(t)}},Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new qpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:vT.stringifyNumber};Xy.float=Gpe;Xy.floatExp=Hpe;Xy.floatNaN=Bpe});var xT=v(e_=>{"use strict";var A6=ol(),Qy=t=>typeof t=="bigint"||Number.isInteger(t),wT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function T6(t,e,r){let{value:n}=t;return Qy(n)&&n>=0?r+n.toString(e):A6.stringifyNumber(t)}var Zpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>wT(t,2,8,r),stringify:t=>T6(t,8,"0o")},Vpe={identify:Qy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>wT(t,0,10,r),stringify:A6.stringifyNumber},Wpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>wT(t,2,16,r),stringify:t=>T6(t,16,"0x")};e_.int=Vpe;e_.intHex=Wpe;e_.intOct=Zpe});var R6=v(O6=>{"use strict";var Kpe=nl(),Jpe=Yy(),Ype=il(),Xpe=Sf(),Qpe=bT(),$T=ST(),kT=xT(),eme=[Kpe.map,Ype.seq,Xpe.string,Jpe.nullTag,Qpe.boolTag,kT.intOct,kT.int,kT.intHex,$T.floatNaN,$T.floatExp,$T.float];O6.schema=eme});var C6=v(P6=>{"use strict";var tme=Dt(),rme=nl(),nme=il();function I6(t){return typeof t=="bigint"||Number.isInteger(t)}var t_=({value:t})=>JSON.stringify(t),ime=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:t_},{identify:t=>t==null,createNode:()=>new tme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:t_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:t_},{identify:I6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>I6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:t_}],ome={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},sme=[rme.map,nme.seq].concat(ime,ome);P6.schema=sme});var AT=v(D6=>{"use strict";var wf=Ge("buffer"),ET=Dt(),ame=yf(),cme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof wf.Buffer=="function")return wf.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var r_=De(),TT=Jo(),lme=Dt(),ume=Qo();function N6(t,e){if(r_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new TT.Pair(new lme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Vy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Zy.indentComment(e(n),t);r.push(o.trimStart())}}m6.stringifyCollection=wpe});var Qo=v(yT=>{"use strict";var kpe=hT(),Epe=pT(),Ape=Cy(),Xo=De(),Wy=Yo(),Tpe=Dt();function Sf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var gT=class extends Ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Wy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Wy.Pair(e,e?.value):n=new Wy.Pair(e.key,e.value);let i=Sf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Tpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=Sf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Sf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!Sf(this.items,e)}set(e,r){this.add(new Wy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Epe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),kpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};yT.YAMLMap=gT;yT.findPair=Sf});var nl=v(g6=>{"use strict";var Ope=De(),h6=Qo(),Rpe={collection:"map",default:!0,nodeClass:h6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ope.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>h6.YAMLMap.from(t,e,r)};g6.map=Rpe});var es=v(y6=>{"use strict";var Ipe=mf(),Ppe=hT(),Cpe=Cy(),Jy=De(),Dpe=Dt(),Npe=Vo(),_T=class extends Cpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ky(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ky(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Jy.isScalar(i)?i.value:i}has(e){let r=Ky(e);return typeof r=="number"&&r=0?e:null}y6.YAMLSeq=_T});var il=v(b6=>{"use strict";var jpe=De(),_6=es(),Mpe={collection:"seq",default:!0,nodeClass:_6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return jpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>_6.YAMLSeq.from(t,e,r)};b6.seq=Mpe});var wf=v(v6=>{"use strict";var Fpe=_f(),Lpe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Fpe.stringifyString(t,e,r,n)}};v6.string=Lpe});var Yy=v(x6=>{"use strict";var S6=Dt(),w6={identify:t=>t==null,createNode:()=>new S6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&w6.test.test(t)?t:e.options.nullStr};x6.nullTag=w6});var bT=v(k6=>{"use strict";var zpe=Dt(),$6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new zpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&$6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};k6.boolTag=$6});var ol=v(E6=>{"use strict";function Upe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}E6.stringifyNumber=Upe});var ST=v(Xy=>{"use strict";var qpe=Dt(),vT=ol(),Bpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vT.stringifyNumber},Hpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():vT.stringifyNumber(t)}},Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new qpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:vT.stringifyNumber};Xy.float=Gpe;Xy.floatExp=Hpe;Xy.floatNaN=Bpe});var xT=v(e_=>{"use strict";var A6=ol(),Qy=t=>typeof t=="bigint"||Number.isInteger(t),wT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function T6(t,e,r){let{value:n}=t;return Qy(n)&&n>=0?r+n.toString(e):A6.stringifyNumber(t)}var Zpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>wT(t,2,8,r),stringify:t=>T6(t,8,"0o")},Vpe={identify:Qy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>wT(t,0,10,r),stringify:A6.stringifyNumber},Wpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>wT(t,2,16,r),stringify:t=>T6(t,16,"0x")};e_.int=Vpe;e_.intHex=Wpe;e_.intOct=Zpe});var R6=v(O6=>{"use strict";var Kpe=nl(),Jpe=Yy(),Ype=il(),Xpe=wf(),Qpe=bT(),$T=ST(),kT=xT(),eme=[Kpe.map,Ype.seq,Xpe.string,Jpe.nullTag,Qpe.boolTag,kT.intOct,kT.int,kT.intHex,$T.floatNaN,$T.floatExp,$T.float];O6.schema=eme});var C6=v(P6=>{"use strict";var tme=Dt(),rme=nl(),nme=il();function I6(t){return typeof t=="bigint"||Number.isInteger(t)}var t_=({value:t})=>JSON.stringify(t),ime=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:t_},{identify:t=>t==null,createNode:()=>new tme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:t_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:t_},{identify:I6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>I6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:t_}],ome={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},sme=[rme.map,nme.seq].concat(ime,ome);P6.schema=sme});var AT=v(D6=>{"use strict";var xf=Ge("buffer"),ET=Dt(),ame=_f(),cme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof xf.Buffer=="function")return xf.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var r_=De(),TT=Yo(),lme=Dt(),ume=es();function N6(t,e){if(r_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new TT.Pair(new lme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=r_.isPair(n)?n:new TT.Pair(n)}}else e("Expected a sequence for this tag");return t}function j6(t,e,r){let{replacer:n}=r,i=new ume.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(TT.createPair(a,c,r))}return i}var dme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:N6,createNode:j6};n_.createPairs=j6;n_.pairs=dme;n_.resolvePairs=N6});var IT=v(RT=>{"use strict";var M6=De(),OT=Zo(),xf=Xo(),fme=Qo(),F6=i_(),ma=class t extends fme.YAMLSeq{constructor(){super(),this.add=xf.YAMLMap.prototype.add.bind(this),this.delete=xf.YAMLMap.prototype.delete.bind(this),this.get=xf.YAMLMap.prototype.get.bind(this),this.has=xf.YAMLMap.prototype.has.bind(this),this.set=xf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(M6.isPair(i)?(o=OT.toJS(i.key,"",r),s=OT.toJS(i.value,o,r)):o=OT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=F6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var pme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=F6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)M6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};RT.YAMLOMap=ma;RT.omap=pme});var B6=v(PT=>{"use strict";var L6=Dt();function z6({value:t,source:e},r){return e&&(t?U6:q6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var U6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new L6.Scalar(!0),stringify:z6},q6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new L6.Scalar(!1),stringify:z6};PT.falseTag=q6;PT.trueTag=U6});var H6=v(o_=>{"use strict";var mme=Dt(),CT=ol(),hme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:CT.stringifyNumber},gme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():CT.stringifyNumber(t)}},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new mme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:CT.stringifyNumber};o_.float=yme;o_.floatExp=gme;o_.floatNaN=hme});var Z6=v(kf=>{"use strict";var G6=ol(),$f=t=>typeof t=="bigint"||Number.isInteger(t);function s_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function DT(t,e,r){let{value:n}=t;if($f(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return G6.stringifyNumber(t)}var _me={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>s_(t,2,2,r),stringify:t=>DT(t,2,"0b")},bme={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>s_(t,1,8,r),stringify:t=>DT(t,8,"0")},vme={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>s_(t,0,10,r),stringify:G6.stringifyNumber},Sme={identify:$f,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>s_(t,2,16,r),stringify:t=>DT(t,16,"0x")};kf.int=vme;kf.intBin=_me;kf.intHex=Sme;kf.intOct=bme});var jT=v(NT=>{"use strict";var l_=De(),a_=Jo(),c_=Xo(),ha=class t extends c_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;l_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new a_.Pair(e.key,null):r=new a_.Pair(e,null),c_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=c_.findPair(this.items,e);return!r&&l_.isPair(n)?l_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=c_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new a_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(a_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var wme={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(l_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};NT.YAMLSet=ha;NT.set=wme});var FT=v(u_=>{"use strict";var xme=ol();function MT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function V6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return xme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $me={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>MT(t,r),stringify:V6},kme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>MT(t,!1),stringify:V6},W6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(W6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=MT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};u_.floatTime=kme;u_.intTime=$me;u_.timestamp=W6});var Y6=v(J6=>{"use strict";var Eme=nl(),Ame=Yy(),Tme=il(),Ome=Sf(),Rme=AT(),K6=B6(),LT=H6(),d_=Z6(),Ime=By(),Pme=IT(),Cme=i_(),Dme=jT(),zT=FT(),Nme=[Eme.map,Tme.seq,Ome.string,Ame.nullTag,K6.trueTag,K6.falseTag,d_.intBin,d_.intOct,d_.int,d_.intHex,LT.floatNaN,LT.floatExp,LT.float,Rme.binary,Ime.merge,Pme.omap,Cme.pairs,Dme.set,zT.intTime,zT.floatTime,zT.timestamp];J6.schema=Nme});var aB=v(BT=>{"use strict";var tB=nl(),jme=Yy(),rB=il(),Mme=Sf(),Fme=bT(),UT=ST(),qT=xT(),Lme=R6(),zme=C6(),nB=AT(),Ef=By(),iB=IT(),oB=i_(),X6=Y6(),sB=jT(),f_=FT(),Q6=new Map([["core",Lme.schema],["failsafe",[tB.map,rB.seq,Mme.string]],["json",zme.schema],["yaml11",X6.schema],["yaml-1.1",X6.schema]]),eB={binary:nB.binary,bool:Fme.boolTag,float:UT.float,floatExp:UT.floatExp,floatNaN:UT.floatNaN,floatTime:f_.floatTime,int:qT.int,intHex:qT.intHex,intOct:qT.intOct,intTime:f_.intTime,map:tB.map,merge:Ef.merge,null:jme.nullTag,omap:iB.omap,pairs:oB.pairs,seq:rB.seq,set:sB.set,timestamp:f_.timestamp},Ume={"tag:yaml.org,2002:binary":nB.binary,"tag:yaml.org,2002:merge":Ef.merge,"tag:yaml.org,2002:omap":iB.omap,"tag:yaml.org,2002:pairs":oB.pairs,"tag:yaml.org,2002:set":sB.set,"tag:yaml.org,2002:timestamp":f_.timestamp};function qme(t,e,r){let n=Q6.get(e);if(n&&!t)return r&&!n.includes(Ef.merge)?n.concat(Ef.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Q6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Ef.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?eB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(eB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}BT.coreKnownTags=Ume;BT.getTags=qme});var ZT=v(cB=>{"use strict";var HT=De(),Bme=nl(),Hme=il(),Gme=Sf(),p_=aB(),Zme=(t,e)=>t.keye.key?1:0,GT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?p_.getTags(e,"compat"):e?p_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?p_.coreKnownTags:{},this.tags=p_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,HT.MAP,{value:Bme.map}),Object.defineProperty(this,HT.SCALAR,{value:Gme.string}),Object.defineProperty(this,HT.SEQ,{value:Hme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Zme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};cB.Schema=GT});var uB=v(lB=>{"use strict";var Vme=De(),VT=_f(),Af=mf();function Wme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=VT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Af.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Vme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Af.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=VT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Af.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(VT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(Af.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Af.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=r_.isPair(n)?n:new TT.Pair(n)}}else e("Expected a sequence for this tag");return t}function j6(t,e,r){let{replacer:n}=r,i=new ume.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(TT.createPair(a,c,r))}return i}var dme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:N6,createNode:j6};n_.createPairs=j6;n_.pairs=dme;n_.resolvePairs=N6});var IT=v(RT=>{"use strict";var M6=De(),OT=Vo(),$f=Qo(),fme=es(),F6=i_(),ma=class t extends fme.YAMLSeq{constructor(){super(),this.add=$f.YAMLMap.prototype.add.bind(this),this.delete=$f.YAMLMap.prototype.delete.bind(this),this.get=$f.YAMLMap.prototype.get.bind(this),this.has=$f.YAMLMap.prototype.has.bind(this),this.set=$f.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(M6.isPair(i)?(o=OT.toJS(i.key,"",r),s=OT.toJS(i.value,o,r)):o=OT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=F6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var pme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=F6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)M6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};RT.YAMLOMap=ma;RT.omap=pme});var B6=v(PT=>{"use strict";var L6=Dt();function z6({value:t,source:e},r){return e&&(t?U6:q6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var U6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new L6.Scalar(!0),stringify:z6},q6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new L6.Scalar(!1),stringify:z6};PT.falseTag=q6;PT.trueTag=U6});var H6=v(o_=>{"use strict";var mme=Dt(),CT=ol(),hme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:CT.stringifyNumber},gme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():CT.stringifyNumber(t)}},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new mme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:CT.stringifyNumber};o_.float=yme;o_.floatExp=gme;o_.floatNaN=hme});var Z6=v(Ef=>{"use strict";var G6=ol(),kf=t=>typeof t=="bigint"||Number.isInteger(t);function s_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function DT(t,e,r){let{value:n}=t;if(kf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return G6.stringifyNumber(t)}var _me={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>s_(t,2,2,r),stringify:t=>DT(t,2,"0b")},bme={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>s_(t,1,8,r),stringify:t=>DT(t,8,"0")},vme={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>s_(t,0,10,r),stringify:G6.stringifyNumber},Sme={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>s_(t,2,16,r),stringify:t=>DT(t,16,"0x")};Ef.int=vme;Ef.intBin=_me;Ef.intHex=Sme;Ef.intOct=bme});var jT=v(NT=>{"use strict";var l_=De(),a_=Yo(),c_=Qo(),ha=class t extends c_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;l_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new a_.Pair(e.key,null):r=new a_.Pair(e,null),c_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=c_.findPair(this.items,e);return!r&&l_.isPair(n)?l_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=c_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new a_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(a_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var wme={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(l_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};NT.YAMLSet=ha;NT.set=wme});var FT=v(u_=>{"use strict";var xme=ol();function MT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function V6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return xme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $me={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>MT(t,r),stringify:V6},kme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>MT(t,!1),stringify:V6},W6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(W6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=MT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};u_.floatTime=kme;u_.intTime=$me;u_.timestamp=W6});var Y6=v(J6=>{"use strict";var Eme=nl(),Ame=Yy(),Tme=il(),Ome=wf(),Rme=AT(),K6=B6(),LT=H6(),d_=Z6(),Ime=By(),Pme=IT(),Cme=i_(),Dme=jT(),zT=FT(),Nme=[Eme.map,Tme.seq,Ome.string,Ame.nullTag,K6.trueTag,K6.falseTag,d_.intBin,d_.intOct,d_.int,d_.intHex,LT.floatNaN,LT.floatExp,LT.float,Rme.binary,Ime.merge,Pme.omap,Cme.pairs,Dme.set,zT.intTime,zT.floatTime,zT.timestamp];J6.schema=Nme});var aB=v(BT=>{"use strict";var tB=nl(),jme=Yy(),rB=il(),Mme=wf(),Fme=bT(),UT=ST(),qT=xT(),Lme=R6(),zme=C6(),nB=AT(),Af=By(),iB=IT(),oB=i_(),X6=Y6(),sB=jT(),f_=FT(),Q6=new Map([["core",Lme.schema],["failsafe",[tB.map,rB.seq,Mme.string]],["json",zme.schema],["yaml11",X6.schema],["yaml-1.1",X6.schema]]),eB={binary:nB.binary,bool:Fme.boolTag,float:UT.float,floatExp:UT.floatExp,floatNaN:UT.floatNaN,floatTime:f_.floatTime,int:qT.int,intHex:qT.intHex,intOct:qT.intOct,intTime:f_.intTime,map:tB.map,merge:Af.merge,null:jme.nullTag,omap:iB.omap,pairs:oB.pairs,seq:rB.seq,set:sB.set,timestamp:f_.timestamp},Ume={"tag:yaml.org,2002:binary":nB.binary,"tag:yaml.org,2002:merge":Af.merge,"tag:yaml.org,2002:omap":iB.omap,"tag:yaml.org,2002:pairs":oB.pairs,"tag:yaml.org,2002:set":sB.set,"tag:yaml.org,2002:timestamp":f_.timestamp};function qme(t,e,r){let n=Q6.get(e);if(n&&!t)return r&&!n.includes(Af.merge)?n.concat(Af.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Q6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Af.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?eB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(eB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}BT.coreKnownTags=Ume;BT.getTags=qme});var ZT=v(cB=>{"use strict";var HT=De(),Bme=nl(),Hme=il(),Gme=wf(),p_=aB(),Zme=(t,e)=>t.keye.key?1:0,GT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?p_.getTags(e,"compat"):e?p_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?p_.coreKnownTags:{},this.tags=p_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,HT.MAP,{value:Bme.map}),Object.defineProperty(this,HT.SCALAR,{value:Gme.string}),Object.defineProperty(this,HT.SEQ,{value:Hme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Zme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};cB.Schema=GT});var uB=v(lB=>{"use strict";var Vme=De(),VT=bf(),Tf=hf();function Wme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=VT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Tf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Vme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Tf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=VT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Tf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(VT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(Tf.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Tf.indentComment(o(c),"")))}return r.join(` `)+` -`}lB.stringifyDocument=Wme});var Tf=v(dB=>{"use strict";var Kme=ff(),sl=Cy(),Tn=De(),Jme=Jo(),Yme=Zo(),Xme=ZT(),Qme=uB(),WT=Oy(),ehe=XA(),the=pf(),KT=YA(),JT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new KT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Tn.NODE_TYPE]:{value:Tn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Tn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){al(this.contents)&&this.contents.add(e)}addIn(e,r){al(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=WT.anchorNames(this);e.anchor=!r||n.has(r)?WT.findNewAnchor(r||"a",n):r}return new Kme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=WT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=the.createNode(e,u,m);return a&&Tn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Jme.Pair(i,o)}delete(e){return al(this.contents)?this.contents.delete(e):!1}deleteIn(e){return sl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):al(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Tn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&Tn.isScalar(this.contents)?this.contents.value:this.contents:Tn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Tn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:Tn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=sl.collectionFromPath(this.schema,[e],r):al(this.contents)&&this.contents.set(e,r)}setIn(e,r){sl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=sl.collectionFromPath(this.schema,Array.from(e),r):al(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new KT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new KT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Xme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Yme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?ehe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Qme.stringifyDocument(this,e)}};function al(t){if(Tn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}dB.Document=JT});var If=v(Rf=>{"use strict";var Of=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},YT=class extends Of{constructor(e,r,n){super("YAMLParseError",e,r,n)}},XT=class extends Of{constructor(e,r,n){super("YAMLWarning",e,r,n)}},rhe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}lB.stringifyDocument=Wme});var Of=v(dB=>{"use strict";var Kme=pf(),sl=Cy(),Tn=De(),Jme=Yo(),Yme=Vo(),Xme=ZT(),Qme=uB(),WT=Oy(),ehe=XA(),the=mf(),KT=YA(),JT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new KT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Tn.NODE_TYPE]:{value:Tn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Tn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){al(this.contents)&&this.contents.add(e)}addIn(e,r){al(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=WT.anchorNames(this);e.anchor=!r||n.has(r)?WT.findNewAnchor(r||"a",n):r}return new Kme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=WT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=the.createNode(e,u,m);return a&&Tn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Jme.Pair(i,o)}delete(e){return al(this.contents)?this.contents.delete(e):!1}deleteIn(e){return sl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):al(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Tn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&Tn.isScalar(this.contents)?this.contents.value:this.contents:Tn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Tn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:Tn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=sl.collectionFromPath(this.schema,[e],r):al(this.contents)&&this.contents.set(e,r)}setIn(e,r){sl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=sl.collectionFromPath(this.schema,Array.from(e),r):al(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new KT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new KT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Xme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Yme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?ehe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Qme.stringifyDocument(this,e)}};function al(t){if(Tn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}dB.Document=JT});var Pf=v(If=>{"use strict";var Rf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},YT=class extends Rf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},XT=class extends Rf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},rhe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};Rf.YAMLError=Of;Rf.YAMLParseError=YT;Rf.YAMLWarning=XT;Rf.prettifyError=rhe});var Pf=v(fB=>{"use strict";function nhe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}fB.resolveProps=nhe});var m_=v(pB=>{"use strict";function QT(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(QT(e.key)||QT(e.value))return!0}return!1;default:return!0}}pB.containsNewline=QT});var eO=v(mB=>{"use strict";var ihe=m_();function ohe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&ihe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}mB.flowIndentCheck=ohe});var tO=v(gB=>{"use strict";var hB=De();function she(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||hB.isScalar(o)&&hB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}gB.mapIncludes=she});var wB=v(SB=>{"use strict";var yB=Jo(),ahe=Xo(),_B=Pf(),che=m_(),bB=eO(),lhe=tO(),vB="All mapping items must start at the same column";function uhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??ahe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=_B.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",vB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`}};If.YAMLError=Rf;If.YAMLParseError=YT;If.YAMLWarning=XT;If.prettifyError=rhe});var Cf=v(fB=>{"use strict";function nhe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}fB.resolveProps=nhe});var m_=v(pB=>{"use strict";function QT(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(QT(e.key)||QT(e.value))return!0}return!1;default:return!0}}pB.containsNewline=QT});var eO=v(mB=>{"use strict";var ihe=m_();function ohe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&ihe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}mB.flowIndentCheck=ohe});var tO=v(gB=>{"use strict";var hB=De();function she(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||hB.isScalar(o)&&hB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}gB.mapIncludes=she});var wB=v(SB=>{"use strict";var yB=Yo(),ahe=Qo(),_B=Cf(),che=m_(),bB=eO(),lhe=tO(),vB="All mapping items must start at the same column";function uhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??ahe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=_B.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",vB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||che.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",vB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&bB.flowIndentCheck(n.indent,f,i),r.atKey=!1,lhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=_B.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var dhe=Qo(),fhe=Pf(),phe=eO();function mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??dhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=fhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&phe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}xB.resolveBlockSeq=mhe});var cl=v(kB=>{"use strict";function hhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}kB.resolveEnd=hhe});var OB=v(TB=>{"use strict";var ghe=De(),yhe=Jo(),EB=Xo(),_he=Qo(),bhe=cl(),AB=Pf(),vhe=m_(),She=tO(),rO="Block collections are not allowed within flow collections",nO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function whe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?EB.YAMLMap:_he.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g{"use strict";var dhe=es(),fhe=Cf(),phe=eO();function mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??dhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=fhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&phe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}xB.resolveBlockSeq=mhe});var cl=v(kB=>{"use strict";function hhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}kB.resolveEnd=hhe});var OB=v(TB=>{"use strict";var ghe=De(),yhe=Yo(),EB=Qo(),_he=es(),bhe=cl(),AB=Cf(),vhe=m_(),She=tO(),rO="Block collections are not allowed within flow collections",nO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function whe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?EB.YAMLMap:_he.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=bhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}TB.resolveFlowCollection=whe});var IB=v(RB=>{"use strict";var xhe=De(),$he=Dt(),khe=Xo(),Ehe=Qo(),Ahe=wB(),The=$B(),Ohe=OB();function iO(t,e,r,n,i,o){let s=r.type==="block-map"?Ahe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?The.resolveBlockSeq(t,e,r,n,o):Ohe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Rhe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),iO(t,e,r,i,s)}let l=iO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=xhe.isNode(u)?u:new $he.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}RB.composeCollection=Rhe});var sO=v(PB=>{"use strict";var oO=Dt();function Ihe(t,e,r){let n=e.offset,i=Phe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?oO.Scalar.BLOCK_FOLDED:oO.Scalar.BLOCK_LITERAL,s=e.source?Che(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}TB.resolveFlowCollection=whe});var IB=v(RB=>{"use strict";var xhe=De(),$he=Dt(),khe=Qo(),Ehe=es(),Ahe=wB(),The=$B(),Ohe=OB();function iO(t,e,r,n,i,o){let s=r.type==="block-map"?Ahe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?The.resolveBlockSeq(t,e,r,n,o):Ohe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Rhe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),iO(t,e,r,i,s)}let l=iO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=xhe.isNode(u)?u:new $he.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}RB.composeCollection=Rhe});var sO=v(PB=>{"use strict";var oO=Dt();function Ihe(t,e,r){let n=e.offset,i=Phe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?oO.Scalar.BLOCK_FOLDED:oO.Scalar.BLOCK_LITERAL,s=e.source?Che(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` @@ -127,14 +127,14 @@ ${l} `);)n===` `&&(r+=` `),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var zhe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Uhe(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}DB.resolveFlowScalar=Nhe});var MB=v(jB=>{"use strict";var ga=De(),NB=Dt(),qhe=sO(),Bhe=cO();function Hhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?qhe.resolveBlockScalar(t,e,n):Bhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Ghe(t.schema,i,c,r,n):e.type==="scalar"?l=Zhe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new NB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new NB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ghe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Zhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}jB.composeScalar=Hhe});var LB=v(FB=>{"use strict";function Vhe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}FB.emptyScalarPosition=Vhe});var qB=v(uO=>{"use strict";var Whe=ff(),Khe=De(),Jhe=IB(),zB=MB(),Yhe=cl(),Xhe=LB(),Qhe={composeNode:UB,composeEmptyNode:lO};function UB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=ege(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=zB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Jhe.composeCollection(Qhe,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=lO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Khe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function lO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Xhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=zB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function ege({options:t},{offset:e,source:r,end:n},i){let o=new Whe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Yhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}uO.composeEmptyNode=lO;uO.composeNode=UB});var GB=v(HB=>{"use strict";var tge=Tf(),BB=qB(),rge=cl(),nge=Pf();function ige(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new tge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=nge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?BB.composeNode(l,i,u,s):BB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=rge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}HB.composeDoc=ige});var fO=v(WB=>{"use strict";var oge=Ge("process"),sge=YA(),age=Tf(),Cf=If(),ZB=De(),cge=GB(),lge=cl();function Df(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function VB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ga=De(),NB=Dt(),qhe=sO(),Bhe=cO();function Hhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?qhe.resolveBlockScalar(t,e,n):Bhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Ghe(t.schema,i,c,r,n):e.type==="scalar"?l=Zhe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new NB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new NB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ghe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Zhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}jB.composeScalar=Hhe});var LB=v(FB=>{"use strict";function Vhe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}FB.emptyScalarPosition=Vhe});var qB=v(uO=>{"use strict";var Whe=pf(),Khe=De(),Jhe=IB(),zB=MB(),Yhe=cl(),Xhe=LB(),Qhe={composeNode:UB,composeEmptyNode:lO};function UB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=ege(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=zB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Jhe.composeCollection(Qhe,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=lO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Khe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function lO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Xhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=zB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function ege({options:t},{offset:e,source:r,end:n},i){let o=new Whe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Yhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}uO.composeEmptyNode=lO;uO.composeNode=UB});var GB=v(HB=>{"use strict";var tge=Of(),BB=qB(),rge=cl(),nge=Cf();function ige(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new tge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=nge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?BB.composeNode(l,i,u,s):BB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=rge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}HB.composeDoc=ige});var fO=v(WB=>{"use strict";var oge=Ge("process"),sge=YA(),age=Of(),Df=Pf(),ZB=De(),cge=GB(),lge=cl();function Nf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function VB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Df(r);o?this.warnings.push(new Cf.YAMLWarning(s,n,i)):this.errors.push(new Cf.YAMLParseError(s,n,i))},this.directives=new sge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=VB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var dO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Nf(r);o?this.warnings.push(new Df.YAMLWarning(s,n,i)):this.errors.push(new Df.YAMLParseError(s,n,i))},this.directives=new sge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=VB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} ${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(ZB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];ZB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=Df(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=cge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Cf.YAMLParseError(Df(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Cf.YAMLParseError(Df(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=lge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Cf.YAMLParseError(Df(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new age.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};WB.Composer=dO});var YB=v(h_=>{"use strict";var uge=sO(),dge=cO(),fge=If(),KB=yf();function pge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new fge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return dge.resolveFlowScalar(t,e,n);case"block-scalar":return uge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function mge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=KB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=Nf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=cge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Df.YAMLParseError(Nf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Df.YAMLParseError(Nf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=lge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Df.YAMLParseError(Nf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new age.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};WB.Composer=dO});var YB=v(h_=>{"use strict";var uge=sO(),dge=cO(),fge=Pf(),KB=_f();function pge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new fge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return dge.resolveFlowScalar(t,e,n);case"block-scalar":return uge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function mge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=KB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` `,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return JB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` @@ -144,53 +144,53 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function JB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function pO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` `};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}h_.createScalarToken=mge;h_.resolveAsScalar=pge;h_.setScalarValue=hge});var QB=v(XB=>{"use strict";var yge=t=>"type"in t?y_(t):g_(t);function y_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=y_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=g_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=g_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=g_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function g_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=y_(e)),r)for(let o of r)i+=o.source;return n&&(i+=y_(n)),i}XB.stringify=yge});var nH=v(rH=>{"use strict";var mO=Symbol("break visit"),_ge=Symbol("skip children"),eH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),tH(Object.freeze([]),t,e)}ya.BREAK=mO;ya.SKIP=_ge;ya.REMOVE=eH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function tH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var hO=YB(),bge=QB(),vge=nH(),gO="\uFEFF",yO="",_O="",bO="",Sge=t=>!!t&&"items"in t,wge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function xge(t){switch(t){case gO:return"";case yO:return"";case _O:return"";case bO:return"";default:return JSON.stringify(t)}}function $ge(t){switch(t){case gO:return"byte-order-mark";case yO:return"doc-mode";case _O:return"flow-error-end";case bO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Nr.createScalarToken=hO.createScalarToken;Nr.resolveAsScalar=hO.resolveAsScalar;Nr.setScalarValue=hO.setScalarValue;Nr.stringify=bge.stringify;Nr.visit=vge.visit;Nr.BOM=gO;Nr.DOCUMENT=yO;Nr.FLOW_END=_O;Nr.SCALAR=bO;Nr.isCollection=Sge;Nr.isScalar=wge;Nr.prettyToken=xge;Nr.tokenType=$ge});var wO=v(oH=>{"use strict";var Nf=__();function Yn(t){switch(t){case void 0:case" ":case` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Nr.createScalarToken=hO.createScalarToken;Nr.resolveAsScalar=hO.resolveAsScalar;Nr.setScalarValue=hO.setScalarValue;Nr.stringify=bge.stringify;Nr.visit=vge.visit;Nr.BOM=gO;Nr.DOCUMENT=yO;Nr.FLOW_END=_O;Nr.SCALAR=bO;Nr.isCollection=Sge;Nr.isScalar=wge;Nr.prettyToken=xge;Nr.tokenType=$ge});var wO=v(oH=>{"use strict";var jf=__();function Yn(t){switch(t){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}var iH=new Set("0123456789ABCDEFabcdef"),kge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),b_=new Set(",[]{}"),Ege=new Set(` ,[]{} \r `),vO=t=>!t||Ege.has(t),SO=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` `||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Yn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Yn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Yn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(vO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&nthis.indentValue&&!Yn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Yn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(vO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Yn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Nf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Yn(o)||e&&b_.has(o))break;r=n}else if(Yn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield jf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Yn(o)||e&&b_.has(o))break;r=n}else if(Yn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` `,o=this.buffer[n+1]):r=n),o==="#"||e&&b_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&b_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Nf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(vO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Yn(n)||r&&b_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Yn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(kge.has(r))r=this.buffer[++e];else if(r==="%"&&iH.has(this.buffer[e+1])&&iH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&b_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield jf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(vO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Yn(n)||r&&b_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Yn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(kge.has(r))r=this.buffer[++e];else if(r==="%"&&iH.has(this.buffer[e+1])&&iH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};oH.Lexer=SO});var $O=v(sH=>{"use strict";var xO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Age=Ge("process"),aH=__(),Tge=wO();function es(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function S_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&lH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&cH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};oH.Lexer=SO});var $O=v(sH=>{"use strict";var xO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Age=Ge("process"),aH=__(),Tge=wO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function S_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&lH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&cH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(es(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(uH(r.key)&&!es(r.sep,"newline")){let s=ll(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(es(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ll(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):es(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!es(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){S_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||es(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=v_(n),o=ll(i);lH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){S_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ts(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(uH(r.key)&&!ts(r.sep,"newline")){let s=ll(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ll(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ts(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!ts(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){S_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||ts(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=v_(n),o=ll(i);lH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};dH.Parser=kO});var gH=v(Mf=>{"use strict";var fH=fO(),Oge=Tf(),jf=If(),Rge=uT(),Ige=De(),Pge=$O(),pH=EO();function mH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Pge.LineCounter||null,prettyErrors:e}}function Cge(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(jf.prettifyError(t,r)),a.warnings.forEach(jf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hH(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new jf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(jf.prettifyError(t,r)),s.warnings.forEach(jf.prettifyError(t,r))),s}function Dge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Rge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Nge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Ige.isDocument(t)&&!n?t.toString(r):new Oge.Document(t,n,r).toString(r)}Mf.parse=Dge;Mf.parseAllDocuments=Cge;Mf.parseDocument=hH;Mf.stringify=Nge});var er=v(Ze=>{"use strict";var jge=fO(),Mge=Tf(),Fge=ZT(),AO=If(),Lge=ff(),ts=De(),zge=Jo(),Uge=Dt(),qge=Xo(),Bge=Qo(),Hge=__(),Gge=wO(),Zge=$O(),Vge=EO(),w_=gH(),yH=cf();Ze.Composer=jge.Composer;Ze.Document=Mge.Document;Ze.Schema=Fge.Schema;Ze.YAMLError=AO.YAMLError;Ze.YAMLParseError=AO.YAMLParseError;Ze.YAMLWarning=AO.YAMLWarning;Ze.Alias=Lge.Alias;Ze.isAlias=ts.isAlias;Ze.isCollection=ts.isCollection;Ze.isDocument=ts.isDocument;Ze.isMap=ts.isMap;Ze.isNode=ts.isNode;Ze.isPair=ts.isPair;Ze.isScalar=ts.isScalar;Ze.isSeq=ts.isSeq;Ze.Pair=zge.Pair;Ze.Scalar=Uge.Scalar;Ze.YAMLMap=qge.YAMLMap;Ze.YAMLSeq=Bge.YAMLSeq;Ze.CST=Hge;Ze.Lexer=Gge.Lexer;Ze.LineCounter=Zge.LineCounter;Ze.Parser=Vge.Parser;Ze.parse=w_.parse;Ze.parseAllDocuments=w_.parseAllDocuments;Ze.parseDocument=w_.parseDocument;Ze.stringify=w_.stringify;Ze.visit=yH.visit;Ze.visitAsync=yH.visitAsync});import{execFileSync as TO}from"node:child_process";import{existsSync as x_}from"node:fs";import{join as $_,resolve as Wge}from"node:path";function Kge(t){try{let e=TO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Wge(t,e):null}catch{return null}}function OO(t){let e=Kge(t);if(!e)return null;try{if(x_($_(e,"MERGE_HEAD")))return"merge";if(x_($_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(x_($_(e,"rebase-merge"))||x_($_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return OO(t)!==null}function RO(t,e){try{let r=TO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function k_(t,e){return RO(t,e)!==null}function _H(t,e){try{let r=TO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Jge}from"node:child_process";import{existsSync as Yge,readFileSync as Xge}from"node:fs";import{join as vH}from"node:path";function fl(t,e){return Jge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=fl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function ns(t,e){SH(t,e);let r=fl(t,["rev-parse","HEAD"]).trim(),n=Qge(t,e);return{groups:eye(t,n),head:r,inventory:{after:bH(Ff(t,"spec.yaml")),before:bH(A_(t,e,"spec.yaml"))},since:e,unsharded_commits:iye(t,e)}}function IO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function SH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!k_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Qge(t,e){let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!E_(c)&&!E_(a)))if(s.startsWith("A")){let l=dl(Ff(t,c));if(!l)continue;l.status==="done"?n.push(ul(l,"added-as-done")):l.status==="archived"&&n.push(ul(l,"archived"))}else if(s.startsWith("D")){let l=dl(A_(t,e,a));l&&n.push(ul(l,"archived"))}else{let l=dl(Ff(t,c));if(!l)continue;let d=dl(A_(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ul(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ul(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ul(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function E_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function wH(t,e){SH(t,e);let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!E_(c)&&!E_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?dl(Ff(t,c)):null,f=l?null:dl(A_(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function ul(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>IO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function dl(t){if(t===null)return null;let e;try{e=(0,T_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Ff(t,e){let r=vH(t,e);if(!Yge(r))return null;try{return Xge(r,"utf8")}catch{return null}}function A_(t,e,r){try{return fl(t,["show",`${e}:${r}`])}catch{return null}}function eye(t,e){let r=tye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function tye(t){let e=Ff(t,vH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,T_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function bH(t){let e={};if(t!==null)try{let n=(0,T_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function iye(t,e){let r=fl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};dH.Parser=kO});var gH=v(Ff=>{"use strict";var fH=fO(),Oge=Of(),Mf=Pf(),Rge=uT(),Ige=De(),Pge=$O(),pH=EO();function mH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Pge.LineCounter||null,prettyErrors:e}}function Cge(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Mf.prettifyError(t,r)),a.warnings.forEach(Mf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hH(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Mf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Mf.prettifyError(t,r)),s.warnings.forEach(Mf.prettifyError(t,r))),s}function Dge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Rge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Nge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Ige.isDocument(t)&&!n?t.toString(r):new Oge.Document(t,n,r).toString(r)}Ff.parse=Dge;Ff.parseAllDocuments=Cge;Ff.parseDocument=hH;Ff.stringify=Nge});var er=v(Ze=>{"use strict";var jge=fO(),Mge=Of(),Fge=ZT(),AO=Pf(),Lge=pf(),rs=De(),zge=Yo(),Uge=Dt(),qge=Qo(),Bge=es(),Hge=__(),Gge=wO(),Zge=$O(),Vge=EO(),w_=gH(),yH=lf();Ze.Composer=jge.Composer;Ze.Document=Mge.Document;Ze.Schema=Fge.Schema;Ze.YAMLError=AO.YAMLError;Ze.YAMLParseError=AO.YAMLParseError;Ze.YAMLWarning=AO.YAMLWarning;Ze.Alias=Lge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=zge.Pair;Ze.Scalar=Uge.Scalar;Ze.YAMLMap=qge.YAMLMap;Ze.YAMLSeq=Bge.YAMLSeq;Ze.CST=Hge;Ze.Lexer=Gge.Lexer;Ze.LineCounter=Zge.LineCounter;Ze.Parser=Vge.Parser;Ze.parse=w_.parse;Ze.parseAllDocuments=w_.parseAllDocuments;Ze.parseDocument=w_.parseDocument;Ze.stringify=w_.stringify;Ze.visit=yH.visit;Ze.visitAsync=yH.visitAsync});import{execFileSync as TO}from"node:child_process";import{existsSync as x_}from"node:fs";import{join as $_,resolve as Wge}from"node:path";function Kge(t){try{let e=TO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Wge(t,e):null}catch{return null}}function OO(t){let e=Kge(t);if(!e)return null;try{if(x_($_(e,"MERGE_HEAD")))return"merge";if(x_($_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(x_($_(e,"rebase-merge"))||x_($_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return OO(t)!==null}function RO(t,e){try{let r=TO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function k_(t,e){return RO(t,e)!==null}function _H(t,e){try{let r=TO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Jge}from"node:child_process";import{existsSync as Yge,readFileSync as Xge}from"node:fs";import{join as vH}from"node:path";function fl(t,e){return Jge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=fl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){SH(t,e);let r=fl(t,["rev-parse","HEAD"]).trim(),n=Qge(t,e);return{groups:eye(t,n),head:r,inventory:{after:bH(Lf(t,"spec.yaml")),before:bH(A_(t,e,"spec.yaml"))},since:e,unsharded_commits:iye(t,e)}}function IO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function SH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!k_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Qge(t,e){let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!E_(c)&&!E_(a)))if(s.startsWith("A")){let l=dl(Lf(t,c));if(!l)continue;l.status==="done"?n.push(ul(l,"added-as-done")):l.status==="archived"&&n.push(ul(l,"archived"))}else if(s.startsWith("D")){let l=dl(A_(t,e,a));l&&n.push(ul(l,"archived"))}else{let l=dl(Lf(t,c));if(!l)continue;let d=dl(A_(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ul(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ul(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ul(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function E_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function wH(t,e){SH(t,e);let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!E_(c)&&!E_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?dl(Lf(t,c)):null,f=l?null:dl(A_(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function ul(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>IO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function dl(t){if(t===null)return null;let e;try{e=(0,T_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Lf(t,e){let r=vH(t,e);if(!Yge(r))return null;try{return Xge(r,"utf8")}catch{return null}}function A_(t,e,r){try{return fl(t,["show",`${e}:${r}`])}catch{return null}}function eye(t,e){let r=tye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function tye(t){let e=Lf(t,vH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,T_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function bH(t){let e={};if(t!==null)try{let n=(0,T_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function iye(t,e){let r=fl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` `)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);rye.test(a)&&(nye.test(a)||n.push({hash:s,subject:a}))}return n}var T_,rye,nye,pl=y(()=>{"use strict";T_=St(er(),1);ba();rye=/^(feat|fix)(\([^)]*\))?!?:/,nye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as xH}from"node:child_process";import{appendFileSync as oye,existsSync as PO,mkdirSync as sye,readFileSync as aye,renameSync as cye,statSync as lye}from"node:fs";import{userInfo as uye}from"node:os";import{dirname as dye,join as DO}from"node:path";function NO(t){return DO(t,$H,fye)}function en(t,e){let r=NO(t),n=dye(r);PO(n)||sye(n,{recursive:!0});try{PO(r)&&lye(r).size>pye&&cye(r,DO(n,kH))}catch{}oye(r,`${JSON.stringify(e)} `,"utf8")}function CO(t){if(!PO(t))return[];let e=aye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return CO(NO(t))}function O_(t){return[...CO(DO(t,$H,kH)),...CO(NO(t))]}function tn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function mye(t){let e;try{e=xH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=uye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function hye(t){try{return xH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Lf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=hye(t),i=mye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Lf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}en(t,tn(e,o))}catch{}}var $H,fye,kH,pye,jr=y(()=>{"use strict";$H=".cladding",fye="events.log.jsonl",kH="events.log.1.jsonl",pye=5*1024*1024});import{execFileSync as gye}from"node:child_process";import{existsSync as EH,readdirSync as yye,readFileSync as _ye,statSync as AH}from"node:fs";import{createHash as bye}from"node:crypto";import{join as jO}from"node:path";function Sa(t){try{return gye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function MO(t){let e=[],r=jO(t,"spec.yaml");EH(r)&&AH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=jO(t,"spec",i);if(!(!EH(o)||!AH(o).isDirectory()))for(let s of yye(o))s.endsWith(".yaml")&&e.push(jO(o,s))}e.sort();let n=bye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(_ye(i)),n.update("\0")}return n.digest("hex")}function R_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:MO(t),timestamp:new Date().toISOString()};return en(t,tn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function I_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function P_(t,e,r,n){let i=tn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return en(t,i),i}var zf=y(()=>{"use strict";jr()});import{readFileSync as vye,statSync as Sye}from"node:fs";import{extname as wye,resolve as FO,sep as xye}from"node:path";function rn(t){return Math.ceil(t.length/4)}function Eye(t,e){let r=FO(e),n=FO(r,t);return n===r||n.startsWith(r+xye)}function OH(t,e,r,n){if(!Eye(t,e))return{path:t,omitted:"unsafe-path"};if(!$ye.has(wye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>TH)return{path:t,omitted:"too-large",bytes:o}}else{let l=FO(e,t);try{o=Sye(l).size}catch{return{path:t,omitted:"missing"}}if(o>TH)return{path:t,omitted:"too-large",bytes:o};try{i=vye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(kye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return CO(NO(t))}function O_(t){return[...CO(DO(t,$H,kH)),...CO(NO(t))]}function tn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function mye(t){let e;try{e=xH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=uye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function hye(t){try{return xH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function zf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=hye(t),i=mye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=zf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}en(t,tn(e,o))}catch{}}var $H,fye,kH,pye,jr=y(()=>{"use strict";$H=".cladding",fye="events.log.jsonl",kH="events.log.1.jsonl",pye=5*1024*1024});import{execFileSync as gye}from"node:child_process";import{existsSync as EH,readdirSync as yye,readFileSync as _ye,statSync as AH}from"node:fs";import{createHash as bye}from"node:crypto";import{join as jO}from"node:path";function Sa(t){try{return gye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function MO(t){let e=[],r=jO(t,"spec.yaml");EH(r)&&AH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=jO(t,"spec",i);if(!(!EH(o)||!AH(o).isDirectory()))for(let s of yye(o))s.endsWith(".yaml")&&e.push(jO(o,s))}e.sort();let n=bye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(_ye(i)),n.update("\0")}return n.digest("hex")}function R_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:MO(t),timestamp:new Date().toISOString()};return en(t,tn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function I_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function P_(t,e,r,n){let i=tn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return en(t,i),i}var Uf=y(()=>{"use strict";jr()});import{readFileSync as vye,statSync as Sye}from"node:fs";import{extname as wye,resolve as FO,sep as xye}from"node:path";function rn(t){return Math.ceil(t.length/4)}function Eye(t,e){let r=FO(e),n=FO(r,t);return n===r||n.startsWith(r+xye)}function OH(t,e,r,n){if(!Eye(t,e))return{path:t,omitted:"unsafe-path"};if(!$ye.has(wye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>TH)return{path:t,omitted:"too-large",bytes:o}}else{let l=FO(e,t);try{o=Sye(l).size}catch{return{path:t,omitted:"missing"}}if(o>TH)return{path:t,omitted:"too-large",bytes:o};try{i=vye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(kye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var $ye,TH,kye,C_=y(()=>{"use strict";$ye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),TH=2e6,kye="\0"});function zO(t){for(let i of Aye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function LO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Tye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])LO(e,s,o);for(let s of i.modules??[])LO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=zO(a);c&&LO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function On(t){let e=RH.get(t);return e||(e=Tye(t),RH.set(t,e)),e}var Aye,RH,is=y(()=>{"use strict";Aye=["derived:","fixture:","script:","self-dogfood:"];RH=new WeakMap});function UO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=On(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Oye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=UO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:qO(i)}}var wa=y(()=>{"use strict";is()});function IH(t){return t.impacted.length}function N_(t,e,r={}){let n=r.initialDepth??D_.initialDepth,i=r.maxDepth??D_.maxDepth,o=r.coverageThreshold??D_.coverageThreshold,s=r.marginYieldThreshold??D_.marginYieldThreshold,a=On(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=UO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=IH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var D_,BO=y(()=>{"use strict";wa();is();D_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Rye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function PH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Rye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var CH=y(()=>{"use strict"});function Iye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function ml(t,e){let r=Iye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=PH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var j_=y(()=>{"use strict";CH()});import{existsSync as NH,readdirSync as Pye,readFileSync as Cye}from"node:fs";import{join as GO}from"node:path";function ZO(t,e=Nye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function jye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:ZO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:ZO(`done reverted \u2014 pre-push strict gate red${r}`)}}function DH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Mye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return ZO(n)}function Fye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>DH(m)-DH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Dye).map(jye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Mye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function HO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Lye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function zye(t,e,r){let n=HO(t,/_Rolled back at_\s*`([^`]+)`/),i=HO(t,/Last failed gate:\s*`([^`]+)`/),o=HO(t,/Retry attempts:\s*(\d+)/),s=Lye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Uye(t,e){let r=GO(t,".cladding","post-mortems");if(!NH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Pye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(zye(Cye(GO(r,o),"utf8"),e,o))}catch{}return i}function jH(t,e){try{let r=O_(t),n=Uye(t,e),i=NH(GO(t,".cladding","events.log.1.jsonl"));return Fye(r,n,e,{truncated:i})}catch{return}}var Dye,Nye,MH=y(()=>{"use strict";jr();Dye=5,Nye=120});function M_(t,e,r){return rn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:qye,o=e,s,a=On(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ml(t,o);if("not_found"in c)return c;let l=c.focus,u=jH(n,l.id),d=a&&a.size>0?e:l.id,f=N_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Bye&&M_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],lo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return rn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],lo=0;for(;Xt.length>Ce.size&&$(Xt,K,lo,0);)Xt=Xt.slice(0,-1),lo++;let $i=[...h],Qr=0;for(;$(Xt,$i,lo,Qr);){let de=-1;for(let uo=$i.length-1;uo>=0;uo--)if(!Kt.has($i[uo])){de=uo;break}if(de<0)break;$i.splice(de,1),Qr++}re=Xt,K=$i,lo+Qr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Qr} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};rn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Pr=rn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var qye,Bye,F_=y(()=>{"use strict";C_();j_();BO();MH();wa();is();qye=3e3,Bye=3});function Xn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Hye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function FH(t,e,r="."){let n=On(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=N_(t,f.id),g=!("not_found"in h),b=rn(JSON.stringify(p)),_="not_found"in m?b:rn(JSON.stringify(m)),S=rn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=rn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Xn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Xn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Xn(a(c))*10)/10,medianShrinkTruncated:Math.round(Xn(a(l))*10)/10,medianStructuralRatio:Math.round(Xn(u)*100)/100,medianSliceTokens:Math.round(Xn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Xn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Xn(o.map(f=>f.searchDepth)),p95Depth:Hye(o.map(f=>f.searchDepth),95),medianEdges:Xn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Xn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Xn(o.map(f=>f.regressionTests))},features:o}}var hl,L_=y(()=>{"use strict";C_();BO();F_();is();hl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Gye,existsSync as VO,mkdirSync as Zye,readFileSync as LH}from"node:fs";import{dirname as Vye,join as Wye}from"node:path";function WO(t){return Wye(t,Kye,Jye)}function Yye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:MO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function zH(t,e){try{let r=Yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=KO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=WO(t),s=Vye(o);return VO(s)||Zye(s,{recursive:!0}),Gye(o,`${JSON.stringify(r)} +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var $ye,TH,kye,C_=y(()=>{"use strict";$ye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),TH=2e6,kye="\0"});function zO(t){for(let i of Aye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function LO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Tye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])LO(e,s,o);for(let s of i.modules??[])LO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=zO(a);c&&LO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function On(t){let e=RH.get(t);return e||(e=Tye(t),RH.set(t,e)),e}var Aye,RH,os=y(()=>{"use strict";Aye=["derived:","fixture:","script:","self-dogfood:"];RH=new WeakMap});function UO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=On(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Oye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=UO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:qO(i)}}var wa=y(()=>{"use strict";os()});function IH(t){return t.impacted.length}function N_(t,e,r={}){let n=r.initialDepth??D_.initialDepth,i=r.maxDepth??D_.maxDepth,o=r.coverageThreshold??D_.coverageThreshold,s=r.marginYieldThreshold??D_.marginYieldThreshold,a=On(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=UO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=IH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var D_,BO=y(()=>{"use strict";wa();os();D_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Rye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function PH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Rye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var CH=y(()=>{"use strict"});function Iye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function ml(t,e){let r=Iye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=PH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var j_=y(()=>{"use strict";CH()});import{existsSync as NH,readdirSync as Pye,readFileSync as Cye}from"node:fs";import{join as GO}from"node:path";function ZO(t,e=Nye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function jye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:ZO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:ZO(`done reverted \u2014 pre-push strict gate red${r}`)}}function DH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Mye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return ZO(n)}function Fye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>DH(m)-DH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Dye).map(jye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Mye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function HO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Lye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function zye(t,e,r){let n=HO(t,/_Rolled back at_\s*`([^`]+)`/),i=HO(t,/Last failed gate:\s*`([^`]+)`/),o=HO(t,/Retry attempts:\s*(\d+)/),s=Lye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Uye(t,e){let r=GO(t,".cladding","post-mortems");if(!NH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Pye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(zye(Cye(GO(r,o),"utf8"),e,o))}catch{}return i}function jH(t,e){try{let r=O_(t),n=Uye(t,e),i=NH(GO(t,".cladding","events.log.1.jsonl"));return Fye(r,n,e,{truncated:i})}catch{return}}var Dye,Nye,MH=y(()=>{"use strict";jr();Dye=5,Nye=120});function M_(t,e,r){return rn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:qye,o=e,s,a=On(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ml(t,o);if("not_found"in c)return c;let l=c.focus,u=jH(n,l.id),d=a&&a.size>0?e:l.id,f=N_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Bye&&M_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],lo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return rn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],lo=0;for(;Xt.length>Ce.size&&$(Xt,K,lo,0);)Xt=Xt.slice(0,-1),lo++;let $i=[...h],Qr=0;for(;$(Xt,$i,lo,Qr);){let de=-1;for(let uo=$i.length-1;uo>=0;uo--)if(!Kt.has($i[uo])){de=uo;break}if(de<0)break;$i.splice(de,1),Qr++}re=Xt,K=$i,lo+Qr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Qr} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};rn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Pr=rn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var qye,Bye,F_=y(()=>{"use strict";C_();j_();BO();MH();wa();os();qye=3e3,Bye=3});function Xn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Hye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function FH(t,e,r="."){let n=On(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=N_(t,f.id),g=!("not_found"in h),b=rn(JSON.stringify(p)),_="not_found"in m?b:rn(JSON.stringify(m)),S=rn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=rn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Xn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Xn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Xn(a(c))*10)/10,medianShrinkTruncated:Math.round(Xn(a(l))*10)/10,medianStructuralRatio:Math.round(Xn(u)*100)/100,medianSliceTokens:Math.round(Xn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Xn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Xn(o.map(f=>f.searchDepth)),p95Depth:Hye(o.map(f=>f.searchDepth),95),medianEdges:Xn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Xn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Xn(o.map(f=>f.regressionTests))},features:o}}var hl,L_=y(()=>{"use strict";C_();BO();F_();os();hl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Gye,existsSync as VO,mkdirSync as Zye,readFileSync as LH}from"node:fs";import{dirname as Vye,join as Wye}from"node:path";function WO(t){return Wye(t,Kye,Jye)}function Yye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:MO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function zH(t,e){try{let r=Yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=KO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=WO(t),s=Vye(o);return VO(s)||Zye(s,{recursive:!0}),Gye(o,`${JSON.stringify(r)} `,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function UH(t){let e=[];for(let r of t.split(` -`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function KO(t,e){let r=WO(t);if(!VO(r))return[];let n;try{n=LH(r,"utf8")}catch{return[]}let i=UH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function qH(t){let e=WO(t);if(!VO(e))return{snapshots:[],unreadable:!1};let r;try{r=LH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=UH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Uf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function BH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Uf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${hl}`),i.join(` -`)}var Kye,Jye,qf=y(()=>{"use strict";zf();L_();Kye=".cladding",Jye="measure.jsonl"});import{existsSync as Xye}from"node:fs";import{join as Qye}from"node:path";function gl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${e_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function KO(t,e){let r=WO(t);if(!VO(r))return[];let n;try{n=LH(r,"utf8")}catch{return[]}let i=UH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function qH(t){let e=WO(t);if(!VO(e))return{snapshots:[],unreadable:!1};let r;try{r=LH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=UH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function qf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function BH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${qf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${hl}`),i.join(` +`)}var Kye,Jye,Bf=y(()=>{"use strict";Uf();L_();Kye=".cladding",Jye="measure.jsonl"});import{existsSync as Xye}from"node:fs";import{join as Qye}from"node:path";function gl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${e_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` `)}function GH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` -`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Uf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Uf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Uf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",hl),r.join(` +`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${qf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${qf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${qf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",hl),r.join(` `)}function yl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${r_e(l,r)} |`)}return n.join(` `)}function r_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of t_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Xye(Qye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function _l(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),HH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)HH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function HH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=IO(r);n&&t.push(`- ${n}`)}t.push("")}var e_e,t_e,z_=y(()=>{"use strict";qf();L_();pl();e_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};t_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as n_e}from"node:fs";function Oi(t="./spec.yaml"){let e=n_e(t,"utf8");return(0,ZH.parse)(e)}var ZH,U_=y(()=>{"use strict";ZH=St(er(),1)});var os=v((Mr,QO)=>{"use strict";var JO=Mr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+WH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};JO.prototype.toString=function(){return this.property+" "+this.message};var q_=Mr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};q_.prototype.addError=function(e){var r;if(typeof e=="string")r=new JO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new JO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};q_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function i_e(t,e){return e+": "+t.toString()+` -`}q_.prototype.toString=function(e){return this.errors.map(i_e).join("")};Object.defineProperty(q_.prototype,"valid",{get:function(){return!this.errors.length}});QO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var VH=Mr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};VH.prototype=Object.create(Error.prototype,{constructor:{value:VH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var YO=Mr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+WH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};YO.prototype.resolve=function(e){return KH(this.base,e)};YO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=KH(this.base,i||"");var s=new YO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Qn=Mr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Qn.regexp=Qn.regex;Qn.pattern=Qn.regex;Qn.ipv4=Qn["ip-address"];Mr.isFormat=function(e,r,n){if(typeof e=="string"&&Qn[r]!==void 0){if(Qn[r]instanceof RegExp)return Qn[r].test(e);if(typeof Qn[r]=="function")return Qn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var WH=Mr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Mr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function o_e(t,e,r,n){typeof r=="object"?e[n]=XO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function s_e(t,e,r){e[r]=t[r]}function a_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=XO(t[n],e[n]):r[n]=e[n]}function XO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(o_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(s_e.bind(null,t,n)),Object.keys(e).forEach(a_e.bind(null,t,e,n))),n}QO.exports.deepMerge=XO;Mr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function c_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Mr.encodePath=function(e){return e.map(c_e).join("")};Mr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Mr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var KH=Mr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var QH=v((O7e,XH)=>{"use strict";var nn=os(),Le=nn.ValidatorResult,ss=nn.SchemaError,eR={};eR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=eR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function tR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ss("anyOf must be an array");if(!r.anyOf.some(tR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ss("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ss("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(tR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!nn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=tR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!nn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!nn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function rR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!nn.isSchema(s))throw new ss('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(rR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new ss('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=rR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function JH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new ss('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&JH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)JH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!nn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function l_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var nR=os();iR.exports.SchemaScanResult=eG;function eG(t,e){this.id=t,this.ref=e}iR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=nR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=nR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!nR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var tG=QH(),as=os(),rG=B_().scan,nG=as.ValidatorResult,u_e=as.ValidatorResultError,Bf=as.SchemaError,iG=as.SchemaContext,d_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(tG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=rG(r||d_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=as.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Bf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Bf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ri=Jt.prototype.types={};Ri.string=function(e){return typeof e=="string"};Ri.number=function(e){return typeof e=="number"&&isFinite(e)};Ri.integer=function(e){return typeof e=="number"&&e%1===0};Ri.boolean=function(e){return typeof e=="boolean"};Ri.array=function(e){return Array.isArray(e)};Ri.null=function(e){return e===null};Ri.date=function(e){return e instanceof Date};Ri.any=function(e){return!0};Ri.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};sG.exports=Jt});var cG=v((P7e,ho)=>{"use strict";var f_e=ho.exports.Validator=aG();ho.exports.ValidatorResult=os().ValidatorResult;ho.exports.ValidatorResultError=os().ValidatorResultError;ho.exports.ValidationError=os().ValidationError;ho.exports.SchemaError=os().SchemaError;ho.exports.SchemaScanResult=B_().SchemaScanResult;ho.exports.scan=B_().scan;ho.exports.validate=function(t,e,r){var n=new f_e;return n.validate(t,e,r)}});import{readFileSync as p_e}from"node:fs";import{dirname as m_e,join as h_e}from"node:path";import{fileURLToPath as g_e}from"node:url";function S_e(t){let e=v_e.validate(t,b_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function uG(t){let e=S_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`)}function HH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=IO(r);n&&t.push(`- ${n}`)}t.push("")}var e_e,t_e,z_=y(()=>{"use strict";Bf();L_();pl();e_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};t_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as n_e}from"node:fs";function Oi(t="./spec.yaml"){let e=n_e(t,"utf8");return(0,ZH.parse)(e)}var ZH,U_=y(()=>{"use strict";ZH=St(er(),1)});var ss=v((Mr,QO)=>{"use strict";var JO=Mr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+WH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};JO.prototype.toString=function(){return this.property+" "+this.message};var q_=Mr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};q_.prototype.addError=function(e){var r;if(typeof e=="string")r=new JO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new JO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};q_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function i_e(t,e){return e+": "+t.toString()+` +`}q_.prototype.toString=function(e){return this.errors.map(i_e).join("")};Object.defineProperty(q_.prototype,"valid",{get:function(){return!this.errors.length}});QO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var VH=Mr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};VH.prototype=Object.create(Error.prototype,{constructor:{value:VH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var YO=Mr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+WH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};YO.prototype.resolve=function(e){return KH(this.base,e)};YO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=KH(this.base,i||"");var s=new YO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Qn=Mr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Qn.regexp=Qn.regex;Qn.pattern=Qn.regex;Qn.ipv4=Qn["ip-address"];Mr.isFormat=function(e,r,n){if(typeof e=="string"&&Qn[r]!==void 0){if(Qn[r]instanceof RegExp)return Qn[r].test(e);if(typeof Qn[r]=="function")return Qn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var WH=Mr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Mr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function o_e(t,e,r,n){typeof r=="object"?e[n]=XO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function s_e(t,e,r){e[r]=t[r]}function a_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=XO(t[n],e[n]):r[n]=e[n]}function XO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(o_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(s_e.bind(null,t,n)),Object.keys(e).forEach(a_e.bind(null,t,e,n))),n}QO.exports.deepMerge=XO;Mr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function c_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Mr.encodePath=function(e){return e.map(c_e).join("")};Mr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Mr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var KH=Mr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var QH=v((P7e,XH)=>{"use strict";var nn=ss(),Le=nn.ValidatorResult,as=nn.SchemaError,eR={};eR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=eR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function tR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(tR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(tR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!nn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=tR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!nn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!nn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function rR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!nn.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(rR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=rR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function JH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&JH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)JH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!nn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function l_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var nR=ss();iR.exports.SchemaScanResult=eG;function eG(t,e){this.id=t,this.ref=e}iR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=nR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=nR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!nR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var tG=QH(),cs=ss(),rG=B_().scan,nG=cs.ValidatorResult,u_e=cs.ValidatorResultError,Hf=cs.SchemaError,iG=cs.SchemaContext,d_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(tG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=rG(r||d_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Hf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Hf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ri=Jt.prototype.types={};Ri.string=function(e){return typeof e=="string"};Ri.number=function(e){return typeof e=="number"&&isFinite(e)};Ri.integer=function(e){return typeof e=="number"&&e%1===0};Ri.boolean=function(e){return typeof e=="boolean"};Ri.array=function(e){return Array.isArray(e)};Ri.null=function(e){return e===null};Ri.date=function(e){return e instanceof Date};Ri.any=function(e){return!0};Ri.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};sG.exports=Jt});var cG=v((N7e,ho)=>{"use strict";var f_e=ho.exports.Validator=aG();ho.exports.ValidatorResult=ss().ValidatorResult;ho.exports.ValidatorResultError=ss().ValidatorResultError;ho.exports.ValidationError=ss().ValidationError;ho.exports.SchemaError=ss().SchemaError;ho.exports.SchemaScanResult=B_().SchemaScanResult;ho.exports.scan=B_().scan;ho.exports.validate=function(t,e,r){var n=new f_e;return n.validate(t,e,r)}});import{readFileSync as p_e}from"node:fs";import{dirname as m_e,join as h_e}from"node:path";import{fileURLToPath as g_e}from"node:url";function S_e(t){let e=v_e.validate(t,b_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function uG(t){let e=S_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` `)}`)}var lG,y_e,__e,b_e,v_e,dG=y(()=>{"use strict";lG=St(cG(),1),y_e=m_e(g_e(import.meta.url)),__e=h_e(y_e,"schema.json"),b_e=JSON.parse(p_e(__e,"utf8")),v_e=new lG.Validator});import{existsSync as oR,readdirSync as w_e}from"node:fs";import{dirname as x_e,join as ka,resolve as pG}from"node:path";function fG(t){return oR(t)?w_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Oi(ka(t,r))):[]}function Ea(t,e){H_=e?{cwd:pG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return H_&&e==="spec.yaml"&&pG(t)===H_.cwd?H_.spec:$_e(t,e)}function $_e(t,e){let r=ka(t,e),n=Oi(r),i=ka(t,x_e(e),"spec");if(!n.features||n.features.length===0){let o=fG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=fG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");oR(o)&&(n.architecture=Oi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(oR(o)){let s=Oi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return uG(n),n}var H_,Ue=y(()=>{"use strict";U_();dG();H_=null});import bl from"node:process";function cR(){return!!bl.stdout.isTTY}function L(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${sR[t]}${n}${aR} ${e}${i} `):bl.stdout.write(`${n} ${e}${i} -`)}function Hf(t,e,r=""){if(!cR())return;let n=r?` ${r}`:"";bl.stdout.write(`${hG}${sR.start}\xB7${aR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${hG}${sR[t]}${n}${aR} ${e}${i} +`)}function Gf(t,e,r=""){if(!cR())return;let n=r?` ${r}`:"";bl.stdout.write(`${hG}${sR.start}\xB7${aR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${hG}${sR[t]}${n}${aR} ${e}${i} `):bl.stdout.write(`${n} ${e}${i} -`)}var mG,sR,aR,hG,Ii=y(()=>{"use strict";mG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},sR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},aR="\x1B[0m",hG="\r\x1B[K"});import{createHash as zG}from"node:crypto";import{existsSync as cbe,readFileSync as dR,writeFileSync as lbe}from"node:fs";import{join as G_}from"node:path";function ube(t,e){let r=zG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(dR(G_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function qG(t,e){let r=zG("sha256");try{r.update(dR(G_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function cs(t){let e=G_(t,...UG);if(!cbe(e))return null;let r;try{r=dR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)}var mG,sR,aR,hG,Ii=y(()=>{"use strict";mG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},sR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},aR="\x1B[0m",hG="\r\x1B[K"});import{createHash as zG}from"node:crypto";import{existsSync as cbe,readFileSync as dR,writeFileSync as lbe}from"node:fs";import{join as G_}from"node:path";function ube(t,e){let r=zG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(dR(G_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function qG(t,e){let r=zG("sha256");try{r.update(dR(G_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=G_(t,...UG);if(!cbe(e))return null;let r;try{r=dR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` `)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function Z_(t){return t.features?.size??t.v1?.size??0}function V_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==qG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===ube(e,n)?{state:"fresh"}:{state:"stale"}}function BG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${qG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=dbe+`attested_modules: `+i.join(` `)+` @@ -212,53 +212,53 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as fR}from"node:path";function W_(t){ls={cwd:fR(t),results:new Map}}function HG(t,e,r){!ls||ls.cwd!==fR(e)||ls.results.set(t,r)}function K_(t,e){return!ls||ls.cwd!==fR(e)?null:ls.results.get(t)??null}function J_(){ls=null}var ls,xl=y(()=>{"use strict";ls=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var yo=y(()=>{});import{fileURLToPath as fbe}from"node:url";var $l,pbe,pR,mR,kl=y(()=>{$l=(t,e)=>{let r=mR(pbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},pbe=t=>pR(t)?t.toString():t,pR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,mR=t=>t instanceof URL?fbe(t):t});var Y_,hR=y(()=>{yo();kl();Y_=(t,e=[],r={})=>{let n=$l(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as mbe}from"node:string_decoder";var GG,ZG,qt,_o,hbe,VG,gbe,X_,WG,ybe,Vf,_be,gR,bbe,on=y(()=>{({toString:GG}=Object.prototype),ZG=t=>GG.call(t)==="[object ArrayBuffer]",qt=t=>GG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hbe=new TextEncoder,VG=t=>hbe.encode(t),gbe=new TextDecoder,X_=t=>gbe.decode(t),WG=(t,e)=>ybe(t,e).join(""),ybe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new mbe(e),n=t.map(o=>typeof o=="string"?VG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Vf=t=>t.length===1&&qt(t[0])?t[0]:gR(_be(t)),_be=t=>t.map(e=>typeof e=="string"?VG(e):e),gR=t=>{let e=new Uint8Array(bbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},bbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as vbe}from"node:child_process";var XG,QG,Sbe,wbe,KG,xbe,JG,YG,$be,eZ=y(()=>{yo();on();XG=t=>Array.isArray(t)&&Array.isArray(t.raw),QG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Sbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Sbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=wbe(i,t.raw[n]),c=JG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>YG(d)):[YG(l)];return JG(c,u,a)},wbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=KG.has(e[0]);for(let s=0,a=0;s{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var yo=y(()=>{});import{fileURLToPath as fbe}from"node:url";var $l,pbe,pR,mR,kl=y(()=>{$l=(t,e)=>{let r=mR(pbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},pbe=t=>pR(t)?t.toString():t,pR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,mR=t=>t instanceof URL?fbe(t):t});var Y_,hR=y(()=>{yo();kl();Y_=(t,e=[],r={})=>{let n=$l(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as mbe}from"node:string_decoder";var GG,ZG,qt,_o,hbe,VG,gbe,X_,WG,ybe,Wf,_be,gR,bbe,on=y(()=>{({toString:GG}=Object.prototype),ZG=t=>GG.call(t)==="[object ArrayBuffer]",qt=t=>GG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hbe=new TextEncoder,VG=t=>hbe.encode(t),gbe=new TextDecoder,X_=t=>gbe.decode(t),WG=(t,e)=>ybe(t,e).join(""),ybe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new mbe(e),n=t.map(o=>typeof o=="string"?VG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Wf=t=>t.length===1&&qt(t[0])?t[0]:gR(_be(t)),_be=t=>t.map(e=>typeof e=="string"?VG(e):e),gR=t=>{let e=new Uint8Array(bbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},bbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as vbe}from"node:child_process";var XG,QG,Sbe,wbe,KG,xbe,JG,YG,$be,eZ=y(()=>{yo();on();XG=t=>Array.isArray(t)&&Array.isArray(t.raw),QG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Sbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Sbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=wbe(i,t.raw[n]),c=JG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>YG(d)):[YG(l)];return JG(c,u,a)},wbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=KG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],YG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return $be(t);throw t instanceof vbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},$be=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return X_(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import yR from"node:process";var ei,Q_,Rn,eb,bo=y(()=>{ei=t=>Q_.includes(t),Q_=[yR.stdin,yR.stdout,yR.stderr],Rn=["stdin","stdout","stderr"],eb=t=>Rn[t]??`stdio[${t}]`});import{debuglog as kbe}from"node:util";var rZ,_R,Ebe,Abe,Tbe,Obe,tZ,Rbe,bR,Ibe,Pbe,Cbe,Dbe,vR,vo,So=y(()=>{yo();bo();rZ=t=>{let e={...t};for(let r of vR)e[r]=_R(t,r);return e},_R=(t,e)=>{let r=Array.from({length:Ebe(t)+1}),n=Abe(t[e],r,e);return Pbe(n,e)},Ebe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Rn.length):Rn.length,Abe=(t,e,r)=>Ot(t)?Tbe(t,e,r):e.fill(t),Tbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Obe))for(let i of Rbe(n,r,e))e[i]=t[n];return e},Obe=(t,e)=>tZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Rbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=bR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},bR=t=>{if(t==="all")return t;if(Rn.includes(t))return Rn.indexOf(t);let e=Ibe.exec(t);if(e!==null)return Number(e[1])},Ibe=/^fd(\d+)$/,Pbe=(t,e)=>t.map(r=>r===void 0?Dbe[e]:r),Cbe=kbe("execa").enabled?"full":"none",Dbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Cbe,stripFinalNewline:!0},vR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var El,Al,nZ,SR,Nbe,tb,rb,us=y(()=>{So();El=({verbose:t},e)=>SR(t,e)!=="none",Al=({verbose:t},e)=>!["none","short"].includes(SR(t,e)),nZ=({verbose:t},e)=>{let r=SR(t,e);return tb(r)?r:void 0},SR=(t,e)=>e===void 0?Nbe(t):vo(t,e),Nbe=t=>t.find(e=>tb(e))??rb.findLast(e=>t.includes(e)),tb=t=>typeof t=="function",rb=["none","short","full"]});import{platform as jbe}from"node:process";import{stripVTControlCharacters as Mbe}from"node:util";var iZ,Wf,oZ,Fbe,Lbe,zbe,Ube,qbe,Bbe,Hbe,nb=y(()=>{iZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Bbe(oZ(o))).join(" ");return{command:n,escapedCommand:i}},Wf=t=>Mbe(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},bR=t=>{if(t==="all")return t;if(Rn.includes(t))return Rn.indexOf(t);let e=Ibe.exec(t);if(e!==null)return Number(e[1])},Ibe=/^fd(\d+)$/,Pbe=(t,e)=>t.map(r=>r===void 0?Dbe[e]:r),Cbe=kbe("execa").enabled?"full":"none",Dbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Cbe,stripFinalNewline:!0},vR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var El,Al,nZ,SR,Nbe,tb,rb,ds=y(()=>{So();El=({verbose:t},e)=>SR(t,e)!=="none",Al=({verbose:t},e)=>!["none","short"].includes(SR(t,e)),nZ=({verbose:t},e)=>{let r=SR(t,e);return tb(r)?r:void 0},SR=(t,e)=>e===void 0?Nbe(t):vo(t,e),Nbe=t=>t.find(e=>tb(e))??rb.findLast(e=>t.includes(e)),tb=t=>typeof t=="function",rb=["none","short","full"]});import{platform as jbe}from"node:process";import{stripVTControlCharacters as Mbe}from"node:util";var iZ,Kf,oZ,Fbe,Lbe,zbe,Ube,qbe,Bbe,Hbe,nb=y(()=>{iZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Bbe(oZ(o))).join(" ");return{command:n,escapedCommand:i}},Kf=t=>Mbe(t).split(` `).map(e=>oZ(e)).join(` -`),oZ=t=>t.replaceAll(zbe,e=>Fbe(e)),Fbe=t=>{let e=Ube[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=qbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Lbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},zbe=Lbe(),Ube={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},qbe=65535,Bbe=t=>Hbe.test(t)?t:jbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Hbe=/^[\w./-]+$/});import sZ from"node:process";function wR(){let{env:t}=sZ,{TERM:e,TERM_PROGRAM:r}=t;return sZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var aZ=y(()=>{});var cZ,lZ,Gbe,Zbe,Vbe,Wbe,Kbe,ib,LQe,uZ=y(()=>{aZ();cZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},lZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Gbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Zbe={...cZ,...lZ},Vbe={...cZ,...Gbe},Wbe=wR(),Kbe=Wbe?Zbe:Vbe,ib=Kbe,LQe=Object.entries(lZ)});import Jbe from"node:tty";var Ybe,be,qQe,dZ,BQe,HQe,GQe,ZQe,VQe,WQe,KQe,JQe,YQe,XQe,QQe,eet,tet,ret,net,ob,iet,oet,set,aet,cet,uet,det,fet,pet,fZ,met,pZ,het,get,yet,_et,bet,vet,wet,xet,$et,ket,Eet,xR=y(()=>{Ybe=Jbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Ybe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},qQe=be(0,0),dZ=be(1,22),BQe=be(2,22),HQe=be(3,23),GQe=be(4,24),ZQe=be(53,55),VQe=be(7,27),WQe=be(8,28),KQe=be(9,29),JQe=be(30,39),YQe=be(31,39),XQe=be(32,39),QQe=be(33,39),eet=be(34,39),tet=be(35,39),ret=be(36,39),net=be(37,39),ob=be(90,39),iet=be(40,49),oet=be(41,49),set=be(42,49),aet=be(43,49),cet=be(44,49),uet=be(45,49),det=be(46,49),fet=be(47,49),pet=be(100,49),fZ=be(91,39),met=be(92,39),pZ=be(93,39),het=be(94,39),get=be(95,39),yet=be(96,39),_et=be(97,39),bet=be(101,49),vet=be(102,49),wet=be(103,49),xet=be(104,49),$et=be(105,49),ket=be(106,49),Eet=be(107,49)});var mZ=y(()=>{xR();xR()});var yZ,Qbe,sb,hZ,eve,gZ,tve,_Z=y(()=>{uZ();mZ();yZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Qbe(r),c=eve[t]({failed:o,reject:s,piped:n}),l=tve[t]({reject:s});return`${ob(`[${a}]`)} ${ob(`[${i}]`)} ${l(c)} ${l(e)}`},Qbe=t=>`${sb(t.getHours(),2)}:${sb(t.getMinutes(),2)}:${sb(t.getSeconds(),2)}.${sb(t.getMilliseconds(),3)}`,sb=(t,e)=>String(t).padStart(e,"0"),hZ=({failed:t,reject:e})=>t?e?ib.cross:ib.warning:ib.tick,eve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:hZ,duration:hZ},gZ=t=>t,tve={command:()=>dZ,output:()=>gZ,ipc:()=>gZ,error:({reject:t})=>t?fZ:pZ,duration:()=>ob}});var bZ,rve,nve,vZ=y(()=>{us();bZ=(t,e,r)=>{let n=nZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>rve(i,o,n)).filter(i=>i!==void 0).map(i=>nve(i)).join("")},rve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},nve=t=>t.endsWith(` +`),oZ=t=>t.replaceAll(zbe,e=>Fbe(e)),Fbe=t=>{let e=Ube[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=qbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Lbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},zbe=Lbe(),Ube={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},qbe=65535,Bbe=t=>Hbe.test(t)?t:jbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Hbe=/^[\w./-]+$/});import sZ from"node:process";function wR(){let{env:t}=sZ,{TERM:e,TERM_PROGRAM:r}=t;return sZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var aZ=y(()=>{});var cZ,lZ,Gbe,Zbe,Vbe,Wbe,Kbe,ib,qQe,uZ=y(()=>{aZ();cZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},lZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Gbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Zbe={...cZ,...lZ},Vbe={...cZ,...Gbe},Wbe=wR(),Kbe=Wbe?Zbe:Vbe,ib=Kbe,qQe=Object.entries(lZ)});import Jbe from"node:tty";var Ybe,be,GQe,dZ,ZQe,VQe,WQe,KQe,JQe,YQe,XQe,QQe,eet,tet,ret,net,iet,oet,set,ob,aet,cet,uet,det,fet,pet,met,het,get,fZ,yet,pZ,_et,bet,vet,wet,xet,$et,ket,Eet,Aet,Tet,Oet,xR=y(()=>{Ybe=Jbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Ybe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},GQe=be(0,0),dZ=be(1,22),ZQe=be(2,22),VQe=be(3,23),WQe=be(4,24),KQe=be(53,55),JQe=be(7,27),YQe=be(8,28),XQe=be(9,29),QQe=be(30,39),eet=be(31,39),tet=be(32,39),ret=be(33,39),net=be(34,39),iet=be(35,39),oet=be(36,39),set=be(37,39),ob=be(90,39),aet=be(40,49),cet=be(41,49),uet=be(42,49),det=be(43,49),fet=be(44,49),pet=be(45,49),met=be(46,49),het=be(47,49),get=be(100,49),fZ=be(91,39),yet=be(92,39),pZ=be(93,39),_et=be(94,39),bet=be(95,39),vet=be(96,39),wet=be(97,39),xet=be(101,49),$et=be(102,49),ket=be(103,49),Eet=be(104,49),Aet=be(105,49),Tet=be(106,49),Oet=be(107,49)});var mZ=y(()=>{xR();xR()});var yZ,Qbe,sb,hZ,eve,gZ,tve,_Z=y(()=>{uZ();mZ();yZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Qbe(r),c=eve[t]({failed:o,reject:s,piped:n}),l=tve[t]({reject:s});return`${ob(`[${a}]`)} ${ob(`[${i}]`)} ${l(c)} ${l(e)}`},Qbe=t=>`${sb(t.getHours(),2)}:${sb(t.getMinutes(),2)}:${sb(t.getSeconds(),2)}.${sb(t.getMilliseconds(),3)}`,sb=(t,e)=>String(t).padStart(e,"0"),hZ=({failed:t,reject:e})=>t?e?ib.cross:ib.warning:ib.tick,eve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:hZ,duration:hZ},gZ=t=>t,tve={command:()=>dZ,output:()=>gZ,ipc:()=>gZ,error:({reject:t})=>t?fZ:pZ,duration:()=>ob}});var bZ,rve,nve,vZ=y(()=>{ds();bZ=(t,e,r)=>{let n=nZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>rve(i,o,n)).filter(i=>i!==void 0).map(i=>nve(i)).join("")},rve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},nve=t=>t.endsWith(` `)?t:`${t} `});import{inspect as ive}from"node:util";var Pi,ove,sve,ave,ab,cve,Tl=y(()=>{nb();_Z();vZ();Pi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ove({type:t,result:i,verboseInfo:n}),s=sve(e,o),a=bZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ove=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),sve=(t,e)=>t.split(` -`).map(r=>ave({...e,message:r})),ave=t=>({verboseLine:yZ(t),verboseObject:t}),ab=t=>{let e=typeof t=="string"?t:ive(t);return Wf(e).replaceAll(" "," ".repeat(cve))},cve=2});var SZ,wZ=y(()=>{us();Tl();SZ=(t,e)=>{El(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var xZ,lve,uve,dve,$Z=y(()=>{us();xZ=(t,e,r)=>{dve(t);let n=lve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},lve=t=>El({verbose:t})?uve++:void 0,uve=0n,dve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!rb.includes(e)&&!tb(e)){let r=rb.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as kZ}from"node:process";var cb,$R,lb=y(()=>{cb=()=>kZ.bigint(),$R=t=>Number(kZ.bigint()-t)/1e6});var ub,kR=y(()=>{wZ();$Z();lb();nb();So();ub=(t,e,r)=>{let n=cb(),{command:i,escapedCommand:o}=iZ(t,e),s=_R(r,"verbose"),a=xZ(s,o,{...r});return SZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var RZ=v((Xet,OZ)=>{OZ.exports=TZ;TZ.sync=pve;var EZ=Ge("fs");function fve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{DZ.exports=PZ;PZ.sync=mve;var IZ=Ge("fs");function PZ(t,e,r){IZ.stat(t,function(n,i){r(n,n?!1:CZ(i,e))})}function mve(t,e){return CZ(IZ.statSync(t),e)}function CZ(t,e){return t.isFile()&&hve(t,e)}function hve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var MZ=v((ttt,jZ)=>{var ett=Ge("fs"),db;process.platform==="win32"||global.TESTING_WINDOWS?db=RZ():db=NZ();jZ.exports=ER;ER.sync=gve;function ER(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){ER(t,e||{},function(o,s){o?i(o):n(s)})})}db(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function gve(t,e){try{return db.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var HZ=v((rtt,BZ)=>{var Ol=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",FZ=Ge("path"),yve=Ol?";":":",LZ=MZ(),zZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),UZ=(t,e)=>{let r=e.colon||yve,n=t.match(/\//)||Ol&&t.match(/\\/)?[""]:[...Ol?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ol?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ol?i.split(r):[""];return Ol&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},qZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=UZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(zZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=FZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];LZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},_ve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=UZ(t,e),o=[];for(let s=0;s{"use strict";var GZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};AR.exports=GZ;AR.exports.default=GZ});var JZ=v((itt,KZ)=>{"use strict";var VZ=Ge("path"),bve=HZ(),vve=ZZ();function WZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=bve.sync(t.command,{path:r[vve({env:r})],pathExt:e?VZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=VZ.resolve(i?t.options.cwd:"",s)),s}function Sve(t){return WZ(t)||WZ(t,!0)}KZ.exports=Sve});var YZ=v((ott,OR)=>{"use strict";var TR=/([()\][%!^"`<>&|;, *?])/g;function wve(t){return t=t.replace(TR,"^$1"),t}function xve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(TR,"^$1"),e&&(t=t.replace(TR,"^$1")),t}OR.exports.command=wve;OR.exports.argument=xve});var QZ=v((stt,XZ)=>{"use strict";XZ.exports=/^#!(.*)/});var t9=v((att,e9)=>{"use strict";var $ve=QZ();e9.exports=(t="")=>{let e=t.match($ve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var n9=v((ctt,r9)=>{"use strict";var RR=Ge("fs"),kve=t9();function Eve(t){let r=Buffer.alloc(150),n;try{n=RR.openSync(t,"r"),RR.readSync(n,r,0,150,0),RR.closeSync(n)}catch{}return kve(r.toString())}r9.exports=Eve});var a9=v((ltt,s9)=>{"use strict";var Ave=Ge("path"),i9=JZ(),o9=YZ(),Tve=n9(),Ove=process.platform==="win32",Rve=/\.(?:com|exe)$/i,Ive=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Pve(t){t.file=i9(t);let e=t.file&&Tve(t.file);return e?(t.args.unshift(t.file),t.command=e,i9(t)):t.file}function Cve(t){if(!Ove)return t;let e=Pve(t),r=!Rve.test(e);if(t.options.forceShell||r){let n=Ive.test(e);t.command=Ave.normalize(t.command),t.command=o9.command(t.command),t.args=t.args.map(o=>o9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Dve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Cve(n)}s9.exports=Dve});var u9=v((utt,l9)=>{"use strict";var IR=process.platform==="win32";function PR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Nve(t,e){if(!IR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=c9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function c9(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawn"):null}function jve(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawnSync"):null}l9.exports={hookChildProcess:Nve,verifyENOENT:c9,verifyENOENTSync:jve,notFoundError:PR}});var p9=v((dtt,Rl)=>{"use strict";var d9=Ge("child_process"),CR=a9(),DR=u9();function f9(t,e,r){let n=CR(t,e,r),i=d9.spawn(n.command,n.args,n.options);return DR.hookChildProcess(i,n),i}function Mve(t,e,r){let n=CR(t,e,r),i=d9.spawnSync(n.command,n.args,n.options);return i.error=i.error||DR.verifyENOENTSync(i.status,n),i}Rl.exports=f9;Rl.exports.spawn=f9;Rl.exports.sync=Mve;Rl.exports._parse=CR;Rl.exports._enoent=DR});function fb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var m9=y(()=>{});var h9=y(()=>{});import{promisify as Fve}from"node:util";import{execFile as Lve,execFileSync as gtt}from"node:child_process";import g9 from"node:path";import{fileURLToPath as zve}from"node:url";function pb(t){return t instanceof URL?zve(t):t}function y9(t){return{*[Symbol.iterator](){let e=g9.resolve(pb(t)),r;for(;r!==e;)yield e,r=e,e=g9.resolve(e,"..")}}}var btt,vtt,_9=y(()=>{h9();btt=Fve(Lve);vtt=10*1024*1024});import mb from"node:process";import Oa from"node:path";var Uve,qve,Bve,b9,v9=y(()=>{m9();_9();Uve=({cwd:t=mb.cwd(),path:e=mb.env[fb()],preferLocal:r=!0,execPath:n=mb.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(pb(t)),s=[],a=e.split(Oa.delimiter);return r&&qve(s,a,o),i&&Bve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},qve=(t,e,r)=>{for(let n of y9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Bve=(t,e,r,n)=>{let i=Oa.resolve(n,pb(r),"..");e.includes(i)||t.push(i)},b9=({env:t=mb.env,...e}={})=>{t={...t};let r=fb({env:t});return e.path=t[r],t[r]=Uve(e),t}});var S9,ti,w9,x9,$9,hb,Kf,Jf,Ra=y(()=>{S9=(t,e,r)=>{let n=r?Jf:Kf,i=t instanceof ti?{}:{cause:t};return new n(e,i)},ti=class extends Error{},w9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,$9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},x9=t=>hb(t)&&$9 in t,$9=Symbol("isExecaError"),hb=t=>Object.prototype.toString.call(t)==="[object Error]",Kf=class extends Error{};w9(Kf,Kf.name);Jf=class extends Error{};w9(Jf,Jf.name)});var k9,Hve,E9,A9,T9=y(()=>{k9=()=>{let t=A9-E9+1;return Array.from({length:t},Hve)},Hve=(t,e)=>({name:`SIGRT${e+1}`,number:E9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),E9=34,A9=64});var O9,R9=y(()=>{O9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Gve}from"node:os";var NR,Zve,I9=y(()=>{R9();T9();NR=()=>{let t=k9();return[...O9,...t].map(Zve)},Zve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Gve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Vve}from"node:os";var Wve,Kve,P9,Jve,Yve,Xve,Mtt,C9=y(()=>{I9();Wve=()=>{let t=NR();return Object.fromEntries(t.map(Kve))},Kve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],P9=Wve(),Jve=()=>{let t=NR(),e=65,r=Array.from({length:e},(n,i)=>Yve(i,t));return Object.assign({},...r)},Yve=(t,e)=>{let r=Xve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Xve=(t,e)=>{let r=e.find(({name:n})=>Vve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Mtt=Jve()});import{constants as Yf}from"node:os";var N9,j9,M9,Qve,eSe,D9,tSe,jR,rSe,nSe,gb,Xf=y(()=>{C9();N9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return M9(t,e)},j9=t=>t===0?t:M9(t,"`subprocess.kill()`'s argument"),M9=(t,e)=>{if(Number.isInteger(t))return Qve(t,e);if(typeof t=="string")return tSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +`).map(r=>ave({...e,message:r})),ave=t=>({verboseLine:yZ(t),verboseObject:t}),ab=t=>{let e=typeof t=="string"?t:ive(t);return Kf(e).replaceAll(" "," ".repeat(cve))},cve=2});var SZ,wZ=y(()=>{ds();Tl();SZ=(t,e)=>{El(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var xZ,lve,uve,dve,$Z=y(()=>{ds();xZ=(t,e,r)=>{dve(t);let n=lve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},lve=t=>El({verbose:t})?uve++:void 0,uve=0n,dve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!rb.includes(e)&&!tb(e)){let r=rb.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as kZ}from"node:process";var cb,$R,lb=y(()=>{cb=()=>kZ.bigint(),$R=t=>Number(kZ.bigint()-t)/1e6});var ub,kR=y(()=>{wZ();$Z();lb();nb();So();ub=(t,e,r)=>{let n=cb(),{command:i,escapedCommand:o}=iZ(t,e),s=_R(r,"verbose"),a=xZ(s,o,{...r});return SZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var RZ=v((ttt,OZ)=>{OZ.exports=TZ;TZ.sync=pve;var EZ=Ge("fs");function fve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{DZ.exports=PZ;PZ.sync=mve;var IZ=Ge("fs");function PZ(t,e,r){IZ.stat(t,function(n,i){r(n,n?!1:CZ(i,e))})}function mve(t,e){return CZ(IZ.statSync(t),e)}function CZ(t,e){return t.isFile()&&hve(t,e)}function hve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var MZ=v((itt,jZ)=>{var ntt=Ge("fs"),db;process.platform==="win32"||global.TESTING_WINDOWS?db=RZ():db=NZ();jZ.exports=ER;ER.sync=gve;function ER(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){ER(t,e||{},function(o,s){o?i(o):n(s)})})}db(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function gve(t,e){try{return db.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var HZ=v((ott,BZ)=>{var Ol=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",FZ=Ge("path"),yve=Ol?";":":",LZ=MZ(),zZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),UZ=(t,e)=>{let r=e.colon||yve,n=t.match(/\//)||Ol&&t.match(/\\/)?[""]:[...Ol?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ol?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ol?i.split(r):[""];return Ol&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},qZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=UZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(zZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=FZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];LZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},_ve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=UZ(t,e),o=[];for(let s=0;s{"use strict";var GZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};AR.exports=GZ;AR.exports.default=GZ});var JZ=v((att,KZ)=>{"use strict";var VZ=Ge("path"),bve=HZ(),vve=ZZ();function WZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=bve.sync(t.command,{path:r[vve({env:r})],pathExt:e?VZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=VZ.resolve(i?t.options.cwd:"",s)),s}function Sve(t){return WZ(t)||WZ(t,!0)}KZ.exports=Sve});var YZ=v((ctt,OR)=>{"use strict";var TR=/([()\][%!^"`<>&|;, *?])/g;function wve(t){return t=t.replace(TR,"^$1"),t}function xve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(TR,"^$1"),e&&(t=t.replace(TR,"^$1")),t}OR.exports.command=wve;OR.exports.argument=xve});var QZ=v((ltt,XZ)=>{"use strict";XZ.exports=/^#!(.*)/});var t9=v((utt,e9)=>{"use strict";var $ve=QZ();e9.exports=(t="")=>{let e=t.match($ve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var n9=v((dtt,r9)=>{"use strict";var RR=Ge("fs"),kve=t9();function Eve(t){let r=Buffer.alloc(150),n;try{n=RR.openSync(t,"r"),RR.readSync(n,r,0,150,0),RR.closeSync(n)}catch{}return kve(r.toString())}r9.exports=Eve});var a9=v((ftt,s9)=>{"use strict";var Ave=Ge("path"),i9=JZ(),o9=YZ(),Tve=n9(),Ove=process.platform==="win32",Rve=/\.(?:com|exe)$/i,Ive=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Pve(t){t.file=i9(t);let e=t.file&&Tve(t.file);return e?(t.args.unshift(t.file),t.command=e,i9(t)):t.file}function Cve(t){if(!Ove)return t;let e=Pve(t),r=!Rve.test(e);if(t.options.forceShell||r){let n=Ive.test(e);t.command=Ave.normalize(t.command),t.command=o9.command(t.command),t.args=t.args.map(o=>o9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Dve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Cve(n)}s9.exports=Dve});var u9=v((ptt,l9)=>{"use strict";var IR=process.platform==="win32";function PR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Nve(t,e){if(!IR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=c9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function c9(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawn"):null}function jve(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawnSync"):null}l9.exports={hookChildProcess:Nve,verifyENOENT:c9,verifyENOENTSync:jve,notFoundError:PR}});var p9=v((mtt,Rl)=>{"use strict";var d9=Ge("child_process"),CR=a9(),DR=u9();function f9(t,e,r){let n=CR(t,e,r),i=d9.spawn(n.command,n.args,n.options);return DR.hookChildProcess(i,n),i}function Mve(t,e,r){let n=CR(t,e,r),i=d9.spawnSync(n.command,n.args,n.options);return i.error=i.error||DR.verifyENOENTSync(i.status,n),i}Rl.exports=f9;Rl.exports.spawn=f9;Rl.exports.sync=Mve;Rl.exports._parse=CR;Rl.exports._enoent=DR});function fb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var m9=y(()=>{});var h9=y(()=>{});import{promisify as Fve}from"node:util";import{execFile as Lve,execFileSync as btt}from"node:child_process";import g9 from"node:path";import{fileURLToPath as zve}from"node:url";function pb(t){return t instanceof URL?zve(t):t}function y9(t){return{*[Symbol.iterator](){let e=g9.resolve(pb(t)),r;for(;r!==e;)yield e,r=e,e=g9.resolve(e,"..")}}}var wtt,xtt,_9=y(()=>{h9();wtt=Fve(Lve);xtt=10*1024*1024});import mb from"node:process";import Oa from"node:path";var Uve,qve,Bve,b9,v9=y(()=>{m9();_9();Uve=({cwd:t=mb.cwd(),path:e=mb.env[fb()],preferLocal:r=!0,execPath:n=mb.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(pb(t)),s=[],a=e.split(Oa.delimiter);return r&&qve(s,a,o),i&&Bve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},qve=(t,e,r)=>{for(let n of y9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Bve=(t,e,r,n)=>{let i=Oa.resolve(n,pb(r),"..");e.includes(i)||t.push(i)},b9=({env:t=mb.env,...e}={})=>{t={...t};let r=fb({env:t});return e.path=t[r],t[r]=Uve(e),t}});var S9,ti,w9,x9,$9,hb,Jf,Yf,Ra=y(()=>{S9=(t,e,r)=>{let n=r?Yf:Jf,i=t instanceof ti?{}:{cause:t};return new n(e,i)},ti=class extends Error{},w9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,$9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},x9=t=>hb(t)&&$9 in t,$9=Symbol("isExecaError"),hb=t=>Object.prototype.toString.call(t)==="[object Error]",Jf=class extends Error{};w9(Jf,Jf.name);Yf=class extends Error{};w9(Yf,Yf.name)});var k9,Hve,E9,A9,T9=y(()=>{k9=()=>{let t=A9-E9+1;return Array.from({length:t},Hve)},Hve=(t,e)=>({name:`SIGRT${e+1}`,number:E9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),E9=34,A9=64});var O9,R9=y(()=>{O9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Gve}from"node:os";var NR,Zve,I9=y(()=>{R9();T9();NR=()=>{let t=k9();return[...O9,...t].map(Zve)},Zve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Gve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Vve}from"node:os";var Wve,Kve,P9,Jve,Yve,Xve,ztt,C9=y(()=>{I9();Wve=()=>{let t=NR();return Object.fromEntries(t.map(Kve))},Kve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],P9=Wve(),Jve=()=>{let t=NR(),e=65,r=Array.from({length:e},(n,i)=>Yve(i,t));return Object.assign({},...r)},Yve=(t,e)=>{let r=Xve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Xve=(t,e)=>{let r=e.find(({name:n})=>Vve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},ztt=Jve()});import{constants as Xf}from"node:os";var N9,j9,M9,Qve,eSe,D9,tSe,jR,rSe,nSe,gb,Qf=y(()=>{C9();N9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return M9(t,e)},j9=t=>t===0?t:M9(t,"`subprocess.kill()`'s argument"),M9=(t,e)=>{if(Number.isInteger(t))return Qve(t,e);if(typeof t=="string")return tSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. ${jR()}`)},Qve=(t,e)=>{if(D9.has(t))return D9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${jR()}`)},eSe=()=>new Map(Object.entries(Yf.signals).reverse().map(([t,e])=>[e,t])),D9=eSe(),tSe=(t,e)=>{if(t in Yf.signals)return t;throw t.toUpperCase()in Yf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${jR()}`)},eSe=()=>new Map(Object.entries(Xf.signals).reverse().map(([t,e])=>[e,t])),D9=eSe(),tSe=(t,e)=>{if(t in Xf.signals)return t;throw t.toUpperCase()in Xf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. ${jR()}`)},jR=()=>`Available signal names: ${rSe()}. -Available signal numbers: ${nSe()}.`,rSe=()=>Object.keys(Yf.signals).sort().map(t=>`'${t}'`).join(", "),nSe=()=>[...new Set(Object.values(Yf.signals).sort((t,e)=>t-e))].join(", "),gb=t=>P9[t].description});import{setTimeout as iSe}from"node:timers/promises";var F9,oSe,L9,sSe,aSe,cSe,MR,yb=y(()=>{Ra();Xf();F9=t=>{if(t===!1)return t;if(t===!0)return oSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},oSe=1e3*5,L9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=sSe(s,a,r);aSe(l,n);let u=t(c);return cSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},sSe=(t,e,r)=>{let[n=r,i]=hb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!hb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:j9(n),error:i}},aSe=(t,e)=>{t!==void 0&&e.reject(t)},cSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&MR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},MR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await iSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as lSe}from"node:events";var _b,FR=y(()=>{_b=async(t,e)=>{t.aborted||await lSe(t,"abort",{signal:e})}});var z9,U9,uSe,LR=y(()=>{FR();z9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},U9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[uSe(t,e,n,i)],uSe=async(t,e,r,{signal:n})=>{throw await _b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Il,dSe,zR,q9,B9,bb,H9,G9,Z9,V9,W9,K9,fSe,pSe,mSe,ri,hSe,ds,Pl,Cl=y(()=>{Il=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{dSe(t,e,r),zR(t,e,n)},dSe=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},zR=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} cannot be used: the ${ds(e)} has already exited or disconnected.`)},q9=t=>{throw new Error(`${ri("getOneMessage",t)} could not complete: the ${ds(t)} exited or disconnected.`)},B9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${ds(t)} is sending a message too, instead of listening to incoming messages. +Available signal numbers: ${nSe()}.`,rSe=()=>Object.keys(Xf.signals).sort().map(t=>`'${t}'`).join(", "),nSe=()=>[...new Set(Object.values(Xf.signals).sort((t,e)=>t-e))].join(", "),gb=t=>P9[t].description});import{setTimeout as iSe}from"node:timers/promises";var F9,oSe,L9,sSe,aSe,cSe,MR,yb=y(()=>{Ra();Qf();F9=t=>{if(t===!1)return t;if(t===!0)return oSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},oSe=1e3*5,L9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=sSe(s,a,r);aSe(l,n);let u=t(c);return cSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},sSe=(t,e,r)=>{let[n=r,i]=hb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!hb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:j9(n),error:i}},aSe=(t,e)=>{t!==void 0&&e.reject(t)},cSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&MR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},MR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await iSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as lSe}from"node:events";var _b,FR=y(()=>{_b=async(t,e)=>{t.aborted||await lSe(t,"abort",{signal:e})}});var z9,U9,uSe,LR=y(()=>{FR();z9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},U9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[uSe(t,e,n,i)],uSe=async(t,e,r,{signal:n})=>{throw await _b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Il,dSe,zR,q9,B9,bb,H9,G9,Z9,V9,W9,K9,fSe,pSe,mSe,ri,hSe,fs,Pl,Cl=y(()=>{Il=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{dSe(t,e,r),zR(t,e,n)},dSe=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},zR=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},q9=t=>{throw new Error(`${ri("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},B9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${ri("getOneMessage",t)}, ${ri("sendMessage",t,"message, {strict: true}")}, -]);`)},bb=(t,e)=>new Error(`${ri("sendMessage",e)} failed when sending an acknowledgment response to the ${ds(e)}.`,{cause:t}),H9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${ds(t)} is not listening to incoming messages.`)},G9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${ds(t)} exited without listening to incoming messages.`)},Z9=()=>new Error(`\`cancelSignal\` aborted: the ${ds(!0)} disconnected.`),V9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},W9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ri(e,r)} cannot be used: the ${ds(r)} is disconnecting.`,{cause:t})},K9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(fSe(t))throw new Error(`${ri(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},fSe=({code:t,message:e})=>pSe.has(t)||mSe.some(r=>e.includes(r)),pSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),mSe=["could not be cloned","circular structure","call stack size exceeded"],ri=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${hSe(e)}${t}(${r})`,hSe=t=>t?"":"subprocess.",ds=t=>t?"parent process":"subprocess",Pl=t=>{t.connected&&t.disconnect()}});var Ci,Dl=y(()=>{Ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Sb,Nl,Di,J9,gSe,ySe,Y9,_Se,X9,Qf,vb,fs=y(()=>{So();Sb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Y9(o,e,n,!0));return s},Nl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Y9(o,e,n,!1));return s},Di=new WeakMap,J9=(t,e,r)=>{let n=gSe(e,r);return ySe(n,e,r,t),n},gSe=(t,e)=>{let r=bR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Qf(e)}" must not be "${t}". +]);`)},bb=(t,e)=>new Error(`${ri("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),H9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},G9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},Z9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),V9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},W9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ri(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},K9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(fSe(t))throw new Error(`${ri(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},fSe=({code:t,message:e})=>pSe.has(t)||mSe.some(r=>e.includes(r)),pSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),mSe=["could not be cloned","circular structure","call stack size exceeded"],ri=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${hSe(e)}${t}(${r})`,hSe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Pl=t=>{t.connected&&t.disconnect()}});var Ci,Dl=y(()=>{Ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Sb,Nl,Di,J9,gSe,ySe,Y9,_Se,X9,ep,vb,ps=y(()=>{So();Sb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Y9(o,e,n,!0));return s},Nl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Y9(o,e,n,!1));return s},Di=new WeakMap,J9=(t,e,r)=>{let n=gSe(e,r);return ySe(n,e,r,t),n},gSe=(t,e)=>{let r=bR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${ep(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},ySe=(t,e,r,n)=>{let i=n[X9(t)];if(i===void 0)throw new TypeError(`"${Qf(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${Qf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Qf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Y9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=_Se(t,r);return`The "${i}: ${vb(o)}" option is incompatible with using "${Qf(n)}: ${vb(e)}". -Please set this option with "pipe" instead.`},_Se=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=X9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},X9=t=>t==="all"?1:t,Qf=t=>t?"to":"from",vb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as bSe}from"node:events";var Ia,wb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),bSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var xb,UR,$b,qR,Q9,eV,ep=y(()=>{xb=(t,e)=>{e&&UR(t)},UR=t=>{t.refCounted()},$b=(t,e)=>{e&&qR(t)},qR=t=>{t.unrefCounted()},Q9=(t,e)=>{e&&(qR(t),qR(t))},eV=(t,e)=>{e&&(UR(t),UR(t))}});import{once as vSe}from"node:events";import{scheduler as SSe}from"node:timers/promises";var tV,rV,kb,nV=y(()=>{Ab();ep();Eb();Tb();tV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(oV(i)||aV(i))return;kb.has(t)||kb.set(t,[]);let o=kb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await sV(t,n,i),await SSe.yield();let s=await iV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},rV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{BR();let o=kb.get(t);for(;o?.length>0;)await vSe(n,"message:done");t.removeListener("message",i),eV(e,r),n.connected=!1,n.emit("disconnect")},kb=new WeakMap});import{EventEmitter as wSe}from"node:events";var ps,Ob,xSe,Rb,tp=y(()=>{nV();ep();ps=(t,e,r)=>{if(Ob.has(t))return Ob.get(t);let n=new wSe;return n.connected=!0,Ob.set(t,n),xSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Ob=new WeakMap,xSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=tV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",rV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),Q9(r,n)},Rb=t=>{let e=Ob.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as $Se}from"node:events";var cV,kSe,lV,iV,oV,uV,Ib,ESe,Pb,dV,Eb=y(()=>{Dl();wb();Nb();Cl();tp();Ab();cV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ps(t,e,r),s=Cb(t,o);return{id:kSe++,type:Pb,message:n,hasListeners:s}},kSe=0n,lV=(t,e)=>{if(!(e?.type!==Pb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Ib[r].resolve({isDeadlock:!0,hasListeners:!1})},iV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Pb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:dV,message:Cb(e,i)};try{await Db({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},oV=t=>{if(t?.type!==dV)return!1;let{id:e,message:r}=t;return Ib[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},uV=async(t,e,r)=>{if(t?.type!==Pb)return;let n=Ci();Ib[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ESe(e,r,i)]);o&&B9(r),s||H9(r)}finally{i.abort(),delete Ib[t.id]}},Ib={},ESe=async(t,e,{signal:r})=>{Ia(t,1,r),await $Se(t,"disconnect",{signal:r}),G9(e)},Pb="execa:ipc:request",dV="execa:ipc:response"});var fV,pV,sV,rp,Cb,ASe,Ab=y(()=>{Dl();So();fs();Eb();fV=(t,e,r)=>{rp.has(t)||rp.set(t,new Set);let n=rp.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},pV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},sV=async(t,e,r)=>{for(;!Cb(t,e)&&rp.get(t)?.size>0;){let n=[...rp.get(t)];lV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},rp=new WeakMap,Cb=(t,e)=>e.listenerCount("message")>ASe(t),ASe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as TSe}from"node:util";var Db,OSe,GR,RSe,HR,Nb=y(()=>{Cl();Ab();Eb();Db=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Il({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),OSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},OSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=cV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=fV(t,s,o);try{await GR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Pl(t),c}finally{pV(a)}},GR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=RSe(t);try{await Promise.all([uV(n,t,r),o(n)])}catch(s){throw W9({error:s,methodName:e,isSubprocess:r}),K9({error:s,methodName:e,isSubprocess:r,message:i}),s}},RSe=t=>{if(HR.has(t))return HR.get(t);let e=TSe(t.send.bind(t));return HR.set(t,e),e},HR=new WeakMap});import{scheduler as ISe}from"node:timers/promises";var hV,gV,PSe,mV,aV,yV,BR,ZR,Tb=y(()=>{Nb();tp();Cl();hV=(t,e)=>{let r="cancelSignal";return zR(r,!1,t.connected),GR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:yV,message:e},message:e})},gV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await PSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),ZR.signal),PSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!mV){if(mV=!0,!n){V9();return}if(e===null){BR();return}ps(t,e,r),await ISe.yield()}},mV=!1,aV=t=>t?.type!==yV?!1:(ZR.abort(t.message),!0),yV="execa:ipc:cancel",BR=()=>{ZR.abort(Z9())},ZR=new AbortController});var _V,bV,CSe,DSe,VR=y(()=>{FR();Tb();yb();_V=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},bV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[CSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],CSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await _b(e,i);let o=DSe(e);throw await hV(t,o),MR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},DSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as NSe}from"node:timers/promises";var vV,SV,jSe,WR=y(()=>{Ra();vV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},SV=(t,e,r,n)=>e===0||e===void 0?[]:[jSe(t,e,r,n)],jSe=async(t,e,r,{signal:n})=>{throw await NSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ti}});import{execPath as MSe,execArgv as FSe}from"node:process";import wV from"node:path";var xV,$V,KR=y(()=>{kl();xV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},$V=(t,e,{node:r=!1,nodePath:n=MSe,nodeOptions:i=FSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=$l(n,'The "nodePath" option'),l=wV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(wV.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as LSe}from"node:v8";var kV,zSe,USe,qSe,EV,JR=y(()=>{kV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");qSe[r](t)}},zSe=t=>{try{LSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},USe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},qSe={advanced:zSe,json:USe},EV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var TV,BSe,sn,YR,HSe,AV,jb,Pa=y(()=>{TV=({encoding:t})=>{if(YR.has(t))return;let e=HSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. +It is optional and defaults to "${i}".`)},ySe=(t,e,r,n)=>{let i=n[X9(t)];if(i===void 0)throw new TypeError(`"${ep(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${ep(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${ep(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Y9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=_Se(t,r);return`The "${i}: ${vb(o)}" option is incompatible with using "${ep(n)}: ${vb(e)}". +Please set this option with "pipe" instead.`},_Se=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=X9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},X9=t=>t==="all"?1:t,ep=t=>t?"to":"from",vb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as bSe}from"node:events";var Ia,wb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),bSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var xb,UR,$b,qR,Q9,eV,tp=y(()=>{xb=(t,e)=>{e&&UR(t)},UR=t=>{t.refCounted()},$b=(t,e)=>{e&&qR(t)},qR=t=>{t.unrefCounted()},Q9=(t,e)=>{e&&(qR(t),qR(t))},eV=(t,e)=>{e&&(UR(t),UR(t))}});import{once as vSe}from"node:events";import{scheduler as SSe}from"node:timers/promises";var tV,rV,kb,nV=y(()=>{Ab();tp();Eb();Tb();tV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(oV(i)||aV(i))return;kb.has(t)||kb.set(t,[]);let o=kb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await sV(t,n,i),await SSe.yield();let s=await iV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},rV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{BR();let o=kb.get(t);for(;o?.length>0;)await vSe(n,"message:done");t.removeListener("message",i),eV(e,r),n.connected=!1,n.emit("disconnect")},kb=new WeakMap});import{EventEmitter as wSe}from"node:events";var ms,Ob,xSe,Rb,rp=y(()=>{nV();tp();ms=(t,e,r)=>{if(Ob.has(t))return Ob.get(t);let n=new wSe;return n.connected=!0,Ob.set(t,n),xSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Ob=new WeakMap,xSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=tV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",rV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),Q9(r,n)},Rb=t=>{let e=Ob.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as $Se}from"node:events";var cV,kSe,lV,iV,oV,uV,Ib,ESe,Pb,dV,Eb=y(()=>{Dl();wb();Nb();Cl();rp();Ab();cV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=Cb(t,o);return{id:kSe++,type:Pb,message:n,hasListeners:s}},kSe=0n,lV=(t,e)=>{if(!(e?.type!==Pb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Ib[r].resolve({isDeadlock:!0,hasListeners:!1})},iV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Pb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:dV,message:Cb(e,i)};try{await Db({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},oV=t=>{if(t?.type!==dV)return!1;let{id:e,message:r}=t;return Ib[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},uV=async(t,e,r)=>{if(t?.type!==Pb)return;let n=Ci();Ib[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ESe(e,r,i)]);o&&B9(r),s||H9(r)}finally{i.abort(),delete Ib[t.id]}},Ib={},ESe=async(t,e,{signal:r})=>{Ia(t,1,r),await $Se(t,"disconnect",{signal:r}),G9(e)},Pb="execa:ipc:request",dV="execa:ipc:response"});var fV,pV,sV,np,Cb,ASe,Ab=y(()=>{Dl();So();ps();Eb();fV=(t,e,r)=>{np.has(t)||np.set(t,new Set);let n=np.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},pV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},sV=async(t,e,r)=>{for(;!Cb(t,e)&&np.get(t)?.size>0;){let n=[...np.get(t)];lV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},np=new WeakMap,Cb=(t,e)=>e.listenerCount("message")>ASe(t),ASe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as TSe}from"node:util";var Db,OSe,GR,RSe,HR,Nb=y(()=>{Cl();Ab();Eb();Db=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Il({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),OSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},OSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=cV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=fV(t,s,o);try{await GR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Pl(t),c}finally{pV(a)}},GR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=RSe(t);try{await Promise.all([uV(n,t,r),o(n)])}catch(s){throw W9({error:s,methodName:e,isSubprocess:r}),K9({error:s,methodName:e,isSubprocess:r,message:i}),s}},RSe=t=>{if(HR.has(t))return HR.get(t);let e=TSe(t.send.bind(t));return HR.set(t,e),e},HR=new WeakMap});import{scheduler as ISe}from"node:timers/promises";var hV,gV,PSe,mV,aV,yV,BR,ZR,Tb=y(()=>{Nb();rp();Cl();hV=(t,e)=>{let r="cancelSignal";return zR(r,!1,t.connected),GR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:yV,message:e},message:e})},gV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await PSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),ZR.signal),PSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!mV){if(mV=!0,!n){V9();return}if(e===null){BR();return}ms(t,e,r),await ISe.yield()}},mV=!1,aV=t=>t?.type!==yV?!1:(ZR.abort(t.message),!0),yV="execa:ipc:cancel",BR=()=>{ZR.abort(Z9())},ZR=new AbortController});var _V,bV,CSe,DSe,VR=y(()=>{FR();Tb();yb();_V=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},bV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[CSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],CSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await _b(e,i);let o=DSe(e);throw await hV(t,o),MR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},DSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as NSe}from"node:timers/promises";var vV,SV,jSe,WR=y(()=>{Ra();vV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},SV=(t,e,r,n)=>e===0||e===void 0?[]:[jSe(t,e,r,n)],jSe=async(t,e,r,{signal:n})=>{throw await NSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ti}});import{execPath as MSe,execArgv as FSe}from"node:process";import wV from"node:path";var xV,$V,KR=y(()=>{kl();xV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},$V=(t,e,{node:r=!1,nodePath:n=MSe,nodeOptions:i=FSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=$l(n,'The "nodePath" option'),l=wV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(wV.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as LSe}from"node:v8";var kV,zSe,USe,qSe,EV,JR=y(()=>{kV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");qSe[r](t)}},zSe=t=>{try{LSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},USe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},qSe={advanced:zSe,json:USe},EV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var TV,BSe,sn,YR,HSe,AV,jb,Pa=y(()=>{TV=({encoding:t})=>{if(YR.has(t))return;let e=HSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. Please rename it to ${jb(e)}.`);let r=[...YR].map(n=>jb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. Please rename it to one of: ${r}.`)},BSe=new Set(["utf8","utf16le"]),sn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),YR=new Set([...BSe,...sn]),HSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in AV)return AV[e];if(YR.has(e))return e},AV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},jb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as GSe}from"node:fs";import ZSe from"node:path";import VSe from"node:process";var OV,RV,IV,XR=y(()=>{kl();OV=(t=RV())=>{let e=$l(t,'The "cwd" option');return ZSe.resolve(e)},RV=()=>{try{return VSe.cwd()}catch(t){throw t.message=`The current directory does not exist. ${t.message}`,t}},IV=(t,e)=>{if(e===RV())return t;let r;try{r=GSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import WSe from"node:path";import PV from"node:process";var CV,Mb,KSe,JSe,QR=y(()=>{CV=St(p9(),1);v9();yb();Xf();LR();VR();WR();KR();JR();Pa();XR();kl();So();Mb=(t,e,r)=>{r.cwd=OV(r.cwd);let[n,i,o]=$V(t,e,r),{command:s,args:a,options:c}=CV.default._parse(n,i,o),l=rZ(c),u=KSe(l);return vV(u),TV(u),kV(u),z9(u),_V(u),u.shell=mR(u.shell),u.env=JSe(u),u.killSignal=N9(u.killSignal),u.forceKillAfterDelay=F9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!sn.has(u.encoding)&&u.buffer[f]),PV.platform==="win32"&&WSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},KSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),JSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...PV.env,...t}:t;return r||n?b9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Fb,eI=y(()=>{Fb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function jl(t){if(typeof t=="string")return YSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return XSe(t)}var YSe,XSe,DV,QSe,NV,ewe,tI=y(()=>{YSe=t=>t.at(-1)===DV?t.slice(0,t.at(-2)===NV?-2:-1):t,XSe=t=>t.at(-1)===QSe?t.subarray(0,t.at(-2)===ewe?-2:-1):t,DV=` -`,QSe=DV.codePointAt(0),NV="\r",ewe=NV.codePointAt(0)});function ni(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function rI(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Ca(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function nI(t,e){return rI(t,e)&&Ca(t,e)}var Da=y(()=>{});function jV(){return this[oI].next()}function MV(t){return this[oI].return(t)}function sI({preventCancel:t=!1}={}){let e=this.getReader(),r=new iI(e,t),n=Object.create(rwe);return n[oI]=r,n}var twe,iI,oI,rwe,FV=y(()=>{twe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),iI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},oI=Symbol();Object.defineProperty(jV,"name",{value:"next"});Object.defineProperty(MV,"name",{value:"return"});rwe=Object.create(twe,{next:{enumerable:!0,configurable:!0,writable:!0,value:jV},return:{enumerable:!0,configurable:!0,writable:!0,value:MV}})});var LV=y(()=>{});var zV=y(()=>{FV();LV()});var UV,nwe,iwe,owe,np,aI=y(()=>{Da();zV();UV=t=>{if(Ca(t,{checkOpen:!1})&&np.on!==void 0)return iwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(nwe.call(t)==="[object ReadableStream]")return sI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:nwe}=Object.prototype,iwe=async function*(t){let e=new AbortController,r={};owe(t,e,r);try{for await(let[n]of np.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},owe=async(t,e,r)=>{try{await np.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},np={}});var Ml,swe,HV,qV,awe,BV,Ni,ip=y(()=>{aI();Ml=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=UV(t),u=e();u.length=0;try{for await(let d of l){let f=awe(d),p=r[f](d,u);HV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return swe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},swe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&HV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},HV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){qV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&qV(c,e,i,o),new Ni},qV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},awe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=BV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&BV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:BV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,op,Lb,zb,Ub,qb=y(()=>{wo=t=>t,op=()=>{},Lb=({contents:t})=>t,zb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ub=t=>t.length});async function Bb(t,e){return Ml(t,dwe,e)}var cwe,lwe,uwe,dwe,GV=y(()=>{ip();qb();cwe=()=>({contents:[]}),lwe=()=>1,uwe=(t,{contents:e})=>(e.push(t),e),dwe={init:cwe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:lwe,truncateChunk:op,addChunk:uwe,getFinalChunk:op,finalize:Lb}});async function Hb(t,e){return Ml(t,vwe,e)}var fwe,pwe,mwe,ZV,VV,hwe,gwe,ywe,_we,KV,WV,bwe,JV,vwe,YV=y(()=>{ip();qb();fwe=()=>({contents:new ArrayBuffer(0)}),pwe=t=>mwe.encode(t),mwe=new TextEncoder,ZV=t=>new Uint8Array(t),VV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hwe=(t,e)=>t.slice(0,e),gwe=(t,{contents:e,length:r},n)=>{let i=JV()?_we(e,n):ywe(e,n);return new Uint8Array(i).set(t,r),i},ywe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(KV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},_we=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:KV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},KV=t=>WV**Math.ceil(Math.log(t)/Math.log(WV)),WV=2,bwe=({contents:t,length:e})=>JV()?t:t.slice(0,e),JV=()=>"resize"in ArrayBuffer.prototype,vwe={init:fwe,convertChunk:{string:pwe,buffer:ZV,arrayBuffer:ZV,dataView:VV,typedArray:VV,others:zb},getSize:Ub,truncateChunk:hwe,addChunk:gwe,getFinalChunk:op,finalize:bwe}});async function Zb(t,e){return Ml(t,kwe,e)}var Swe,Gb,wwe,xwe,$we,kwe,XV=y(()=>{ip();qb();Swe=()=>({contents:"",textDecoder:new TextDecoder}),Gb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),wwe=(t,{contents:e})=>e+t,xwe=(t,e)=>t.slice(0,e),$we=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},kwe={init:Swe,convertChunk:{string:wo,buffer:Gb,arrayBuffer:Gb,dataView:Gb,typedArray:Gb,others:zb},getSize:Ub,truncateChunk:xwe,addChunk:wwe,getFinalChunk:$we,finalize:Lb}});var QV=y(()=>{GV();YV();XV();ip()});import{on as Ewe}from"node:events";import{finished as Awe}from"node:stream/promises";var Vb=y(()=>{aI();QV();Object.assign(np,{on:Ewe,finished:Awe})});var eW,Twe,tW,rW,Owe,nW,iW,Wb,Na=y(()=>{Vb();bo();So();eW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ni))throw t;if(o==="all")return t;let s=Twe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Twe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",tW=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},rW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Owe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=vo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:eb(r),threshold:i,unit:n}},nW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Wb(r)),iW=(t,e,r)=>{if(!e)return t;let n=Wb(r);return t.length>n?t.slice(0,n):t},Wb=([,t])=>t});import{inspect as Rwe}from"node:util";var sW,Iwe,Pwe,Cwe,Dwe,Nwe,oW,aW=y(()=>{tI();on();XR();nb();Na();Xf();Ra();sW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Iwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Cwe(n,b),w=x===void 0?"":` +${t}`}});import WSe from"node:path";import PV from"node:process";var CV,Mb,KSe,JSe,QR=y(()=>{CV=St(p9(),1);v9();yb();Qf();LR();VR();WR();KR();JR();Pa();XR();kl();So();Mb=(t,e,r)=>{r.cwd=OV(r.cwd);let[n,i,o]=$V(t,e,r),{command:s,args:a,options:c}=CV.default._parse(n,i,o),l=rZ(c),u=KSe(l);return vV(u),TV(u),kV(u),z9(u),_V(u),u.shell=mR(u.shell),u.env=JSe(u),u.killSignal=N9(u.killSignal),u.forceKillAfterDelay=F9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!sn.has(u.encoding)&&u.buffer[f]),PV.platform==="win32"&&WSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},KSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),JSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...PV.env,...t}:t;return r||n?b9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Fb,eI=y(()=>{Fb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function jl(t){if(typeof t=="string")return YSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return XSe(t)}var YSe,XSe,DV,QSe,NV,ewe,tI=y(()=>{YSe=t=>t.at(-1)===DV?t.slice(0,t.at(-2)===NV?-2:-1):t,XSe=t=>t.at(-1)===QSe?t.subarray(0,t.at(-2)===ewe?-2:-1):t,DV=` +`,QSe=DV.codePointAt(0),NV="\r",ewe=NV.codePointAt(0)});function ni(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function rI(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Ca(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function nI(t,e){return rI(t,e)&&Ca(t,e)}var Da=y(()=>{});function jV(){return this[oI].next()}function MV(t){return this[oI].return(t)}function sI({preventCancel:t=!1}={}){let e=this.getReader(),r=new iI(e,t),n=Object.create(rwe);return n[oI]=r,n}var twe,iI,oI,rwe,FV=y(()=>{twe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),iI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},oI=Symbol();Object.defineProperty(jV,"name",{value:"next"});Object.defineProperty(MV,"name",{value:"return"});rwe=Object.create(twe,{next:{enumerable:!0,configurable:!0,writable:!0,value:jV},return:{enumerable:!0,configurable:!0,writable:!0,value:MV}})});var LV=y(()=>{});var zV=y(()=>{FV();LV()});var UV,nwe,iwe,owe,ip,aI=y(()=>{Da();zV();UV=t=>{if(Ca(t,{checkOpen:!1})&&ip.on!==void 0)return iwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(nwe.call(t)==="[object ReadableStream]")return sI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:nwe}=Object.prototype,iwe=async function*(t){let e=new AbortController,r={};owe(t,e,r);try{for await(let[n]of ip.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},owe=async(t,e,r)=>{try{await ip.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},ip={}});var Ml,swe,HV,qV,awe,BV,Ni,op=y(()=>{aI();Ml=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=UV(t),u=e();u.length=0;try{for await(let d of l){let f=awe(d),p=r[f](d,u);HV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return swe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},swe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&HV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},HV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){qV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&qV(c,e,i,o),new Ni},qV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},awe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=BV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&BV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:BV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,sp,Lb,zb,Ub,qb=y(()=>{wo=t=>t,sp=()=>{},Lb=({contents:t})=>t,zb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ub=t=>t.length});async function Bb(t,e){return Ml(t,dwe,e)}var cwe,lwe,uwe,dwe,GV=y(()=>{op();qb();cwe=()=>({contents:[]}),lwe=()=>1,uwe=(t,{contents:e})=>(e.push(t),e),dwe={init:cwe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:lwe,truncateChunk:sp,addChunk:uwe,getFinalChunk:sp,finalize:Lb}});async function Hb(t,e){return Ml(t,vwe,e)}var fwe,pwe,mwe,ZV,VV,hwe,gwe,ywe,_we,KV,WV,bwe,JV,vwe,YV=y(()=>{op();qb();fwe=()=>({contents:new ArrayBuffer(0)}),pwe=t=>mwe.encode(t),mwe=new TextEncoder,ZV=t=>new Uint8Array(t),VV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hwe=(t,e)=>t.slice(0,e),gwe=(t,{contents:e,length:r},n)=>{let i=JV()?_we(e,n):ywe(e,n);return new Uint8Array(i).set(t,r),i},ywe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(KV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},_we=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:KV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},KV=t=>WV**Math.ceil(Math.log(t)/Math.log(WV)),WV=2,bwe=({contents:t,length:e})=>JV()?t:t.slice(0,e),JV=()=>"resize"in ArrayBuffer.prototype,vwe={init:fwe,convertChunk:{string:pwe,buffer:ZV,arrayBuffer:ZV,dataView:VV,typedArray:VV,others:zb},getSize:Ub,truncateChunk:hwe,addChunk:gwe,getFinalChunk:sp,finalize:bwe}});async function Zb(t,e){return Ml(t,kwe,e)}var Swe,Gb,wwe,xwe,$we,kwe,XV=y(()=>{op();qb();Swe=()=>({contents:"",textDecoder:new TextDecoder}),Gb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),wwe=(t,{contents:e})=>e+t,xwe=(t,e)=>t.slice(0,e),$we=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},kwe={init:Swe,convertChunk:{string:wo,buffer:Gb,arrayBuffer:Gb,dataView:Gb,typedArray:Gb,others:zb},getSize:Ub,truncateChunk:xwe,addChunk:wwe,getFinalChunk:$we,finalize:Lb}});var QV=y(()=>{GV();YV();XV();op()});import{on as Ewe}from"node:events";import{finished as Awe}from"node:stream/promises";var Vb=y(()=>{aI();QV();Object.assign(ip,{on:Ewe,finished:Awe})});var eW,Twe,tW,rW,Owe,nW,iW,Wb,Na=y(()=>{Vb();bo();So();eW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ni))throw t;if(o==="all")return t;let s=Twe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Twe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",tW=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},rW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Owe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=vo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:eb(r),threshold:i,unit:n}},nW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Wb(r)),iW=(t,e,r)=>{if(!e)return t;let n=Wb(r);return t.length>n?t.slice(0,n):t},Wb=([,t])=>t});import{inspect as Rwe}from"node:util";var sW,Iwe,Pwe,Cwe,Dwe,Nwe,oW,aW=y(()=>{tI();on();XR();nb();Na();Qf();Ra();sW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Iwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Cwe(n,b),w=x===void 0?"":` ${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>Dwe(D)).join(` -`)].map(D=>Wf(jl(Nwe(D)))).filter(Boolean).join(` +`)].map(D=>Kf(jl(Nwe(D)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:O,message:A}},Iwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Pwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${rW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${gb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Pwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Cwe=(t,e)=>{if(t instanceof ti)return;let r=x9(t)?t.originalMessage:String(t?.message??t),n=Wf(IV(r,e));return n===""?void 0:n},Dwe=t=>typeof t=="string"?t:Rwe(t),Nwe=t=>Array.isArray(t)?t.map(e=>jl(oW(e))).filter(Boolean).join(` -`):oW(t),oW=t=>typeof t=="string"?t:qt(t)?X_(t):""});var Kb,Fl,sp,jwe,cW,Mwe,ap=y(()=>{Xf();lb();Ra();aW();Kb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>cW({command:t,escapedCommand:e,cwd:o,durationMs:$R(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Fl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>sp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),sp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Mwe(l,u),{originalMessage:A,shortMessage:D,message:$}=sW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=S9(t,$,x);return Object.assign(re,jwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},jwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>cW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:$R(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),cW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Mwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:gb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Fwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(lW(t*1e3)%1e3),nanoseconds:Math.trunc(lW(t*1e6)%1e3)}}function Lwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function cI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Fwe(t);break}case"bigint":return Lwe(t)}throw new TypeError("Expected a finite number or bigint")}var lW,uW=y(()=>{lW=t=>Number.isFinite(t)?t:0});function lI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+qwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&zwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Uwe(d,u):f;i.push(p)}},a=cI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Bwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var zwe,Uwe,qwe,Bwe,dW=y(()=>{uW();zwe=t=>t===0||t===0n,Uwe=(t,e)=>e===1||e===1n?t:`${t}s`,qwe=1e-7,Bwe=24n*60n*60n*1000n});var fW,pW=y(()=>{Tl();fW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var mW,Hwe,hW=y(()=>{dW();us();Tl();pW();mW=(t,e)=>{El(e)&&(fW(t,e),Hwe(t,e))},Hwe=(t,e)=>{let r=`(done in ${lI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ll,Jb=y(()=>{hW();Ll=(t,e,{reject:r})=>{if(mW(t,e),t.failed&&r)throw t;return t}});var _W,Gwe,Zwe,bW,vW,gW,Vwe,uI,yW,ja,SW,Wwe,Yb,wW,Kwe,Jwe,dI,xW,Ywe,$W,Xb,Xwe,fI,Qwe,exe,kW,In,Qb,pI,EW,AW,ms,wr=y(()=>{Da();yo();on();_W=(t,e)=>ja(t)?"asyncGenerator":SW(t)?"generator":Yb(t)?"fileUrl":Kwe(t)?"filePath":Xwe(t)?"webStream":ni(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Qwe(t)?"asyncIterable":exe(t)?"iterable":fI(t)?bW({transform:t},e):Wwe(t)?Gwe(t,e):"native",Gwe=(t,e)=>nI(t.transform,{checkOpen:!1})?Zwe(t,e):fI(t.transform)?bW(t,e):Vwe(t,e),Zwe=(t,e)=>(vW(t,e,"Duplex stream"),"duplex"),bW=(t,e)=>(vW(t,e,"web TransformStream"),"webTransform"),vW=({final:t,binary:e,objectMode:r},n,i)=>{gW(t,`${n}.final`,i),gW(e,`${n}.binary`,i),uI(r,`${n}.objectMode`)},gW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Vwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!yW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(nI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(fI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!yW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return uI(r,`${i}.binary`),uI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},uI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},yW=t=>ja(t)||SW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",SW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Wwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Yb=t=>Object.prototype.toString.call(t)==="[object URL]",wW=t=>Yb(t)&&t.protocol!=="file:",Kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Jwe.has(e))&&dI(t.file),Jwe=new Set(["file","append"]),dI=t=>typeof t=="string",xW=(t,e)=>t==="native"&&typeof e=="string"&&!Ywe.has(e),Ywe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),$W=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Xb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Xwe=t=>$W(t)||Xb(t),fI=t=>$W(t?.readable)&&Xb(t?.writable),Qwe=t=>kW(t)&&typeof t[Symbol.asyncIterator]=="function",exe=t=>kW(t)&&typeof t[Symbol.iterator]=="function",kW=t=>typeof t=="object"&&t!==null,In=new Set(["generator","asyncGenerator","duplex","webTransform"]),Qb=new Set(["fileUrl","filePath","fileNumber"]),pI=new Set(["fileUrl","filePath"]),EW=new Set([...pI,"webStream","nodeStream"]),AW=new Set(["webTransform","duplex"]),ms={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var mI,txe,rxe,TW,hI=y(()=>{wr();mI=(t,e,r,n)=>n==="output"?txe(t,e,r):rxe(t,e,r),txe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},rxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},TW=(t,e)=>{let r=t.findLast(({type:n})=>In.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var OW,nxe,ixe,oxe,sxe,axe,cxe,RW=y(()=>{yo();Pa();wr();hI();OW=(t,e,r,n)=>[...t.filter(({type:i})=>!In.has(i)),...nxe(t,e,r,n)],nxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>In.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=ixe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return cxe(o,r)},ixe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?oxe({stdioItem:t,optionName:i}):e==="webTransform"?sxe({stdioItem:t,index:r,newTransforms:n,direction:o}):axe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),oxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},sxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=mI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},axe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||sn.has(o),{writableObjectMode:f,readableObjectMode:p}=mI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},cxe=(t,e)=>e==="input"?t.reverse():t});import gI from"node:process";var IW,lxe,uxe,zl,yI,PW,dxe,fxe,CW=y(()=>{Da();wr();IW=(t,e,r)=>{let n=t.map(i=>lxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??fxe},lxe=({type:t,value:e},r)=>uxe[r]??PW[t](e),uxe=["input","output","output"],zl=()=>{},yI=()=>"input",PW={generator:zl,asyncGenerator:zl,fileUrl:zl,filePath:zl,iterable:yI,asyncIterable:yI,uint8Array:yI,webStream:t=>Xb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?rI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:zl,duplex:zl,native(t){let e=dxe(t);if(e!==void 0)return e;if(ni(t,{checkOpen:!1}))return PW.nodeStream(t)}},dxe=t=>{if([0,gI.stdin].includes(t))return"input";if([1,2,gI.stdout,gI.stderr].includes(t))return"output"},fxe="output"});var DW,NW=y(()=>{DW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var jW,pxe,mxe,MW,hxe,gxe,FW=y(()=>{bo();NW();us();jW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=pxe(t,n).map((a,c)=>MW(a,c));return o?hxe(s,r,i):DW(s,e)},pxe=(t,e)=>{if(t===void 0)return Rn.map(n=>e[n]);if(mxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Rn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Rn.length);return Array.from({length:r},(n,i)=>t[i])},mxe=t=>Rn.some(e=>t[e]!==void 0),MW=(t,e)=>Array.isArray(t)?t.map(r=>MW(r,e)):t??(e>=Rn.length?"ignore":"pipe"),hxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Al(r,i)&&gxe(n)?"ignore":n),gxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as yxe}from"node:fs";import _xe from"node:tty";var zW,bxe,vxe,Sxe,wxe,LW,UW=y(()=>{Da();bo();on();fs();zW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?bxe({stdioItem:t,fdNumber:n,direction:i}):wxe({stdioItem:t,fdNumber:n}),bxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=vxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ni(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},vxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Sxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(_xe.isatty(i))throw new TypeError(`The \`${e}: ${vb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:_o(yxe(i)),optionName:e}}},Sxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=Q_.indexOf(t);if(r!==-1)return r},wxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:LW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:LW(e,e,r),optionName:r}:ni(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,LW=(t,e,r)=>{let n=Q_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var qW,xxe,$xe,kxe,Exe,BW=y(()=>{Da();on();wr();qW=({input:t,inputFile:e},r)=>r===0?[...xxe(t),...kxe(e)]:[],xxe=t=>t===void 0?[]:[{type:$xe(t),value:t,optionName:"input"}],$xe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},kxe=t=>t===void 0?[]:[{...Exe(t),optionName:"inputFile"}],Exe=t=>{if(Yb(t))return{type:"fileUrl",value:t};if(dI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var HW,GW,Axe,Txe,ZW,Oxe,Rxe,VW,WW=y(()=>{wr();HW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),GW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Axe(i,t);if(s.length!==0){if(o){Txe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(EW.has(t))return ZW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});AW.has(t)&&Rxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Axe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Txe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{pI.has(e)&&ZW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},ZW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return VW(s,n,e),i==="output"?o[0].stream:void 0},Oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Rxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);VW(i,n,e)},VW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ms[r]} that is the same.`)}});var ev,Ixe,Pxe,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,_I,qxe,tv=y(()=>{bo();RW();hI();wr();CW();FW();UW();BW();WW();ev=(t,e,r,n)=>{let o=jW(e,r,n).map((a,c)=>Ixe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Lxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>qxe(a)),s},Ixe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=eb(e),{stdioItems:o,isStdioArray:s}=Pxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=IW(o,e,i),c=o.map(d=>zW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=OW(c,i,a,r),u=TW(l,a);return Fxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Pxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Cxe(c,n)),...qW(r,e)],s=HW(o),a=s.length>1;return Dxe(s,a,n),jxe(s),{stdioItems:s,isStdioArray:a}},Cxe=(t,e)=>({type:_W(t,e),value:t,optionName:e}),Dxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Nxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Nxe=new Set(["ignore","ipc"]),jxe=t=>{for(let e of t)Mxe(e)},Mxe=({type:t,value:e,optionName:r})=>{if(wW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(xW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Fxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Qb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Lxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(zxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw _I(i),o}},zxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Uxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Uxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=GW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},_I=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ei(r)&&r.destroy()},qxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as KW}from"node:fs";var YW,ji,Bxe,XW,JW,Hxe,QW=y(()=>{on();tv();wr();YW=(t,e)=>ev(Hxe,t,e,!0),ji=({type:t,optionName:e})=>{XW(e,ms[t])},Bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&XW(t,`"${e}"`),{}),XW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},JW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Bxe},Hxe={input:{...JW,fileUrl:({value:t})=>({contents:[_o(KW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(KW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...JW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:ji,string:ji,uint8Array:ji}}});var xo,bI,cp=y(()=>{tI();xo=(t,{stripFinalNewline:e},r)=>bI(e,r)&&t!==void 0&&!Array.isArray(t)?jl(t):t,bI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var rv,SI,eK,tK,Gxe,Zxe,Vxe,rK,Wxe,vI,Kxe,Jxe,Yxe,nv=y(()=>{rv=(t,e,r,n)=>t||r?void 0:tK(e,n),SI=(t,e,r)=>r?t.flatMap(n=>eK(n,e)):eK(t,e),eK=(t,e)=>{let{transform:r,final:n}=tK(e,{});return[...r(t),...n()]},tK=(t,e)=>(e.previousChunks="",{transform:Gxe.bind(void 0,e,t),final:Vxe.bind(void 0,e)}),Gxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o{let m=Pwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${rW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${gb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Pwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Cwe=(t,e)=>{if(t instanceof ti)return;let r=x9(t)?t.originalMessage:String(t?.message??t),n=Kf(IV(r,e));return n===""?void 0:n},Dwe=t=>typeof t=="string"?t:Rwe(t),Nwe=t=>Array.isArray(t)?t.map(e=>jl(oW(e))).filter(Boolean).join(` +`):oW(t),oW=t=>typeof t=="string"?t:qt(t)?X_(t):""});var Kb,Fl,ap,jwe,cW,Mwe,cp=y(()=>{Qf();lb();Ra();aW();Kb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>cW({command:t,escapedCommand:e,cwd:o,durationMs:$R(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Fl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>ap({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),ap=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Mwe(l,u),{originalMessage:A,shortMessage:D,message:$}=sW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=S9(t,$,x);return Object.assign(re,jwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},jwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>cW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:$R(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),cW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Mwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:gb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Fwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(lW(t*1e3)%1e3),nanoseconds:Math.trunc(lW(t*1e6)%1e3)}}function Lwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function cI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Fwe(t);break}case"bigint":return Lwe(t)}throw new TypeError("Expected a finite number or bigint")}var lW,uW=y(()=>{lW=t=>Number.isFinite(t)?t:0});function lI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+qwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&zwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Uwe(d,u):f;i.push(p)}},a=cI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Bwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var zwe,Uwe,qwe,Bwe,dW=y(()=>{uW();zwe=t=>t===0||t===0n,Uwe=(t,e)=>e===1||e===1n?t:`${t}s`,qwe=1e-7,Bwe=24n*60n*60n*1000n});var fW,pW=y(()=>{Tl();fW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var mW,Hwe,hW=y(()=>{dW();ds();Tl();pW();mW=(t,e)=>{El(e)&&(fW(t,e),Hwe(t,e))},Hwe=(t,e)=>{let r=`(done in ${lI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ll,Jb=y(()=>{hW();Ll=(t,e,{reject:r})=>{if(mW(t,e),t.failed&&r)throw t;return t}});var _W,Gwe,Zwe,bW,vW,gW,Vwe,uI,yW,ja,SW,Wwe,Yb,wW,Kwe,Jwe,dI,xW,Ywe,$W,Xb,Xwe,fI,Qwe,exe,kW,In,Qb,pI,EW,AW,hs,wr=y(()=>{Da();yo();on();_W=(t,e)=>ja(t)?"asyncGenerator":SW(t)?"generator":Yb(t)?"fileUrl":Kwe(t)?"filePath":Xwe(t)?"webStream":ni(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Qwe(t)?"asyncIterable":exe(t)?"iterable":fI(t)?bW({transform:t},e):Wwe(t)?Gwe(t,e):"native",Gwe=(t,e)=>nI(t.transform,{checkOpen:!1})?Zwe(t,e):fI(t.transform)?bW(t,e):Vwe(t,e),Zwe=(t,e)=>(vW(t,e,"Duplex stream"),"duplex"),bW=(t,e)=>(vW(t,e,"web TransformStream"),"webTransform"),vW=({final:t,binary:e,objectMode:r},n,i)=>{gW(t,`${n}.final`,i),gW(e,`${n}.binary`,i),uI(r,`${n}.objectMode`)},gW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Vwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!yW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(nI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(fI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!yW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return uI(r,`${i}.binary`),uI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},uI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},yW=t=>ja(t)||SW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",SW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Wwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Yb=t=>Object.prototype.toString.call(t)==="[object URL]",wW=t=>Yb(t)&&t.protocol!=="file:",Kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Jwe.has(e))&&dI(t.file),Jwe=new Set(["file","append"]),dI=t=>typeof t=="string",xW=(t,e)=>t==="native"&&typeof e=="string"&&!Ywe.has(e),Ywe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),$W=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Xb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Xwe=t=>$W(t)||Xb(t),fI=t=>$W(t?.readable)&&Xb(t?.writable),Qwe=t=>kW(t)&&typeof t[Symbol.asyncIterator]=="function",exe=t=>kW(t)&&typeof t[Symbol.iterator]=="function",kW=t=>typeof t=="object"&&t!==null,In=new Set(["generator","asyncGenerator","duplex","webTransform"]),Qb=new Set(["fileUrl","filePath","fileNumber"]),pI=new Set(["fileUrl","filePath"]),EW=new Set([...pI,"webStream","nodeStream"]),AW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var mI,txe,rxe,TW,hI=y(()=>{wr();mI=(t,e,r,n)=>n==="output"?txe(t,e,r):rxe(t,e,r),txe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},rxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},TW=(t,e)=>{let r=t.findLast(({type:n})=>In.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var OW,nxe,ixe,oxe,sxe,axe,cxe,RW=y(()=>{yo();Pa();wr();hI();OW=(t,e,r,n)=>[...t.filter(({type:i})=>!In.has(i)),...nxe(t,e,r,n)],nxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>In.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=ixe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return cxe(o,r)},ixe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?oxe({stdioItem:t,optionName:i}):e==="webTransform"?sxe({stdioItem:t,index:r,newTransforms:n,direction:o}):axe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),oxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},sxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=mI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},axe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||sn.has(o),{writableObjectMode:f,readableObjectMode:p}=mI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},cxe=(t,e)=>e==="input"?t.reverse():t});import gI from"node:process";var IW,lxe,uxe,zl,yI,PW,dxe,fxe,CW=y(()=>{Da();wr();IW=(t,e,r)=>{let n=t.map(i=>lxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??fxe},lxe=({type:t,value:e},r)=>uxe[r]??PW[t](e),uxe=["input","output","output"],zl=()=>{},yI=()=>"input",PW={generator:zl,asyncGenerator:zl,fileUrl:zl,filePath:zl,iterable:yI,asyncIterable:yI,uint8Array:yI,webStream:t=>Xb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?rI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:zl,duplex:zl,native(t){let e=dxe(t);if(e!==void 0)return e;if(ni(t,{checkOpen:!1}))return PW.nodeStream(t)}},dxe=t=>{if([0,gI.stdin].includes(t))return"input";if([1,2,gI.stdout,gI.stderr].includes(t))return"output"},fxe="output"});var DW,NW=y(()=>{DW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var jW,pxe,mxe,MW,hxe,gxe,FW=y(()=>{bo();NW();ds();jW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=pxe(t,n).map((a,c)=>MW(a,c));return o?hxe(s,r,i):DW(s,e)},pxe=(t,e)=>{if(t===void 0)return Rn.map(n=>e[n]);if(mxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Rn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Rn.length);return Array.from({length:r},(n,i)=>t[i])},mxe=t=>Rn.some(e=>t[e]!==void 0),MW=(t,e)=>Array.isArray(t)?t.map(r=>MW(r,e)):t??(e>=Rn.length?"ignore":"pipe"),hxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Al(r,i)&&gxe(n)?"ignore":n),gxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as yxe}from"node:fs";import _xe from"node:tty";var zW,bxe,vxe,Sxe,wxe,LW,UW=y(()=>{Da();bo();on();ps();zW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?bxe({stdioItem:t,fdNumber:n,direction:i}):wxe({stdioItem:t,fdNumber:n}),bxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=vxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ni(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},vxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Sxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(_xe.isatty(i))throw new TypeError(`The \`${e}: ${vb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:_o(yxe(i)),optionName:e}}},Sxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=Q_.indexOf(t);if(r!==-1)return r},wxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:LW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:LW(e,e,r),optionName:r}:ni(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,LW=(t,e,r)=>{let n=Q_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var qW,xxe,$xe,kxe,Exe,BW=y(()=>{Da();on();wr();qW=({input:t,inputFile:e},r)=>r===0?[...xxe(t),...kxe(e)]:[],xxe=t=>t===void 0?[]:[{type:$xe(t),value:t,optionName:"input"}],$xe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},kxe=t=>t===void 0?[]:[{...Exe(t),optionName:"inputFile"}],Exe=t=>{if(Yb(t))return{type:"fileUrl",value:t};if(dI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var HW,GW,Axe,Txe,ZW,Oxe,Rxe,VW,WW=y(()=>{wr();HW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),GW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Axe(i,t);if(s.length!==0){if(o){Txe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(EW.has(t))return ZW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});AW.has(t)&&Rxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Axe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Txe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{pI.has(e)&&ZW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},ZW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return VW(s,n,e),i==="output"?o[0].stream:void 0},Oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Rxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);VW(i,n,e)},VW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var ev,Ixe,Pxe,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,_I,qxe,tv=y(()=>{bo();RW();hI();wr();CW();FW();UW();BW();WW();ev=(t,e,r,n)=>{let o=jW(e,r,n).map((a,c)=>Ixe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Lxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>qxe(a)),s},Ixe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=eb(e),{stdioItems:o,isStdioArray:s}=Pxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=IW(o,e,i),c=o.map(d=>zW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=OW(c,i,a,r),u=TW(l,a);return Fxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Pxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Cxe(c,n)),...qW(r,e)],s=HW(o),a=s.length>1;return Dxe(s,a,n),jxe(s),{stdioItems:s,isStdioArray:a}},Cxe=(t,e)=>({type:_W(t,e),value:t,optionName:e}),Dxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Nxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Nxe=new Set(["ignore","ipc"]),jxe=t=>{for(let e of t)Mxe(e)},Mxe=({type:t,value:e,optionName:r})=>{if(wW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(xW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Fxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Qb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Lxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(zxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw _I(i),o}},zxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Uxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Uxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=GW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},_I=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ei(r)&&r.destroy()},qxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as KW}from"node:fs";var YW,ji,Bxe,XW,JW,Hxe,QW=y(()=>{on();tv();wr();YW=(t,e)=>ev(Hxe,t,e,!0),ji=({type:t,optionName:e})=>{XW(e,hs[t])},Bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&XW(t,`"${e}"`),{}),XW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},JW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Bxe},Hxe={input:{...JW,fileUrl:({value:t})=>({contents:[_o(KW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(KW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...JW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:ji,string:ji,uint8Array:ji}}});var xo,bI,lp=y(()=>{tI();xo=(t,{stripFinalNewline:e},r)=>bI(e,r)&&t!==void 0&&!Array.isArray(t)?jl(t):t,bI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var rv,SI,eK,tK,Gxe,Zxe,Vxe,rK,Wxe,vI,Kxe,Jxe,Yxe,nv=y(()=>{rv=(t,e,r,n)=>t||r?void 0:tK(e,n),SI=(t,e,r)=>r?t.flatMap(n=>eK(n,e)):eK(t,e),eK=(t,e)=>{let{transform:r,final:n}=tK(e,{});return[...r(t),...n()]},tK=(t,e)=>(e.previousChunks="",{transform:Gxe.bind(void 0,e,t),final:Vxe.bind(void 0,e)}),Gxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=vI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=vI(n,r.slice(i+1))),t.previousChunks=n},Zxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Vxe=function*({previousChunks:t}){t.length>0&&(yield t)},rK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Wxe.bind(void 0,n)},Wxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Kxe:Yxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},vI=(t,e)=>`${t}${e}`,Kxe={windowsNewline:`\r `,unixNewline:` `,LF:` `,concatBytes:vI},Jxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Yxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Jxe}});import{Buffer as Xxe}from"node:buffer";var nK,Qxe,iK,e0e,t0e,oK,sK=y(()=>{on();nK=(t,e)=>t?void 0:Qxe.bind(void 0,e),Qxe=function*(t,e){if(typeof e!="string"&&!qt(e)&&!Xxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},iK=(t,e)=>t?e0e.bind(void 0,e):t0e.bind(void 0,e),e0e=function*(t,e){oK(t,e),yield e},t0e=function*(t,e){if(oK(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},oK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as r0e}from"node:buffer";import{StringDecoder as n0e}from"node:string_decoder";var iv,i0e,o0e,s0e,wI=y(()=>{on();iv=(t,e,r)=>{if(r)return;if(t)return{transform:i0e.bind(void 0,new TextEncoder)};let n=new n0e(e);return{transform:o0e.bind(void 0,n),final:s0e.bind(void 0,n)}},i0e=function*(t,e){r0e.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},o0e=function*(t,e){yield qt(e)?t.write(e):e},s0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as aK}from"node:util";var xI,ov,cK,a0e,lK,c0e,uK=y(()=>{xI=aK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),ov=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=c0e}=e[r];for await(let i of n(t))yield*ov(i,e,r+1)},cK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*a0e(r,Number(e),t)},a0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*ov(n,r,e+1)},lK=aK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),c0e=function*(t){yield t}});var $I,dK,Ma,lp,l0e,u0e,kI=y(()=>{$I=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dK=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...lp(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},lp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},u0e=function*(t){yield t}});import{Transform as d0e,getDefaultHighWaterMark as fK}from"node:stream";var EI,sv,pK,av=y(()=>{wr();nv();sK();wI();uK();kI();EI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=pK(t,s,o),l=ja(e),u=ja(r),d=l?xI.bind(void 0,ov,a):$I.bind(void 0,Ma),f=l||u?xI.bind(void 0,cK,a):$I.bind(void 0,lp),p=l||u?lK.bind(void 0,a):void 0;return{stream:new d0e({writableObjectMode:n,writableHighWaterMark:fK(n),readableObjectMode:i,readableHighWaterMark:fK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},sv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=pK(s,r,a);t=dK(c,t)}return t},pK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:nK(n,a)},iv(r,s,n),rv(r,o,n,c),{transform:t,final:e},{transform:iK(i,a)},rK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var mK,f0e,p0e,m0e,h0e,hK=y(()=>{av();on();wr();mK=(t,e)=>{for(let r of f0e(t))p0e(t,r,e)},f0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),p0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ms[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>m0e(a,n));r.input=Vf(s)},m0e=(t,e)=>{let r=sv(t,e,"utf8",!0);return h0e(r),Vf(r)},h0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var cv,g0e,y0e,gK,yK,_0e,_K,AI=y(()=>{Pa();wr();Tl();us();cv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Al(r,n)&&!sn.has(e)&&g0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&y0e.has(o))||t.every(({type:i})=>In.has(i))),g0e=t=>t===1||t===2,y0e=new Set(["pipe","overlapped"]),gK=async(t,e,r,n)=>{for await(let i of t)_0e(e)||_K(i,r,n)},yK=(t,e,r)=>{for(let n of t)_K(n,e,r)},_0e=t=>t._readableState.pipes.length>0,_K=(t,e,r)=>{let n=ab(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as b0e,appendFileSync as v0e}from"node:fs";var bK,S0e,w0e,x0e,$0e,k0e,vK=y(()=>{AI();av();nv();on();wr();Na();bK=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>S0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},S0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=iW(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=w0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=x0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});$0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&k0e(b,m,i),S}catch(x){return n.error=x,S}},w0e=(t,e,r,n)=>{try{return sv(t,e,r,!1)}catch(i){return n.error=i,t}},x0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Vf(t)};let s=WG(t,r);return n[o]?{serializedResult:s,finalResult:SI(s,!i[o],e)}:{serializedResult:s}},$0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!cv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=SI(t,!1,s);try{yK(a,e,n)}catch(c){r.error??=c}},k0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Qb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?v0e(n,t):(r.add(o),b0e(n,t))}}});var SK,wK=y(()=>{on();cp();SK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xo(e,r,"all")]:Array.isArray(e)?[xo(t,r,"all"),...e]:qt(t)&&qt(e)?gR([t,e]):`${t}${e}`}});import{once as TI}from"node:events";var xK,E0e,$K,kK,A0e,OI,RI=y(()=>{Ra();xK=async(t,e)=>{let[r,n]=await E0e(t);return e.isForcefullyTerminated??=!1,[r,n]},E0e=async t=>{let[e,r]=await Promise.allSettled([TI(t,"spawn"),TI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?$K(t):r.value},$K=async t=>{try{return await TI(t,"exit")}catch{return $K(t)}},kK=async t=>{let[e,r]=await t;if(!A0e(e,r)&&OI(e,r))throw new ti;return[e,r]},A0e=(t,e)=>t===void 0&&e===void 0,OI=(t,e)=>t!==0||e!==null});var EK,T0e,AK=y(()=>{Ra();Na();RI();EK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=T0e(t,e,r),s=o?.code==="ETIMEDOUT",a=nW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},T0e=(t,e,r)=>t!==void 0?t:OI(e,r)?new ti:void 0});import{spawnSync as O0e}from"node:child_process";var TK,R0e,I0e,P0e,lv,C0e,D0e,N0e,j0e,OK=y(()=>{kR();QR();eI();ap();Jb();QW();cp();hK();vK();Na();wK();AK();TK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=R0e(t,e,r),d=C0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ll(d,c,l)},R0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),a=I0e(r),{file:c,commandArguments:l,options:u}=Mb(t,e,a);P0e(u);let d=YW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},I0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,P0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&lv("ipcInput"),t&&lv("ipc: true"),r&&lv("detached: true"),n&&lv("cancelSignal")},lv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},C0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=D0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=EK(c,r),{output:m,error:h=l}=bK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(SK(m,r),r,"all");return j0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},D0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{mK(o,r);let a=N0e(r);return O0e(...Fb(t,e,a))}catch(a){return Fl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},N0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Wb(e)}),j0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Kb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):sp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as II,on as M0e}from"node:events";var RK,F0e,L0e,z0e,U0e,IK=y(()=>{Cl();tp();ep();RK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Il({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),F0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),F0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{xb(e,i);let o=ps(t,e,r),s=new AbortController;try{return await Promise.race([L0e(o,n,s),z0e(o,r,s),U0e(o,r,s)])}catch(a){throw Pl(t),a}finally{s.abort(),$b(e,i)}},L0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await II(t,"message",{signal:r});return n}for await(let[n]of M0e(t,"message",{signal:r}))if(e(n))return n},z0e=async(t,e,{signal:r})=>{await II(t,"disconnect",{signal:r}),q9(e)},U0e=async(t,e,{signal:r})=>{let[n]=await II(t,"strict:error",{signal:r});throw bb(n,e)}});import{once as CK,on as q0e}from"node:events";var DK,PI,B0e,H0e,G0e,PK,CI=y(()=>{Cl();tp();ep();DK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>PI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),PI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Il({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),xb(e,o);let s=ps(t,e,r),a=new AbortController,c={};return B0e(t,s,a),H0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),G0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},B0e=async(t,e,r)=>{try{await CK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},H0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await CK(t,"strict:error",{signal:r.signal});n.error=bb(i,e),r.abort()}catch{}},G0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of q0e(r,"message",{signal:o.signal}))PK(s),yield c}catch{PK(s)}finally{o.abort(),$b(e,a),n||Pl(t),i&&await t}},PK=({error:t})=>{if(t)throw t}});import NK from"node:process";var jK,MK,FK,DI=y(()=>{Nb();IK();CI();Tb();jK=(t,{ipc:e})=>{Object.assign(t,FK(t,!1,e))},MK=()=>{let t=NK,e=!0,r=NK.channel!==void 0;return{...FK(t,e,r),getCancelSignal:gV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},FK=(t,e,r)=>({sendMessage:Db.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:RK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:DK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Z0e}from"node:child_process";import{PassThrough as V0e,Readable as W0e,Writable as K0e,Duplex as J0e}from"node:stream";var LK,Y0e,up,X0e,Q0e,e$e,t$e,zK=y(()=>{tv();ap();Jb();LK=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{_I(n);let a=new Z0e;Y0e(a,n),Object.assign(a,{readable:X0e,writable:Q0e,duplex:e$e});let c=Fl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=t$e(c,s,i);return{subprocess:a,promise:l}},Y0e=(t,e)=>{let r=up(),n=up(),i=up(),o=Array.from({length:e.length-3},up),s=up(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},up=()=>{let t=new V0e;return t.end(),t},X0e=()=>new W0e({read(){}}),Q0e=()=>new K0e({write(){}}),e$e=()=>new J0e({read(){},write(){}}),t$e=async(t,e,r)=>Ll(t,e,r)});import{createReadStream as UK,createWriteStream as qK}from"node:fs";import{Buffer as r$e}from"node:buffer";import{Readable as dp,Writable as n$e,Duplex as i$e}from"node:stream";var HK,fp,BK,o$e,GK=y(()=>{av();tv();wr();HK=(t,e)=>ev(o$e,t,e,!1),fp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ms[t]}.`)},BK={fileNumber:fp,generator:EI,asyncGenerator:EI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:i$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},o$e={input:{...BK,fileUrl:({value:t})=>({stream:UK(t)}),filePath:({value:{file:t}})=>({stream:UK(t)}),webStream:({value:t})=>({stream:dp.fromWeb(t)}),iterable:({value:t})=>({stream:dp.from(t)}),asyncIterable:({value:t})=>({stream:dp.from(t)}),string:({value:t})=>({stream:dp.from(t)}),uint8Array:({value:t})=>({stream:dp.from(r$e.from(t))})},output:{...BK,fileUrl:({value:t})=>({stream:qK(t)}),filePath:({value:{file:t,append:e}})=>({stream:qK(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:n$e.fromWeb(t)}),iterable:fp,asyncIterable:fp,string:fp,uint8Array:fp}}});import{on as s$e,once as ZK}from"node:events";import{PassThrough as a$e,getDefaultHighWaterMark as c$e}from"node:stream";import{finished as KK}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)jI(i);let e=t.some(({readableObjectMode:i})=>i),r=l$e(t,e),n=new NI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var l$e,NI,u$e,d$e,f$e,jI,p$e,m$e,h$e,g$e,y$e,JK,YK,MI,XK,_$e,uv,VK,WK,dv=y(()=>{l$e=(t,e)=>{if(t.length===0)return c$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},NI=class extends a$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(jI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=u$e(this,this.#t,this.#o);let r=p$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(jI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},u$e=async(t,e,r)=>{uv(t,VK);let n=new AbortController;try{await Promise.race([d$e(t,n),f$e(t,e,r,n)])}finally{n.abort(),uv(t,-VK)}},d$e=async(t,{signal:e})=>{try{await KK(t,{signal:e,cleanup:!0})}catch(r){throw JK(t,r),r}},f$e=async(t,e,r,{signal:n})=>{for await(let[i]of s$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},jI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},p$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{uv(t,WK);let a=new AbortController;try{await Promise.race([m$e(o,e,a),h$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),g$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),uv(t,-WK)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?MI(t):y$e(t))},m$e=async(t,e,{signal:r})=>{try{await t,r.aborted||MI(e)}catch(n){r.aborted||JK(e,n)}},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await KK(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;YK(s)?i.add(e):XK(t,s)}},g$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await ZK(t,i,{signal:o}),!t.readable)return ZK(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},y$e=t=>{t.writable&&t.end()},JK=(t,e)=>{YK(e)?MI(t):XK(t,e)},YK=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",MI=t=>{(t.readable||t.writable)&&t.destroy()},XK=(t,e)=>{t.destroyed||(t.once("error",_$e),t.destroy(e))},_$e=()=>{},uv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},VK=2,WK=1});import{finished as QK}from"node:stream/promises";var Ul,b$e,FI,v$e,LI,fv=y(()=>{bo();Ul=(t,e)=>{t.pipe(e),b$e(t,e),v$e(t,e)},b$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}FI(e)}},FI=t=>{t.writable&&t.end()},v$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}LI(t)}},LI=t=>{t.readable&&t.destroy()}});var e3,S$e,w$e,x$e,$$e,k$e,t3=y(()=>{dv();bo();wb();wr();fv();e3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>In.has(c)))S$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!In.has(c)))x$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fa(o);Ul(s,i)}},S$e=(t,e,r,n)=>{r==="output"?Ul(t.stdio[n],e):Ul(e,t.stdio[n]);let i=w$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},w$e=["stdin","stdout","stderr"],x$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;$$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},$$e=(t,{signal:e})=>{ei(t)&&Ia(t,k$e,e)},k$e=2});var La,r3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var pv,zI,UI,E$e,qI,mv,A$e,BI,HI,GI,n3,vat,Sat,i3=y(()=>{r3();pv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",zI=Symbol.for("signal-exit emitter"),UI=globalThis,E$e=Object.defineProperty.bind(Object),qI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(UI[zI])return UI[zI];E$e(UI,zI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},mv=class{},A$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),BI=class extends mv{onExit(){return()=>{}}load(){}unload(){}},HI=class extends mv{#t=GI.platform==="win32"?"SIGINT":"SIGHUP";#r=new qI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!pv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of La)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,La.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return pv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&pv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},GI=globalThis.process,{onExit:n3,load:vat,unload:Sat}=A$e(pv(GI)?new HI(GI):new BI)});import{addAbortListener as T$e}from"node:events";var o3,s3=y(()=>{i3();o3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=n3(()=>{t.kill()});T$e(n,()=>{i()})}});var c3,O$e,R$e,a3,I$e,l3=y(()=>{hR();lb();fs();kl();c3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=cb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=O$e(r,n,i),{sourceStream:d,sourceError:f}=I$e(t,l),{options:p,fileDescriptors:m}=Di.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},O$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=R$e(t,e,...r),a=Sb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},R$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(a3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||pR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=Y_(r,...n);return{destination:e(a3)(i,o,s),pipeOptions:s}}if(Di.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},a3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),I$e=(t,e)=>{try{return{sourceStream:Nl(t,e)}}catch(r){return{sourceError:r}}}});var d3,P$e,ZI,u3,VI=y(()=>{ap();fv();d3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=P$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw ZI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},P$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return LI(t),n;if(e!==void 0)return FI(r),e},ZI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Fl({error:t,command:u3,escapedCommand:u3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),u3="source.pipe(destination)"});var f3,p3=y(()=>{f3=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as C$e}from"node:stream/promises";var m3,D$e,N$e,j$e,hv,M$e,F$e,h3=y(()=>{dv();wb();fv();m3=(t,e,r)=>{let n=hv.has(e)?N$e(t,e):D$e(t,e);return Ia(t,M$e,r.signal),Ia(e,F$e,r.signal),j$e(e),n},D$e=(t,e)=>{let r=Fa([t]);return Ul(r,e),hv.set(e,r),r},N$e=(t,e)=>{let r=hv.get(e);return r.add(t),r},j$e=async t=>{try{await C$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}hv.delete(t)},hv=new WeakMap,M$e=2,F$e=1});import{aborted as L$e}from"node:util";var g3,z$e,y3=y(()=>{VI();g3=(t,e)=>t===void 0?[]:[z$e(t,e)],z$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await L$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw ZI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var gv,U$e,q$e,_3=y(()=>{yo();l3();VI();p3();h3();y3();gv=(t,...e)=>{if(Ot(e[0]))return gv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=c3(t,...e),i=U$e({...n,destination:r});return i.pipe=gv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},U$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=q$e(t,i);d3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=m3(e,o,d);return await Promise.race([f3(u),...g3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},q$e=(t,e)=>Promise.allSettled([t,e])});import{on as B$e}from"node:events";import{getDefaultHighWaterMark as H$e}from"node:stream";var yv,G$e,WI,Z$e,v3,KI,b3,V$e,W$e,_v=y(()=>{wI();nv();kI();yv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return G$e(e,s),v3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},G$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},WI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Z$e(e,s,t);let a=t.readableObjectMode&&!o;return v3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Z$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},v3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=B$e(t,"data",{signal:e.signal,highWaterMark:b3,highWatermark:b3});return V$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},KI=H$e(!0),b3=KI,V$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=W$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*lp(a)}},W$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[iv(t,r,!e),rv(t,i,!n,{})].filter(Boolean)});import{setImmediate as K$e}from"node:timers/promises";var S3,J$e,Y$e,X$e,JI,w3,YI=y(()=>{Vb();on();AI();_v();Na();cp();S3=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=J$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Y$e(t),d]);return}let f=bI(c,r),p=WI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([X$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},J$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!cv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=WI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await gK(a,t,r,o)},Y$e=async t=>{await K$e(),t.readableFlowing===null&&t.resume()},X$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Bb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Hb(r,{maxBuffer:o})):await Zb(r,{maxBuffer:o})}catch(a){return w3(eW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},JI=async t=>{try{return await t}catch(e){return w3(e)}},w3=({bufferedData:t})=>ZG(t)?new Uint8Array(t):t});import{finished as Q$e}from"node:stream/promises";var pp,eke,tke,rke,nke,ike,XI,bv,x3,vv=y(()=>{pp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=eke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Q$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||nke(a,e,r,n)}finally{s.abort()}},eke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&tke(t,r,n),n},tke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{rke(e,r),n.call(t,...i)}},rke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},nke=(t,e,r,n)=>{if(!ike(t,e,r,n))throw t},ike=(t,e,r,n=!0)=>r.propagating?x3(t)||bv(t):(r.propagating=!0,XI(r,e)===n?x3(t):bv(t)),XI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",bv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",x3=t=>t?.code==="EPIPE"});var $3,QI,eP=y(()=>{YI();vv();$3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>QI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),QI=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=pp(t,e,l);if(XI(l,e)){await u;return}let[d]=await Promise.all([S3({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var k3,E3,oke,ske,tP=y(()=>{dv();eP();k3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,E3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>QI({...oke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:ske(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),oke=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},ske=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var A3,T3,O3=y(()=>{Tl();us();A3=t=>Al(t,"ipc"),T3=(t,e)=>{let r=ab(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var R3,I3,P3=y(()=>{Na();O3();So();CI();R3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=A3(o),a=vo(e,"ipc"),c=vo(r,"ipc");for await(let l of PI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(tW(t,i,c),i.push(l)),s&&T3(l,o);return i},I3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as ake}from"node:events";var C3,cke,lke,uke,D3=y(()=>{Da();WR();LR();VR();bo();wr();YI();P3();JR();tP();eP();RI();vv();C3=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=xK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=$3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=E3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=R3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=cke(h,t,S),D=lke(m,S);try{return await Promise.race([Promise.all([{},kK(_),Promise.all(x),w,T,EV(t,d),...A,...D]),g,uke(t,b),...SV(t,o,f,b),...U9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...bV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>JI(re))),JI(w),I3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},cke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:pp(n,i,r)),lke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ni(o,{checkOpen:!1})&&!ei(o)).map(({type:i,value:o,stream:s=o})=>pp(s,n,e,{isSameDirection:In.has(i),stopOnExit:i==="native"}))),uke=async(t,{signal:e})=>{let[r]=await ake(t,"error",{signal:e});throw r}});var N3,mp,ql,Sv=y(()=>{Dl();N3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),mp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},ql=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as j3}from"node:stream/promises";var rP,M3,nP,iP,wv,xv,oP=y(()=>{vv();rP=async t=>{if(t!==void 0)try{await nP(t)}catch{}},M3=async t=>{if(t!==void 0)try{await iP(t)}catch{}},nP=async t=>{await j3(t,{cleanup:!0,readable:!1,writable:!0})},iP=async t=>{await j3(t,{cleanup:!0,readable:!0,writable:!1})},wv=async(t,e)=>{if(await t,e)throw e},xv=(t,e,r)=>{r&&!bv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as dke}from"node:stream";import{callbackify as fke}from"node:util";var F3,sP,aP,cP,pke,lP,uP,L3,dP=y(()=>{Pa();fs();_v();Dl();Sv();oP();F3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||sn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=aP(a,s),{read:f,onStdoutDataDone:p}=cP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new dke({read:f,destroy:fke(uP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return lP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},sP=(t,e,r)=>{let n=Nl(t,e),i=mp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},aP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:KI},cP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ci(),s=yv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){pke(this,s,o)},onStdoutDataDone:o}},pke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},lP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await iP(t),await n,await rP(i),await e,r.readable&&r.push(null)}catch(o){await rP(i),L3(r,o)}},uP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await ql(r,e)&&(L3(t,n),await wv(e,n))},L3=(t,e)=>{xv(t,t.readable,e)}});import{Writable as mke}from"node:stream";import{callbackify as z3}from"node:util";var U3,fP,pP,hke,gke,mP,hP,q3,gP=y(()=>{fs();Sv();oP();U3=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=fP(t,r,e),s=new mke({...pP(n,t,i),destroy:z3(hP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return mP(n,s),s},fP=(t,e,r)=>{let n=Sb(t,e),i=mp(r,n,"writableFinal"),o=mp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},pP=(t,e,r)=>({write:hke.bind(void 0,t),final:z3(gke.bind(void 0,t,e,r))}),hke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},gke=async(t,e,r)=>{await ql(r,e)&&(t.writable&&t.end(),await e)},mP=async(t,e,r)=>{try{await nP(t),e.writable&&e.end()}catch(n){await M3(r),q3(e,n)}},hP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await ql(r,e),await ql(n,e)&&(q3(t,i),await wv(e,i))},q3=(t,e)=>{xv(t,t.writable,e)}});import{Duplex as yke}from"node:stream";import{callbackify as _ke}from"node:util";var B3,bke,H3=y(()=>{Pa();dP();gP();B3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||sn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=fP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=aP(c,a),{read:g,onStdoutDataDone:b}=cP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new yke({read:g,...pP(u,t,d),destroy:_ke(bke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return lP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),mP(u,_,c),_},bke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([uP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),hP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var yP,vke,G3=y(()=>{Pa();fs();_v();yP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||sn.has(e),s=Nl(t,r),a=yv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return vke(a,s,t)},vke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var Z3,V3=y(()=>{Sv();dP();gP();H3();G3();Z3=(t,{encoding:e})=>{let r=N3();t.readable=F3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=U3.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=B3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=yP.bind(void 0,t,e),t[Symbol.asyncIterator]=yP.bind(void 0,t,e,{})}});var W3,Ske,wke,K3=y(()=>{W3=(t,e)=>{for(let[r,n]of wke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Ske=(async()=>{})().constructor.prototype,wke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Ske,t)])});import{setMaxListeners as xke}from"node:events";import{spawn as $ke}from"node:child_process";var J3,kke,Eke,Ake,Tke,Oke,Y3=y(()=>{Vb();kR();QR();fs();eI();DI();ap();Jb();zK();GK();cp();t3();yb();s3();_3();tP();D3();V3();Dl();K3();J3=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=kke(t,e,r),{subprocess:f,promise:p}=Ake({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=gv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),W3(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},kke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),{file:a,commandArguments:c,options:l}=Mb(t,e,r),u=Eke(l),d=HK(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Eke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Ake=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=$ke(...Fb(t,e,r))}catch(m){return LK({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;xke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];e3(c,a,l),o3(c,r,l);let d={},f=Ci();c.kill=L9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=k3(c,r),Z3(c,r),jK(c,r);let p=Tke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Tke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await C3({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>xo(x,e,w)),_=xo(h,e,"all"),S=Oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ll(S,n,e)},Oke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?sp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ni,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Kb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var $v,Rke,Ike,X3=y(()=>{yo();So();$v=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Rke(n,t[n],i)]));return{...t,...r}},Rke=(t,e,r)=>Ike.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Ike=new Set(["env",...vR])});var hs,Pke,Cke,Q3=y(()=>{yo();hR();eZ();OK();Y3();X3();hs=(t,e,r,n)=>{let i=(s,a,c)=>hs(s,a,r,c),o=(...s)=>Pke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Pke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,$v(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Cke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?TK(a,c,l):J3(a,c,l,i)},Cke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=XG(e)?QG(e,r):[e,...r],[s,a,c]=Y_(...o),l=$v($v(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var eJ,tJ,rJ,Dke,Nke,nJ=y(()=>{eJ=({file:t,commandArguments:e})=>rJ(t,e),tJ=({file:t,commandArguments:e})=>({...rJ(t,e),isSync:!0}),rJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Dke(t);return{file:r,commandArguments:n}},Dke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Nke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Nke=/ +/g});var iJ,oJ,jke,sJ,Mke,aJ,cJ=y(()=>{iJ=(t,e,r)=>{t.sync=e(jke,r),t.s=t.sync},oJ=({options:t})=>sJ(t),jke=({options:t})=>({...sJ(t),isSync:!0}),sJ=t=>({options:{...Mke(t),...t}}),Mke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},aJ={preferLocal:!0}});var uut,We,dut,fut,put,mut,hut,gut,yut,_ut,Fr=y(()=>{Q3();nJ();KR();cJ();DI();uut=hs(()=>({})),We=hs(()=>({isSync:!0})),dut=hs(eJ),fut=hs(tJ),put=hs(xV),mut=hs(oJ,{},aJ,iJ),{sendMessage:hut,getOneMessage:gut,getEachMessage:yut,getCancelSignal:_ut}=MK()});import{existsSync as kv,statSync as Fke}from"node:fs";import{dirname as _P,extname as Lke,isAbsolute as lJ,join as bP,relative as vP,resolve as Ev,sep as zke}from"node:path";function Av(t){return t==="./gradlew"||t==="gradle"}function Uke(t){return(kv(bP(t,"build.gradle.kts"))||kv(bP(t,"build.gradle")))&&kv(bP(t,"gradle.properties"))}function qke(t,e){let n=vP(t,e).split(zke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function gs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Bke(t,e){let r=Ev(t,e),n=r;kv(r)?Fke(r).isFile()&&(n=_P(r)):Lke(r)!==""&&(n=_P(r));let i=vP(t,n);if(i.startsWith("..")||lJ(i))return null;let o=n;for(;;){if(Uke(o))return o;if(Ev(o)===Ev(t))return null;let s=_P(o);if(s===o)return null;let a=vP(t,s);if(a.startsWith("..")||lJ(a))return null;o=s}}function Tv(t,e){let r=Ev(t),n=new Map,i=[];for(let o of e){let s=Bke(r,o);if(!s){i.push(o);continue}let a=qke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Ov=y(()=>{"use strict"});import{existsSync as wP,readFileSync as Hke}from"node:fs";import{join as Bl}from"node:path";function Hl(t="."){let e=Bl(t,".cladding","config.yaml");if(!wP(e))return SP;try{let n=(0,uJ.parse)(Hke(e,"utf8"))?.gate;if(!n)return SP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Gke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return SP}}function dJ(t="."){let e=Hl(t).testReport,r=e?[e,...xP]:xP;return[...new Set(r.map(n=>Bl(t,n)))]}function fJ(t="."){let e=Hl(t).testReport;if(e){let r=Bl(t,e);return wP(r)?r:null}return xP.map(r=>Bl(t,r)).find(r=>wP(r))??null}function pJ(t,e){let r=[],n=!1;for(let i of t){let o=Zke.exec(i);if(o){n=!0;for(let s of e)r.push(gs(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var uJ,Gke,SP,xP,Zke,hp=y(()=>{"use strict";uJ=St(er(),1);Ov();Gke=["type","lint","test","coverage"],SP={scope:"feature"},xP=["test-report.junit.xml",Bl("coverage","junit.xml"),Bl(".cladding","test-report.junit.xml")];Zke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as kP,readFileSync as mJ,readdirSync as Vke,statSync as Wke}from"node:fs";import{join as Rv}from"node:path";function TP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Rv(t,e);if(kP(r))try{if(hJ.test(mJ(r,"utf8")))return!0}catch{}}return!1}function gJ(t){try{return kP(t)&&hJ.test(mJ(t,"utf8"))}catch{return!1}}function yJ(t,e=0){if(e>4||!kP(t))return!1;let r;try{r=Vke(t)}catch{return!1}for(let n of r){let i=Rv(t,n),o=!1;try{o=Wke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(yJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&gJ(i))return!0}return!1}function Yke(t){if(TP(t))return!0;for(let e of Kke)if(gJ(Rv(t,e)))return!0;for(let e of Jke)if(yJ(Rv(t,e)))return!0;return!1}function _J(t="."){let e=Hl(t).coverage;return e||(Yke(t)?"kover":"jacoco")}function bJ(t="."){return EP[_J(t)]}function vJ(t="."){return $P[_J(t)]}var EP,$P,AP,hJ,Kke,Jke,Iv=y(()=>{"use strict";hp();EP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},$P={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},AP=[$P.kover,$P.jacoco],hJ=/kover/i;Kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Jke=["buildSrc","build-logic"]});import{existsSync as yp,readFileSync as wJ,readdirSync as xJ}from"node:fs";import{join as ys}from"node:path";function RP(t){return yp(ys(t,"gradlew"))?"./gradlew":"gradle"}function Xke(t){let e=RP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[bJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Qke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(wJ(ys(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function tEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function iEe(t,e){for(let r of e)if(yp(ys(t,r)))return r}function oEe(t,e){try{return xJ(t).find(n=>n.endsWith(e))}catch{return}}function cEe(t){try{return JSON.parse(wJ(ys(t,"package.json"),"utf8"))}catch{return{}}}function gp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function SJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function lEe(t,e,r){if(gp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of sEe)if(n.configs.some(i=>yp(ys(t,i))))return n.gate;if(aEe.some(n=>yp(ys(t,n)))||r.eslintConfig!==void 0)return e}function dEe(t,e){return uEe.some(r=>yp(ys(t,r)))?!0:e.jest!==void 0}function fEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function OP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function pEe(t,e){let r=cEe(t),n=e.lint?lEe(t,e.lint,r):void 0,i=n?{...e,lint:n}:OP(e,"lint"),o=gp(r,"test"),s=o?fEe(o):void 0;return o&&!s?(i=OP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...gp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&dEe(t,r)?{...i,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(s==="vitest"&&!gp(r,"coverage")&&!SJ(r,"@vitest/coverage-v8")&&!SJ(r,"@vitest/coverage-istanbul")?i=OP(i,"coverage"):s==="vitest"&&gp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of rEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=oEe(t,o):r=iEe(t,[o]),r)break;if(!r||e.requiresSource&&!tEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?pEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return nEe}var Mi,eEe,rEe,nEe,sEe,aEe,uEe,an=y(()=>{"use strict";Iv();Mi=["--offline","--no-install"];eEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);rEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Mi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Mi,"eslint","."]},test:{cmd:"npx",args:[...Mi,"vitest","run"]},coverage:{cmd:"npx",args:[...Mi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Mi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Mi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:Xke},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Qke}],nEe={language:"unknown",manifest:"",gates:{}};sEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Mi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Mi,"oxlint"]}}],aEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"];uEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as mEe,readFileSync as hEe}from"node:fs";import{join as gEe}from"node:path";function za(t){return t.code==="ENOENT"}function Pv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return $J.test(o)||$J.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} -${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Gl(t,e){let r=gEe(t,"package.json");if(!mEe(r))return!1;try{return!!JSON.parse(hEe(r,"utf8")).scripts?.[e]}catch{return!1}}var $J,Pn=y(()=>{"use strict";$J=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function yEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Cv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Cv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Pv(i,Cv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Cv,Ua,Dv=y(()=>{"use strict";Fr();an();Pn();Cv="ARCHITECTURE_VIOLATION";Ua={name:Cv,subprocess:!0,run:yEe}});function _Ee(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Pv(i,Nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Nv,qa,jv=y(()=>{"use strict";Fr();an();Pn();Nv="HARDCODED_SECRET";qa={name:Nv,subprocess:!0,run:_Ee}});import{existsSync as IP,readdirSync as kJ}from"node:fs";import{join as Mv}from"node:path";function vEe(t,e){let r=Mv(t,e.path);if(!IP(r))return!0;if(e.isDirectory)try{return kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function SEe(t){let{cwd:e="."}=t,r=[];for(let i of bEe)vEe(e,i)&&r.push({detector:_p,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Mv(e,"spec.yaml");if(IP(n)){let i=$Ee(n),o=i?null:wEe(e);if(i)r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:_p,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=xEe(e);s&&r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function wEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Mv(t,e);if(!IP(r))continue;let n;try{n=kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Oi(Mv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function xEe(t){try{return q(t),null}catch(e){return e.message}}function $Ee(t){let e;try{e=Oi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var _p,bEe,EJ,AJ=y(()=>{"use strict";Ue();U_();_p="ABSENCE_OF_GOVERNANCE",bEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];EJ={name:_p,run:SEe}});function Fv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function PP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Fv(r)==="while",o=EEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Fv(r)}'`}let n=kEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Fv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Fv(r)}'`:null}function AEe(t,e){let r=PP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function TJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...AEe(r,n));return e}var kEe,EEe,CP=y(()=>{"use strict";kEe={event:"when",state:"while",optional:"where",unwanted:"if"},EEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function TEe(t){let{cwd:e="."}=t;return ge(e,Lv,OEe)}function OEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Lv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of TJ(t.features))e.push({detector:Lv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Lv,OJ,RJ=y(()=>{"use strict";CP();wt();Lv="AC_DRIFT";OJ={name:Lv,run:TEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return PJ[n]??IJ}var REe,IEe,PEe,IJ,CEe,DEe,PJ,NEe,CJ,Ba=y(()=>{"use strict";an();REe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,IEe=/^[ \t]*import\s+([\w.]+)/gm,PEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,IJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:REe,importStyle:"relative"},CEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:IEe,importStyle:"dotted"},DEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:PEe,importStyle:"dotted"},PJ={typescript:IJ,kotlin:CEe,python:DEe},NEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],CJ=new Set([...Object.values(PJ).flatMap(t=>t?.extensions??[]),...NEe].map(t=>t.toLowerCase()))});import{existsSync as jEe,readFileSync as MEe,readdirSync as FEe,statSync as LEe}from"node:fs";import{join as NJ,relative as DJ}from"node:path";function zEe(t,e){if(!jEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=FEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=NJ(i,s),c;try{c=LEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function UEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function BEe(t){return qEe.test(t)}function HEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>zEe(NJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=MEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Ba();jJ="AI_HINTS_FORBIDDEN_PATTERN";qEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;MJ={name:jJ,run:HEe}});function GEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:LJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var LJ,zJ,UJ=y(()=>{"use strict";Ue();LJ="AC_DUPLICATE_WITHIN_FEATURE";zJ={name:LJ,run:GEe}});import{createRequire as ZEe}from"module";import{basename as VEe,dirname as NP,normalize as WEe,relative as KEe,resolve as JEe,sep as HJ}from"path";import*as YEe from"fs";function XEe(t){let e=WEe(t);return e.length>1&&e[e.length-1]===HJ&&(e=e.substring(0,e.length-1)),e}function GJ(t,e){return t.replace(QEe,e)}function tAe(t){return t==="/"||eAe.test(t)}function DP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=JEe(t)),(n||o)&&(t=XEe(t)),t===".")return"";let s=t[t.length-1]!==i;return GJ(s?t+i:t,i)}function ZJ(t,e){return e+t}function rAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:GJ(KEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function nAe(t){return t}function iAe(t,e,r){return e+t+r}function oAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?rAe(t,e):n?ZJ:nAe}function sAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function aAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function dAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?aAe(t):sAe(t):n&&n.length?lAe:cAe:uAe}function yAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?gAe:r&&r.length?n?fAe:pAe:n?mAe:hAe}function vAe(t){return t.group?bAe:_Ae}function xAe(t){return t.group?SAe:wAe}function EAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?kAe:$Ae}function VJ(t,e,r){if(r.options.useRealPaths)return AAe(e,r);let n=NP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=NP(n)}return r.symlinks.set(t,e),i>1}function AAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function zv(t,e,r,n){e(t&&!n?t:null,r)}function jAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?TAe:PAe:n?e?OAe:NAe:i?e?IAe:DAe:e?RAe:CAe}function LAe(t){return t?FAe:MAe}function BAe(t,e){return new Promise((r,n)=>{JJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function JJ(t,e,r){new KJ(t,e,r).start()}function HAe(t,e){return new KJ(t,e).start()}var qJ,QEe,eAe,cAe,lAe,uAe,fAe,pAe,mAe,hAe,gAe,_Ae,bAe,SAe,wAe,$Ae,kAe,TAe,OAe,RAe,IAe,PAe,CAe,DAe,NAe,WJ,MAe,FAe,zAe,UAe,qAe,KJ,BJ,YJ,XJ,QJ=y(()=>{qJ=ZEe(import.meta.url);QEe=/[\\/]/g;eAe=/^[a-z]:[\\/]$/i;cAe=(t,e)=>{e.push(t||".")},lAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},uAe=()=>{};fAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},pAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},mAe=(t,e,r,n)=>{r.files++},hAe=(t,e)=>{e.push(t)},gAe=()=>{};_Ae=t=>t,bAe=()=>[""].slice(0,0);SAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},wAe=()=>{};$Ae=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&VJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},kAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&VJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};TAe=t=>t.counts,OAe=t=>t.groups,RAe=t=>t.paths,IAe=t=>t.paths.slice(0,t.options.maxFiles),PAe=(t,e,r)=>(zv(e,r,t.counts,t.options.suppressErrors),null),CAe=(t,e,r)=>(zv(e,r,t.paths,t.options.suppressErrors),null),DAe=(t,e,r)=>(zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),NAe=(t,e,r)=>(zv(e,r,t.groups,t.options.suppressErrors),null);WJ={withFileTypes:!0},MAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",WJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},FAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",WJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};zAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},UAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},qAe=class{aborted=!1;abort(){this.aborted=!0}},KJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=jAe(e,this.isSynchronous),this.root=DP(t,e),this.state={root:tAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new UAe,options:e,queue:new zAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new qAe,fs:e.fs||YEe},this.joinPath=oAe(this.root,e),this.pushDirectory=dAe(this.root,e),this.pushFile=yAe(e),this.getArray=vAe(e),this.groupFiles=xAe(e),this.resolveSymlink=EAe(e,this.isSynchronous),this.walkDirectory=LAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=DP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=VEe(_),x=DP(NP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};BJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return BAe(this.root,this.options)}withCallback(t){JJ(this.root,this.options,t)}sync(){return HAe(this.root,this.options)}},YJ=null;try{qJ.resolve("picomatch"),YJ=qJ("picomatch")}catch{}XJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:HJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new BJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new BJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||YJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var bp=v((Sdt,i8)=>{"use strict";var e8="[^\\\\/]",GAe="(?=.)",t8="[^/]",jP="(?:\\/|$)",r8="(?:^|\\/)",MP=`\\.{1,2}${jP}`,ZAe="(?!\\.)",VAe=`(?!${r8}${MP})`,WAe=`(?!\\.{0,1}${jP})`,KAe=`(?!${MP})`,JAe="[^.\\/]",YAe=`${t8}*?`,XAe="/",n8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:GAe,QMARK:t8,END_ANCHOR:jP,DOTS_SLASH:MP,NO_DOT:ZAe,NO_DOTS:VAe,NO_DOT_SLASH:WAe,NO_DOTS_SLASH:KAe,QMARK_NO_DOT:JAe,STAR:YAe,START_ANCHOR:r8,SEP:XAe},QAe={...n8,SLASH_LITERAL:"[\\\\/]",QMARK:e8,STAR:`${e8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},eTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};i8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:eTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?QAe:n8}}});var vp=v(Lr=>{"use strict";var{REGEX_BACKSLASH:tTe,REGEX_REMOVE_BACKSLASH:rTe,REGEX_SPECIAL_CHARS:nTe,REGEX_SPECIAL_CHARS_GLOBAL:iTe}=bp();Lr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Lr.hasRegexChars=t=>nTe.test(t);Lr.isRegexChar=t=>t.length===1&&Lr.hasRegexChars(t);Lr.escapeRegex=t=>t.replace(iTe,"\\$1");Lr.toPosixSlashes=t=>t.replace(tTe,"/");Lr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Lr.removeBackslashes=t=>t.replace(rTe,e=>e==="\\"?"":e);Lr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Lr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Lr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Lr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Lr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var f8=v((xdt,d8)=>{"use strict";var o8=vp(),{CHAR_ASTERISK:FP,CHAR_AT:oTe,CHAR_BACKWARD_SLASH:Sp,CHAR_COMMA:sTe,CHAR_DOT:LP,CHAR_EXCLAMATION_MARK:zP,CHAR_FORWARD_SLASH:u8,CHAR_LEFT_CURLY_BRACE:UP,CHAR_LEFT_PARENTHESES:qP,CHAR_LEFT_SQUARE_BRACKET:aTe,CHAR_PLUS:cTe,CHAR_QUESTION_MARK:s8,CHAR_RIGHT_CURLY_BRACE:lTe,CHAR_RIGHT_PARENTHESES:a8,CHAR_RIGHT_SQUARE_BRACKET:uTe}=bp(),c8=t=>t===u8||t===Sp,l8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},dTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&c8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=o8.removeBackslashes(P)),xe&&_===!0&&(xe=o8.removeBackslashes(xe)));let Pr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,c8(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var wp=bp(),cn=vp(),{MAX_LENGTH:Uv,POSIX_REGEX_SOURCE:fTe,REGEX_NON_SPECIAL_CHARS:pTe,REGEX_SPECIAL_CHARS_BACKREF:mTe,REPLACEMENTS:p8}=wp,hTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>cn.escapeRegex(i)).join("..")}return r},Zl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,m8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},gTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},h8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(gTe(e))return e.replace(/\\(.)/g,"$1")},yTe=t=>{let e=t.map(h8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},_Te=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=h8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?cn.escapeRegex(r[0]):`[${r.map(i=>cn.escapeRegex(i)).join("")}]`}*`},bTe=t=>{let e=0,r=t.trim(),n=BP(r);for(;n;)e++,r=n.body.trim(),n=BP(r);return e},vTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:wp.DEFAULT_MAX_EXTGLOB_RECURSION,n=m8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||yTe(n)))return{risky:!0};for(let i of n){let o=_Te(i);if(o)return{risky:!0,safeOutput:o};if(bTe(i)>r)return{risky:!0}}return{risky:!1}},HP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=p8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=wp.globChars(r.windows),l=wp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=cn.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Pr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},lo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},$i=H=>{$[H]++,xe.push(H)},Qr=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},uo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;$i("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Wde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=vTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,ki=s[H.tokensIndex];ki.type="text",ki.value=ht,ki.output=lt||cn.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let ki=HP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${ki})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Qr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(mTe,(B,Oe,ut,zt,lt,ki)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):ki===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=cn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=fTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=cn.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){$i("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Zl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Wde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Qr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Zl("closing","]"));P=`\\${P}`}else $i("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Zl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Qr("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||cn.hasRegexChars(B))continue;let Oe=cn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){$i("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=hTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Qr("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){uo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){lo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=pTe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){uo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),ki=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!ki){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ei=t[$.index+4];if(Ei&&Ei!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Pr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Pr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ei=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ei})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zl("closing","]"));$.output=cn.escapeLast($.output,"["),Qr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zl("closing",")"));$.output=cn.escapeLast($.output,"("),Qr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zl("closing","}"));$.output=cn.escapeLast($.output,"{"),Qr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};HP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=p8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=wp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=cn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};g8.exports=HP});var v8=v((kdt,b8)=>{"use strict";var STe=f8(),GP=y8(),_8=vp(),wTe=bp(),xTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=xTe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?_8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(_8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):GP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>STe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=GP.fastpaths(t,e)),i.output||(i=GP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=wTe;b8.exports=Rt});var $8=v((Edt,x8)=>{"use strict";var S8=v8(),$Te=vp();function w8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:$Te.isWindows()}),S8(t,e,r)}Object.assign(w8,S8);x8.exports=w8});import{readdir as kTe,readdirSync as ETe,realpath as ATe,realpathSync as TTe,stat as OTe,statSync as RTe}from"fs";import{isAbsolute as ITe,posix as Ha,resolve as PTe}from"path";import{fileURLToPath as CTe}from"url";function jTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&NTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function LTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function T8(t){var e;let r=Vl.default.scan(t,zTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ZTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Vl.default.scan(t);return r.isGlob||r.negated}function xp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function O8(t){return typeof t=="string"?[t]:t??[]}function ZP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=GTe(o);s=ITe(s.replace(WTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=VTe.exec(s))===null||i===void 0?void 0:i[0],l=T8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ha.join(o,...d):o}return s}function KTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(ZP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(ZP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(ZP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function JTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=KTe(t,e,n);t.debug&&xp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(E8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Vl.default)(i.match,f),m=(0,Vl.default)(i.ignore,f),h=jTe(i.match,f),g=k8(r,d,o),b=o?g:k8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new XJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&xp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return xp(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&xp("internal properties:",{...n,root:d}),[x,r!==d&&!o&<e(r,d)]}function YTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function QTe(t){let e={...XTe,...t};return e.cwd=(e.cwd instanceof URL?CTe(e.cwd):PTe(e.cwd)).replace(E8,"/"),e.ignore=O8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||kTe,readdirSync:e.fs.readdirSync||ETe,realpath:e.fs.realpath||ATe,realpathSync:e.fs.realpathSync||TTe,stat:e.fs.stat||OTe,statSync:e.fs.statSync||RTe}),e.debug&&xp("globbing with options:",e),e}function eOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=DTe(t)||typeof t=="string",i=O8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=QTe(n?e:t);return i.length>0?JTe(o,i):[]}function _s(t,e){let[r,n]=eOe(t,e);return r?YTe(r.sync(),n):[]}var Vl,DTe,E8,A8,NTe,MTe,FTe,zTe,UTe,qTe,BTe,HTe,GTe,VTe,WTe,XTe,$p=y(()=>{QJ();Vl=St($8(),1),DTe=Array.isArray,E8=/\\/g,A8=process.platform==="win32",NTe=/^(\/?\.\.)+$/;MTe=/^[A-Z]:\/$/i,FTe=A8?t=>MTe.test(t):t=>t==="/";zTe={parts:!0};UTe=/(?t.replace(UTe,"\\$&"),HTe=t=>t.replace(qTe,"\\$&"),GTe=A8?HTe:BTe;VTe=/^(\/?\.\.)+/,WTe=/\\(?=[()[\]{}!*+?@|])/g;XTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as kp,readFileSync as tOe,readdirSync as rOe,statSync as R8}from"node:fs";import{join as Ga}from"node:path";function nOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Fi(e,n),o=[],{layers:s,forbiddenImports:a}=VP(r);return(s.size>0||a.length>0)&&!kp(Ga(e,i.mainRoot))?[{detector:Ep,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(iOe(e,i,s,o),oOe(e,i,s,o)),a.length>0&&sOe(e,i,a,o),o)}function VP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function iOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of rOe(o)){let a=Ga(o,s);R8(a).isDirectory()&&(r.has(s)||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function oOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of r){let a=Ga(o,s);kp(a)&&R8(a).isDirectory()||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function sOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!kp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=tOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];aOe(p,s.to,e.importStyle)&&n.push({detector:Ep,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function aOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ep,I8,WP=y(()=>{"use strict";$p();Ue();Ba();Ep="ARCHITECTURE_FROM_SPEC";I8={name:Ep,run:nOe}});import{existsSync as cOe,readFileSync as lOe}from"node:fs";import{join as uOe}from"node:path";function fOe(t){let{cwd:e="."}=t,r=uOe(e,"spec/capabilities.yaml");if(!cOe(r))return[];let n;try{let u=lOe(r,"utf8"),d=P8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";P8=St(er(),1);Ue();qv="CAPABILITIES_FEATURE_MAPPING",dOe=8;C8={name:qv,run:fOe}});import{existsSync as pOe,readFileSync as mOe}from"node:fs";import{join as hOe}from"node:path";function gOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function yOe(t){let{cwd:e="."}=t;return ge(e,KP,r=>_Oe(r,e))}function _Oe(t,e){let r=Fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=hOe(e,o);if(!pOe(s))continue;let a=mOe(s,"utf8");gOe(a)||n.push({detector:KP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var KP,N8,j8=y(()=>{"use strict";Ba();wt();KP="CONVENTION_DRIFT";N8={name:KP,run:yOe}});import{existsSync as JP,readFileSync as M8}from"node:fs";import{join as Bv}from"node:path";function bOe(t){return JSON.parse(t).total?.lines?.pct??0}function F8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function wOe(t,e){if(!Av(dt(t).gates.coverage?.cmd))return null;let r;try{r=Tv(t,e)}catch(c){return[{detector:$o,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=AP.find(d=>JP(Bv(c.dir,d)));if(!l){s.push(c.path);continue}let u=F8(M8(Bv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:$o,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=L8(n,i);return a0?[{detector:$o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function xOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=wOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Fi(e,r),i=dt(e).language==="kotlin"?AP.find(a=>JP(Bv(e,a)))??vJ(e):n.coverageSummary,o=Bv(e,i);if(!JP(o))return[{detector:$o,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=M8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?vOe(a):n.coverageFormat==="cobertura-xml"?SOe(a):bOe(a)}catch(a){return[{detector:$o,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:$o,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Hv?[]:[{detector:$o,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Hv}%`}]}var $o,Hv,z8,U8=y(()=>{"use strict";Ue();Iv();Ba();Ov();an();$o="COVERAGE_DROP",Hv=70;z8={name:$o,run:xOe}});import{existsSync as $Oe}from"node:fs";import{join as kOe}from"node:path";function AOe(t){let{cwd:e="."}=t;return ge(e,Gv,r=>TOe(r,e))}function TOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Gv="DELIVERABLE_INTEGRITY",EOe=8;q8={name:Gv,run:AOe}});function OOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Zv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function ROe(t){let e=OOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Zv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function IOe(t){let{cwd:e="."}=t;return ge(e,Zv,r=>ROe(r))}var Zv,H8,G8=y(()=>{"use strict";wt();Zv="SMOKE_PROBE_DEMAND";H8={name:Zv,run:IOe}});function POe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>COe(r,e))}function COe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=cs(e);if(n===null)return[{detector:Vv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=V_(n,e,o);s.state!=="fresh"&&i.push({detector:Vv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Vv,Wv,YP=y(()=>{"use strict";wl();wt();Vv="STALE_ATTESTATION";Wv={name:Vv,run:POe}});function DOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return NOe(r)}function NOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:Z8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var Z8,Kv,XP=y(()=>{"use strict";Ue();Z8="DEPENDENCY_CYCLE";Kv={name:Z8,run:DOe}});import{appendFileSync as jOe,existsSync as V8,mkdirSync as MOe,readFileSync as FOe}from"node:fs";import{dirname as LOe,join as zOe}from"node:path";function W8(t){return zOe(t,UOe,qOe)}function K8(t){return QP.add(t),()=>QP.delete(t)}function Za(t,e){let r=W8(t),n=LOe(r);V8(n)||MOe(n,{recursive:!0}),jOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of QP)try{i(t,e)}catch{}}function fr(t){let e=W8(t);if(!V8(e))return[];let r=FOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var UOe,qOe,QP,ln=y(()=>{"use strict";UOe=".cladding",qOe="audit.log.jsonl";QP=new Set});import{existsSync as BOe}from"node:fs";import{join as HOe}from"node:path";function GOe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:eC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(BOe(HOe(e,i.artifact))||n.push({detector:eC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var eC,J8,Y8=y(()=>{"use strict";ln();eC="EVIDENCE_MISMATCH";J8={name:eC,run:GOe}});import{existsSync as ZOe,readFileSync as VOe}from"node:fs";import{join as WOe}from"node:path";function KOe(t){let e=WOe(t,t5);if(!ZOe(e))return null;try{let n=((0,e5.parse)(VOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*Q8(t,e){for(let r of t??[])r.startsWith(X8)&&(yield{ref:r,name:r.slice(X8.length),field:e})}function JOe(t){let{cwd:e="."}=t,r=KOe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:tC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...Q8(s.evidence_refs,"evidence_refs"),...Q8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:tC,severity:"warn",path:t5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var e5,tC,X8,t5,r5,n5=y(()=>{"use strict";e5=St(er(),1);Ue();tC="FIXTURE_REFERENCE_INVALID",X8="fixture:",t5="conformance/fixtures.yaml";r5={name:tC,run:JOe}});import{existsSync as Wl,readFileSync as rC}from"node:fs";import{join as Va}from"node:path";function YOe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Ap(t){if(!Wl(t))return null;try{return JSON.parse(rC(t,"utf8"))}catch{return null}}function XOe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(rC(r,"utf8"))}catch(c){e.push({detector:ko,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:ko,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=YOe(t);s!==a&&e.push({detector:ko,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function QOe(t,e){for(let r of i5){let n=Va(t,r.path);if(!Wl(n))continue;let i=Ap(n);if(!i){e.push({detector:ko,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:ko,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function eRe(t,e){let r=Ap(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of i5){let s=Va(t,o.path);if(!Wl(s))continue;let a=Ap(s);a?.version&&a.version!==n&&e.push({detector:ko,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(Wl(i)){let o=Ap(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:ko,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function tRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function rRe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Wl(r)||!Wl(n))return;let i=tRe(rC(r,"utf8"));if(i.length===0)return;let s=Ap(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:ko,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function nRe(t){let{cwd:e="."}=t,r=[];return XOe(e,r),rRe(e,r),QOe(e,r),eRe(e,r),r}var ko,i5,o5,s5=y(()=>{"use strict";$p();ko="HARNESS_INTEGRITY",i5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];o5={name:ko,run:nRe}});import{existsSync as iRe,readFileSync as oRe}from"node:fs";import{join as sRe}from"node:path";function cRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>uRe(r,e))}function lRe(t){let e=sRe(t,"spec/capabilities.yaml");if(!iRe(e))return!1;try{let r=a5.default.parse(oRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function uRe(t,e){let r=t.features.length;if(r{"use strict";a5=St(er(),1);wt();Jv="HOLLOW_GOVERNANCE",aRe=8;c5={name:Jv,run:cRe}});import{existsSync as u5,readFileSync as d5}from"node:fs";import{join as f5}from"node:path";function p5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function pRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function mRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function hRe(t){let e=f5(t,"README.md"),r=f5(t,"docs","dogfood","matrix.md");if(!u5(e)||!u5(r))return[];let n=p5(d5(e,"utf8"),dRe),i=p5(d5(r,"utf8"),fRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=mRe(a);if(c===null)continue;let l=i[s]??"not-run",u=pRe(l);u!==null&&c>u&&o.push({detector:m5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function gRe(t){let{cwd:e="."}=t;return hRe(e)}var m5,dRe,fRe,h5,g5=y(()=>{"use strict";m5="HOST_CLAIM_DRIFT",dRe=//,fRe=//;h5={name:m5,run:gRe}});function yRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return y5(r.features.map(i=>i.id),"feature","spec/features/",n),y5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function y5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:_5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var _5,b5,v5=y(()=>{"use strict";Ue();_5="ID_COLLISION";b5={name:_5,run:yRe}});import{existsSync as Tp,readFileSync as nC,readdirSync as iC,statSync as _Re,writeFileSync as w5}from"node:fs";import{join as Eo}from"node:path";function S5(t){if(!Tp(t))return 0;try{return iC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function bRe(t){if(!Tp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=iC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Eo(n,o),a;try{a=_Re(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function vRe(t){let e=Eo(t,"spec","capabilities.yaml");if(!Tp(e))return 0;try{let r=Yv.default.parse(nC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=S5(Eo(t,"spec","features")),r=S5(Eo(t,"spec","scenarios")),n=vRe(t),i=bRe(Eo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Kl(t,e){let r=Eo(t,"spec.yaml");if(!Tp(r))return;let n=nC(r,"utf8"),i=SRe(n,e);i!==n&&w5(r,i)}function SRe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as r0e}from"node:buffer";import{StringDecoder as n0e}from"node:string_decoder";var iv,i0e,o0e,s0e,wI=y(()=>{on();iv=(t,e,r)=>{if(r)return;if(t)return{transform:i0e.bind(void 0,new TextEncoder)};let n=new n0e(e);return{transform:o0e.bind(void 0,n),final:s0e.bind(void 0,n)}},i0e=function*(t,e){r0e.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},o0e=function*(t,e){yield qt(e)?t.write(e):e},s0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as aK}from"node:util";var xI,ov,cK,a0e,lK,c0e,uK=y(()=>{xI=aK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),ov=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=c0e}=e[r];for await(let i of n(t))yield*ov(i,e,r+1)},cK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*a0e(r,Number(e),t)},a0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*ov(n,r,e+1)},lK=aK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),c0e=function*(t){yield t}});var $I,dK,Ma,up,l0e,u0e,kI=y(()=>{$I=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dK=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...up(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},up=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},u0e=function*(t){yield t}});import{Transform as d0e,getDefaultHighWaterMark as fK}from"node:stream";var EI,sv,pK,av=y(()=>{wr();nv();sK();wI();uK();kI();EI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=pK(t,s,o),l=ja(e),u=ja(r),d=l?xI.bind(void 0,ov,a):$I.bind(void 0,Ma),f=l||u?xI.bind(void 0,cK,a):$I.bind(void 0,up),p=l||u?lK.bind(void 0,a):void 0;return{stream:new d0e({writableObjectMode:n,writableHighWaterMark:fK(n),readableObjectMode:i,readableHighWaterMark:fK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},sv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=pK(s,r,a);t=dK(c,t)}return t},pK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:nK(n,a)},iv(r,s,n),rv(r,o,n,c),{transform:t,final:e},{transform:iK(i,a)},rK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var mK,f0e,p0e,m0e,h0e,hK=y(()=>{av();on();wr();mK=(t,e)=>{for(let r of f0e(t))p0e(t,r,e)},f0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),p0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>m0e(a,n));r.input=Wf(s)},m0e=(t,e)=>{let r=sv(t,e,"utf8",!0);return h0e(r),Wf(r)},h0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var cv,g0e,y0e,gK,yK,_0e,_K,AI=y(()=>{Pa();wr();Tl();ds();cv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Al(r,n)&&!sn.has(e)&&g0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&y0e.has(o))||t.every(({type:i})=>In.has(i))),g0e=t=>t===1||t===2,y0e=new Set(["pipe","overlapped"]),gK=async(t,e,r,n)=>{for await(let i of t)_0e(e)||_K(i,r,n)},yK=(t,e,r)=>{for(let n of t)_K(n,e,r)},_0e=t=>t._readableState.pipes.length>0,_K=(t,e,r)=>{let n=ab(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as b0e,appendFileSync as v0e}from"node:fs";var bK,S0e,w0e,x0e,$0e,k0e,vK=y(()=>{AI();av();nv();on();wr();Na();bK=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>S0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},S0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=iW(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=w0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=x0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});$0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&k0e(b,m,i),S}catch(x){return n.error=x,S}},w0e=(t,e,r,n)=>{try{return sv(t,e,r,!1)}catch(i){return n.error=i,t}},x0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Wf(t)};let s=WG(t,r);return n[o]?{serializedResult:s,finalResult:SI(s,!i[o],e)}:{serializedResult:s}},$0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!cv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=SI(t,!1,s);try{yK(a,e,n)}catch(c){r.error??=c}},k0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Qb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?v0e(n,t):(r.add(o),b0e(n,t))}}});var SK,wK=y(()=>{on();lp();SK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xo(e,r,"all")]:Array.isArray(e)?[xo(t,r,"all"),...e]:qt(t)&&qt(e)?gR([t,e]):`${t}${e}`}});import{once as TI}from"node:events";var xK,E0e,$K,kK,A0e,OI,RI=y(()=>{Ra();xK=async(t,e)=>{let[r,n]=await E0e(t);return e.isForcefullyTerminated??=!1,[r,n]},E0e=async t=>{let[e,r]=await Promise.allSettled([TI(t,"spawn"),TI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?$K(t):r.value},$K=async t=>{try{return await TI(t,"exit")}catch{return $K(t)}},kK=async t=>{let[e,r]=await t;if(!A0e(e,r)&&OI(e,r))throw new ti;return[e,r]},A0e=(t,e)=>t===void 0&&e===void 0,OI=(t,e)=>t!==0||e!==null});var EK,T0e,AK=y(()=>{Ra();Na();RI();EK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=T0e(t,e,r),s=o?.code==="ETIMEDOUT",a=nW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},T0e=(t,e,r)=>t!==void 0?t:OI(e,r)?new ti:void 0});import{spawnSync as O0e}from"node:child_process";var TK,R0e,I0e,P0e,lv,C0e,D0e,N0e,j0e,OK=y(()=>{kR();QR();eI();cp();Jb();QW();lp();hK();vK();Na();wK();AK();TK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=R0e(t,e,r),d=C0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ll(d,c,l)},R0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),a=I0e(r),{file:c,commandArguments:l,options:u}=Mb(t,e,a);P0e(u);let d=YW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},I0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,P0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&lv("ipcInput"),t&&lv("ipc: true"),r&&lv("detached: true"),n&&lv("cancelSignal")},lv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},C0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=D0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=EK(c,r),{output:m,error:h=l}=bK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(SK(m,r),r,"all");return j0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},D0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{mK(o,r);let a=N0e(r);return O0e(...Fb(t,e,a))}catch(a){return Fl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},N0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Wb(e)}),j0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Kb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):ap({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as II,on as M0e}from"node:events";var RK,F0e,L0e,z0e,U0e,IK=y(()=>{Cl();rp();tp();RK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Il({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),F0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),F0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{xb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([L0e(o,n,s),z0e(o,r,s),U0e(o,r,s)])}catch(a){throw Pl(t),a}finally{s.abort(),$b(e,i)}},L0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await II(t,"message",{signal:r});return n}for await(let[n]of M0e(t,"message",{signal:r}))if(e(n))return n},z0e=async(t,e,{signal:r})=>{await II(t,"disconnect",{signal:r}),q9(e)},U0e=async(t,e,{signal:r})=>{let[n]=await II(t,"strict:error",{signal:r});throw bb(n,e)}});import{once as CK,on as q0e}from"node:events";var DK,PI,B0e,H0e,G0e,PK,CI=y(()=>{Cl();rp();tp();DK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>PI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),PI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Il({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),xb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return B0e(t,s,a),H0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),G0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},B0e=async(t,e,r)=>{try{await CK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},H0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await CK(t,"strict:error",{signal:r.signal});n.error=bb(i,e),r.abort()}catch{}},G0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of q0e(r,"message",{signal:o.signal}))PK(s),yield c}catch{PK(s)}finally{o.abort(),$b(e,a),n||Pl(t),i&&await t}},PK=({error:t})=>{if(t)throw t}});import NK from"node:process";var jK,MK,FK,DI=y(()=>{Nb();IK();CI();Tb();jK=(t,{ipc:e})=>{Object.assign(t,FK(t,!1,e))},MK=()=>{let t=NK,e=!0,r=NK.channel!==void 0;return{...FK(t,e,r),getCancelSignal:gV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},FK=(t,e,r)=>({sendMessage:Db.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:RK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:DK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Z0e}from"node:child_process";import{PassThrough as V0e,Readable as W0e,Writable as K0e,Duplex as J0e}from"node:stream";var LK,Y0e,dp,X0e,Q0e,e$e,t$e,zK=y(()=>{tv();cp();Jb();LK=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{_I(n);let a=new Z0e;Y0e(a,n),Object.assign(a,{readable:X0e,writable:Q0e,duplex:e$e});let c=Fl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=t$e(c,s,i);return{subprocess:a,promise:l}},Y0e=(t,e)=>{let r=dp(),n=dp(),i=dp(),o=Array.from({length:e.length-3},dp),s=dp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},dp=()=>{let t=new V0e;return t.end(),t},X0e=()=>new W0e({read(){}}),Q0e=()=>new K0e({write(){}}),e$e=()=>new J0e({read(){},write(){}}),t$e=async(t,e,r)=>Ll(t,e,r)});import{createReadStream as UK,createWriteStream as qK}from"node:fs";import{Buffer as r$e}from"node:buffer";import{Readable as fp,Writable as n$e,Duplex as i$e}from"node:stream";var HK,pp,BK,o$e,GK=y(()=>{av();tv();wr();HK=(t,e)=>ev(o$e,t,e,!1),pp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},BK={fileNumber:pp,generator:EI,asyncGenerator:EI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:i$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},o$e={input:{...BK,fileUrl:({value:t})=>({stream:UK(t)}),filePath:({value:{file:t}})=>({stream:UK(t)}),webStream:({value:t})=>({stream:fp.fromWeb(t)}),iterable:({value:t})=>({stream:fp.from(t)}),asyncIterable:({value:t})=>({stream:fp.from(t)}),string:({value:t})=>({stream:fp.from(t)}),uint8Array:({value:t})=>({stream:fp.from(r$e.from(t))})},output:{...BK,fileUrl:({value:t})=>({stream:qK(t)}),filePath:({value:{file:t,append:e}})=>({stream:qK(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:n$e.fromWeb(t)}),iterable:pp,asyncIterable:pp,string:pp,uint8Array:pp}}});import{on as s$e,once as ZK}from"node:events";import{PassThrough as a$e,getDefaultHighWaterMark as c$e}from"node:stream";import{finished as KK}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)jI(i);let e=t.some(({readableObjectMode:i})=>i),r=l$e(t,e),n=new NI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var l$e,NI,u$e,d$e,f$e,jI,p$e,m$e,h$e,g$e,y$e,JK,YK,MI,XK,_$e,uv,VK,WK,dv=y(()=>{l$e=(t,e)=>{if(t.length===0)return c$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},NI=class extends a$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(jI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=u$e(this,this.#t,this.#o);let r=p$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(jI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},u$e=async(t,e,r)=>{uv(t,VK);let n=new AbortController;try{await Promise.race([d$e(t,n),f$e(t,e,r,n)])}finally{n.abort(),uv(t,-VK)}},d$e=async(t,{signal:e})=>{try{await KK(t,{signal:e,cleanup:!0})}catch(r){throw JK(t,r),r}},f$e=async(t,e,r,{signal:n})=>{for await(let[i]of s$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},jI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},p$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{uv(t,WK);let a=new AbortController;try{await Promise.race([m$e(o,e,a),h$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),g$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),uv(t,-WK)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?MI(t):y$e(t))},m$e=async(t,e,{signal:r})=>{try{await t,r.aborted||MI(e)}catch(n){r.aborted||JK(e,n)}},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await KK(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;YK(s)?i.add(e):XK(t,s)}},g$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await ZK(t,i,{signal:o}),!t.readable)return ZK(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},y$e=t=>{t.writable&&t.end()},JK=(t,e)=>{YK(e)?MI(t):XK(t,e)},YK=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",MI=t=>{(t.readable||t.writable)&&t.destroy()},XK=(t,e)=>{t.destroyed||(t.once("error",_$e),t.destroy(e))},_$e=()=>{},uv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},VK=2,WK=1});import{finished as QK}from"node:stream/promises";var Ul,b$e,FI,v$e,LI,fv=y(()=>{bo();Ul=(t,e)=>{t.pipe(e),b$e(t,e),v$e(t,e)},b$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}FI(e)}},FI=t=>{t.writable&&t.end()},v$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}LI(t)}},LI=t=>{t.readable&&t.destroy()}});var e3,S$e,w$e,x$e,$$e,k$e,t3=y(()=>{dv();bo();wb();wr();fv();e3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>In.has(c)))S$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!In.has(c)))x$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fa(o);Ul(s,i)}},S$e=(t,e,r,n)=>{r==="output"?Ul(t.stdio[n],e):Ul(e,t.stdio[n]);let i=w$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},w$e=["stdin","stdout","stderr"],x$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;$$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},$$e=(t,{signal:e})=>{ei(t)&&Ia(t,k$e,e)},k$e=2});var La,r3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var pv,zI,UI,E$e,qI,mv,A$e,BI,HI,GI,n3,xat,$at,i3=y(()=>{r3();pv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",zI=Symbol.for("signal-exit emitter"),UI=globalThis,E$e=Object.defineProperty.bind(Object),qI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(UI[zI])return UI[zI];E$e(UI,zI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},mv=class{},A$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),BI=class extends mv{onExit(){return()=>{}}load(){}unload(){}},HI=class extends mv{#t=GI.platform==="win32"?"SIGINT":"SIGHUP";#r=new qI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!pv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of La)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,La.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return pv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&pv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},GI=globalThis.process,{onExit:n3,load:xat,unload:$at}=A$e(pv(GI)?new HI(GI):new BI)});import{addAbortListener as T$e}from"node:events";var o3,s3=y(()=>{i3();o3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=n3(()=>{t.kill()});T$e(n,()=>{i()})}});var c3,O$e,R$e,a3,I$e,l3=y(()=>{hR();lb();ps();kl();c3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=cb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=O$e(r,n,i),{sourceStream:d,sourceError:f}=I$e(t,l),{options:p,fileDescriptors:m}=Di.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},O$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=R$e(t,e,...r),a=Sb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},R$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(a3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||pR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=Y_(r,...n);return{destination:e(a3)(i,o,s),pipeOptions:s}}if(Di.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},a3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),I$e=(t,e)=>{try{return{sourceStream:Nl(t,e)}}catch(r){return{sourceError:r}}}});var d3,P$e,ZI,u3,VI=y(()=>{cp();fv();d3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=P$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw ZI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},P$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return LI(t),n;if(e!==void 0)return FI(r),e},ZI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Fl({error:t,command:u3,escapedCommand:u3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),u3="source.pipe(destination)"});var f3,p3=y(()=>{f3=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as C$e}from"node:stream/promises";var m3,D$e,N$e,j$e,hv,M$e,F$e,h3=y(()=>{dv();wb();fv();m3=(t,e,r)=>{let n=hv.has(e)?N$e(t,e):D$e(t,e);return Ia(t,M$e,r.signal),Ia(e,F$e,r.signal),j$e(e),n},D$e=(t,e)=>{let r=Fa([t]);return Ul(r,e),hv.set(e,r),r},N$e=(t,e)=>{let r=hv.get(e);return r.add(t),r},j$e=async t=>{try{await C$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}hv.delete(t)},hv=new WeakMap,M$e=2,F$e=1});import{aborted as L$e}from"node:util";var g3,z$e,y3=y(()=>{VI();g3=(t,e)=>t===void 0?[]:[z$e(t,e)],z$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await L$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw ZI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var gv,U$e,q$e,_3=y(()=>{yo();l3();VI();p3();h3();y3();gv=(t,...e)=>{if(Ot(e[0]))return gv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=c3(t,...e),i=U$e({...n,destination:r});return i.pipe=gv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},U$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=q$e(t,i);d3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=m3(e,o,d);return await Promise.race([f3(u),...g3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},q$e=(t,e)=>Promise.allSettled([t,e])});import{on as B$e}from"node:events";import{getDefaultHighWaterMark as H$e}from"node:stream";var yv,G$e,WI,Z$e,v3,KI,b3,V$e,W$e,_v=y(()=>{wI();nv();kI();yv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return G$e(e,s),v3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},G$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},WI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Z$e(e,s,t);let a=t.readableObjectMode&&!o;return v3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Z$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},v3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=B$e(t,"data",{signal:e.signal,highWaterMark:b3,highWatermark:b3});return V$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},KI=H$e(!0),b3=KI,V$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=W$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*up(a)}},W$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[iv(t,r,!e),rv(t,i,!n,{})].filter(Boolean)});import{setImmediate as K$e}from"node:timers/promises";var S3,J$e,Y$e,X$e,JI,w3,YI=y(()=>{Vb();on();AI();_v();Na();lp();S3=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=J$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Y$e(t),d]);return}let f=bI(c,r),p=WI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([X$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},J$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!cv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=WI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await gK(a,t,r,o)},Y$e=async t=>{await K$e(),t.readableFlowing===null&&t.resume()},X$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Bb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Hb(r,{maxBuffer:o})):await Zb(r,{maxBuffer:o})}catch(a){return w3(eW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},JI=async t=>{try{return await t}catch(e){return w3(e)}},w3=({bufferedData:t})=>ZG(t)?new Uint8Array(t):t});import{finished as Q$e}from"node:stream/promises";var mp,eke,tke,rke,nke,ike,XI,bv,x3,vv=y(()=>{mp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=eke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Q$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||nke(a,e,r,n)}finally{s.abort()}},eke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&tke(t,r,n),n},tke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{rke(e,r),n.call(t,...i)}},rke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},nke=(t,e,r,n)=>{if(!ike(t,e,r,n))throw t},ike=(t,e,r,n=!0)=>r.propagating?x3(t)||bv(t):(r.propagating=!0,XI(r,e)===n?x3(t):bv(t)),XI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",bv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",x3=t=>t?.code==="EPIPE"});var $3,QI,eP=y(()=>{YI();vv();$3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>QI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),QI=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=mp(t,e,l);if(XI(l,e)){await u;return}let[d]=await Promise.all([S3({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var k3,E3,oke,ske,tP=y(()=>{dv();eP();k3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,E3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>QI({...oke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:ske(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),oke=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},ske=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var A3,T3,O3=y(()=>{Tl();ds();A3=t=>Al(t,"ipc"),T3=(t,e)=>{let r=ab(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var R3,I3,P3=y(()=>{Na();O3();So();CI();R3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=A3(o),a=vo(e,"ipc"),c=vo(r,"ipc");for await(let l of PI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(tW(t,i,c),i.push(l)),s&&T3(l,o);return i},I3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as ake}from"node:events";var C3,cke,lke,uke,D3=y(()=>{Da();WR();LR();VR();bo();wr();YI();P3();JR();tP();eP();RI();vv();C3=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=xK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=$3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=E3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=R3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=cke(h,t,S),D=lke(m,S);try{return await Promise.race([Promise.all([{},kK(_),Promise.all(x),w,T,EV(t,d),...A,...D]),g,uke(t,b),...SV(t,o,f,b),...U9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...bV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>JI(re))),JI(w),I3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},cke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:mp(n,i,r)),lke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ni(o,{checkOpen:!1})&&!ei(o)).map(({type:i,value:o,stream:s=o})=>mp(s,n,e,{isSameDirection:In.has(i),stopOnExit:i==="native"}))),uke=async(t,{signal:e})=>{let[r]=await ake(t,"error",{signal:e});throw r}});var N3,hp,ql,Sv=y(()=>{Dl();N3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),hp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},ql=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as j3}from"node:stream/promises";var rP,M3,nP,iP,wv,xv,oP=y(()=>{vv();rP=async t=>{if(t!==void 0)try{await nP(t)}catch{}},M3=async t=>{if(t!==void 0)try{await iP(t)}catch{}},nP=async t=>{await j3(t,{cleanup:!0,readable:!1,writable:!0})},iP=async t=>{await j3(t,{cleanup:!0,readable:!0,writable:!1})},wv=async(t,e)=>{if(await t,e)throw e},xv=(t,e,r)=>{r&&!bv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as dke}from"node:stream";import{callbackify as fke}from"node:util";var F3,sP,aP,cP,pke,lP,uP,L3,dP=y(()=>{Pa();ps();_v();Dl();Sv();oP();F3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||sn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=aP(a,s),{read:f,onStdoutDataDone:p}=cP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new dke({read:f,destroy:fke(uP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return lP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},sP=(t,e,r)=>{let n=Nl(t,e),i=hp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},aP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:KI},cP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ci(),s=yv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){pke(this,s,o)},onStdoutDataDone:o}},pke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},lP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await iP(t),await n,await rP(i),await e,r.readable&&r.push(null)}catch(o){await rP(i),L3(r,o)}},uP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await ql(r,e)&&(L3(t,n),await wv(e,n))},L3=(t,e)=>{xv(t,t.readable,e)}});import{Writable as mke}from"node:stream";import{callbackify as z3}from"node:util";var U3,fP,pP,hke,gke,mP,hP,q3,gP=y(()=>{ps();Sv();oP();U3=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=fP(t,r,e),s=new mke({...pP(n,t,i),destroy:z3(hP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return mP(n,s),s},fP=(t,e,r)=>{let n=Sb(t,e),i=hp(r,n,"writableFinal"),o=hp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},pP=(t,e,r)=>({write:hke.bind(void 0,t),final:z3(gke.bind(void 0,t,e,r))}),hke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},gke=async(t,e,r)=>{await ql(r,e)&&(t.writable&&t.end(),await e)},mP=async(t,e,r)=>{try{await nP(t),e.writable&&e.end()}catch(n){await M3(r),q3(e,n)}},hP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await ql(r,e),await ql(n,e)&&(q3(t,i),await wv(e,i))},q3=(t,e)=>{xv(t,t.writable,e)}});import{Duplex as yke}from"node:stream";import{callbackify as _ke}from"node:util";var B3,bke,H3=y(()=>{Pa();dP();gP();B3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||sn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=fP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=aP(c,a),{read:g,onStdoutDataDone:b}=cP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new yke({read:g,...pP(u,t,d),destroy:_ke(bke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return lP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),mP(u,_,c),_},bke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([uP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),hP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var yP,vke,G3=y(()=>{Pa();ps();_v();yP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||sn.has(e),s=Nl(t,r),a=yv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return vke(a,s,t)},vke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var Z3,V3=y(()=>{Sv();dP();gP();H3();G3();Z3=(t,{encoding:e})=>{let r=N3();t.readable=F3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=U3.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=B3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=yP.bind(void 0,t,e),t[Symbol.asyncIterator]=yP.bind(void 0,t,e,{})}});var W3,Ske,wke,K3=y(()=>{W3=(t,e)=>{for(let[r,n]of wke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Ske=(async()=>{})().constructor.prototype,wke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Ske,t)])});import{setMaxListeners as xke}from"node:events";import{spawn as $ke}from"node:child_process";var J3,kke,Eke,Ake,Tke,Oke,Y3=y(()=>{Vb();kR();QR();ps();eI();DI();cp();Jb();zK();GK();lp();t3();yb();s3();_3();tP();D3();V3();Dl();K3();J3=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=kke(t,e,r),{subprocess:f,promise:p}=Ake({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=gv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),W3(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},kke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),{file:a,commandArguments:c,options:l}=Mb(t,e,r),u=Eke(l),d=HK(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Eke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Ake=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=$ke(...Fb(t,e,r))}catch(m){return LK({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;xke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];e3(c,a,l),o3(c,r,l);let d={},f=Ci();c.kill=L9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=k3(c,r),Z3(c,r),jK(c,r);let p=Tke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Tke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await C3({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>xo(x,e,w)),_=xo(h,e,"all"),S=Oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ll(S,n,e)},Oke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?ap({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ni,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Kb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var $v,Rke,Ike,X3=y(()=>{yo();So();$v=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Rke(n,t[n],i)]));return{...t,...r}},Rke=(t,e,r)=>Ike.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Ike=new Set(["env",...vR])});var gs,Pke,Cke,Q3=y(()=>{yo();hR();eZ();OK();Y3();X3();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Pke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Pke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,$v(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Cke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?TK(a,c,l):J3(a,c,l,i)},Cke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=XG(e)?QG(e,r):[e,...r],[s,a,c]=Y_(...o),l=$v($v(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var eJ,tJ,rJ,Dke,Nke,nJ=y(()=>{eJ=({file:t,commandArguments:e})=>rJ(t,e),tJ=({file:t,commandArguments:e})=>({...rJ(t,e),isSync:!0}),rJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Dke(t);return{file:r,commandArguments:n}},Dke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Nke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Nke=/ +/g});var iJ,oJ,jke,sJ,Mke,aJ,cJ=y(()=>{iJ=(t,e,r)=>{t.sync=e(jke,r),t.s=t.sync},oJ=({options:t})=>sJ(t),jke=({options:t})=>({...sJ(t),isSync:!0}),sJ=t=>({options:{...Mke(t),...t}}),Mke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},aJ={preferLocal:!0}});var put,We,mut,hut,gut,yut,_ut,but,vut,Sut,Fr=y(()=>{Q3();nJ();KR();cJ();DI();put=gs(()=>({})),We=gs(()=>({isSync:!0})),mut=gs(eJ),hut=gs(tJ),gut=gs(xV),yut=gs(oJ,{},aJ,iJ),{sendMessage:_ut,getOneMessage:but,getEachMessage:vut,getCancelSignal:Sut}=MK()});import{existsSync as kv,statSync as Fke}from"node:fs";import{dirname as _P,extname as Lke,isAbsolute as lJ,join as bP,relative as vP,resolve as Ev,sep as zke}from"node:path";function Av(t){return t==="./gradlew"||t==="gradle"}function Uke(t){return(kv(bP(t,"build.gradle.kts"))||kv(bP(t,"build.gradle")))&&kv(bP(t,"gradle.properties"))}function qke(t,e){let n=vP(t,e).split(zke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Bke(t,e){let r=Ev(t,e),n=r;kv(r)?Fke(r).isFile()&&(n=_P(r)):Lke(r)!==""&&(n=_P(r));let i=vP(t,n);if(i.startsWith("..")||lJ(i))return null;let o=n;for(;;){if(Uke(o))return o;if(Ev(o)===Ev(t))return null;let s=_P(o);if(s===o)return null;let a=vP(t,s);if(a.startsWith("..")||lJ(a))return null;o=s}}function Tv(t,e){let r=Ev(t),n=new Map,i=[];for(let o of e){let s=Bke(r,o);if(!s){i.push(o);continue}let a=qke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Ov=y(()=>{"use strict"});import{existsSync as wP,readFileSync as Hke}from"node:fs";import{join as Bl}from"node:path";function Hl(t="."){let e=Bl(t,".cladding","config.yaml");if(!wP(e))return SP;try{let n=(0,uJ.parse)(Hke(e,"utf8"))?.gate;if(!n)return SP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Gke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return SP}}function dJ(t="."){let e=Hl(t).testReport,r=e?[e,...xP]:xP;return[...new Set(r.map(n=>Bl(t,n)))]}function fJ(t="."){let e=Hl(t).testReport;if(e){let r=Bl(t,e);return wP(r)?r:null}return xP.map(r=>Bl(t,r)).find(r=>wP(r))??null}function pJ(t,e){let r=[],n=!1;for(let i of t){let o=Zke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var uJ,Gke,SP,xP,Zke,gp=y(()=>{"use strict";uJ=St(er(),1);Ov();Gke=["type","lint","test","coverage"],SP={scope:"feature"},xP=["test-report.junit.xml",Bl("coverage","junit.xml"),Bl(".cladding","test-report.junit.xml")];Zke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as kP,readFileSync as mJ,readdirSync as Vke,statSync as Wke}from"node:fs";import{join as Rv}from"node:path";function TP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Rv(t,e);if(kP(r))try{if(hJ.test(mJ(r,"utf8")))return!0}catch{}}return!1}function gJ(t){try{return kP(t)&&hJ.test(mJ(t,"utf8"))}catch{return!1}}function yJ(t,e=0){if(e>4||!kP(t))return!1;let r;try{r=Vke(t)}catch{return!1}for(let n of r){let i=Rv(t,n),o=!1;try{o=Wke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(yJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&gJ(i))return!0}return!1}function Yke(t){if(TP(t))return!0;for(let e of Kke)if(gJ(Rv(t,e)))return!0;for(let e of Jke)if(yJ(Rv(t,e)))return!0;return!1}function _J(t="."){let e=Hl(t).coverage;return e||(Yke(t)?"kover":"jacoco")}function bJ(t="."){return EP[_J(t)]}function vJ(t="."){return $P[_J(t)]}var EP,$P,AP,hJ,Kke,Jke,Iv=y(()=>{"use strict";gp();EP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},$P={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},AP=[$P.kover,$P.jacoco],hJ=/kover/i;Kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Jke=["buildSrc","build-logic"]});import{existsSync as Gl,readFileSync as wJ,readdirSync as xJ}from"node:fs";import{join as $o}from"node:path";function RP(t){return Gl($o(t,"gradlew"))?"./gradlew":"gradle"}function Xke(t){let e=RP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[bJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Qke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(wJ($o(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function tEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function iEe(t,e){for(let r of e)if(Gl($o(t,r)))return r}function oEe(t,e){try{return xJ(t).find(n=>n.endsWith(e))}catch{return}}function uEe(t){try{return JSON.parse(wJ($o(t,"package.json"),"utf8"))}catch{return{}}}function yp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function SJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function dEe(t,e,r){if(r.madge!==void 0||lEe.some(o=>Gl($o(t,o))))return e;let i=[...e.args];return i.splice(i.length-1,0,"--exclude",cEe),{...e,args:i}}function fEe(t,e,r){if(yp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of sEe)if(n.configs.some(i=>Gl($o(t,i))))return n.gate;if(aEe.some(n=>Gl($o(t,n)))||r.eslintConfig!==void 0)return e}function mEe(t,e){return pEe.some(r=>Gl($o(t,r)))?!0:e.jest!==void 0}function hEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function OP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function gEe(t,e){let r=uEe(t),n=e.lint?fEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:dEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:OP(i,"lint"),s=yp(r,"test"),a=s?hEe(s):void 0;return s&&!a?(o=OP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...yp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&mEe(t,r)?{...o,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(a==="vitest"&&!yp(r,"coverage")&&!SJ(r,"@vitest/coverage-v8")&&!SJ(r,"@vitest/coverage-istanbul")?o=OP(o,"coverage"):a==="vitest"&&yp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of rEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=oEe(t,o):r=iEe(t,[o]),r)break;if(!r||e.requiresSource&&!tEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?gEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return nEe}var Mi,eEe,rEe,nEe,sEe,aEe,cEe,lEe,pEe,an=y(()=>{"use strict";Iv();Mi=["--offline","--no-install"];eEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);rEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Mi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Mi,"eslint","."]},test:{cmd:"npx",args:[...Mi,"vitest","run"]},coverage:{cmd:"npx",args:[...Mi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Mi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Mi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:Xke},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Qke}],nEe={language:"unknown",manifest:"",gates:{}};sEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Mi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Mi,"oxlint"]}}],aEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],cEe="^(dist|build|out|coverage|target|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/",lEe=[".madgerc",".madgerc.json",".madgerc.js",".madgerc.yaml",".madgerc.yml"];pEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as yEe,readFileSync as _Ee}from"node:fs";import{join as bEe}from"node:path";function za(t){return t.code==="ENOENT"}function Pv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return $J.test(o)||$J.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Zl(t,e){let r=bEe(t,"package.json");if(!yEe(r))return!1;try{return!!JSON.parse(_Ee(r,"utf8")).scripts?.[e]}catch{return!1}}var $J,Pn=y(()=>{"use strict";$J=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function vEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Cv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Cv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Pv(i,Cv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Cv,Ua,Dv=y(()=>{"use strict";Fr();an();Pn();Cv="ARCHITECTURE_VIOLATION";Ua={name:Cv,subprocess:!0,run:vEe}});function SEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Pv(i,Nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Nv,qa,jv=y(()=>{"use strict";Fr();an();Pn();Nv="HARDCODED_SECRET";qa={name:Nv,subprocess:!0,run:SEe}});import{existsSync as IP,readdirSync as kJ}from"node:fs";import{join as Mv}from"node:path";function xEe(t,e){let r=Mv(t,e.path);if(!IP(r))return!0;if(e.isDirectory)try{return kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function $Ee(t){let{cwd:e="."}=t,r=[];for(let i of wEe)xEe(e,i)&&r.push({detector:_p,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Mv(e,"spec.yaml");if(IP(n)){let i=AEe(n),o=i?null:kEe(e);if(i)r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:_p,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=EEe(e);s&&r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function kEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Mv(t,e);if(!IP(r))continue;let n;try{n=kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Oi(Mv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function EEe(t){try{return q(t),null}catch(e){return e.message}}function AEe(t){let e;try{e=Oi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var _p,wEe,EJ,AJ=y(()=>{"use strict";Ue();U_();_p="ABSENCE_OF_GOVERNANCE",wEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];EJ={name:_p,run:$Ee}});function Fv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function PP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Fv(r)==="while",o=OEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Fv(r)}'`}let n=TEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Fv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Fv(r)}'`:null}function REe(t,e){let r=PP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function TJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...REe(r,n));return e}var TEe,OEe,CP=y(()=>{"use strict";TEe={event:"when",state:"while",optional:"where",unwanted:"if"},OEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function IEe(t){let{cwd:e="."}=t;return ge(e,Lv,PEe)}function PEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Lv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of TJ(t.features))e.push({detector:Lv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Lv,OJ,RJ=y(()=>{"use strict";CP();wt();Lv="AC_DRIFT";OJ={name:Lv,run:IEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return PJ[n]??IJ}var CEe,DEe,NEe,IJ,jEe,MEe,PJ,FEe,CJ,Ba=y(()=>{"use strict";an();CEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,DEe=/^[ \t]*import\s+([\w.]+)/gm,NEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,IJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:CEe,importStyle:"relative"},jEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:DEe,importStyle:"dotted"},MEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:NEe,importStyle:"dotted"},PJ={typescript:IJ,kotlin:jEe,python:MEe},FEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],CJ=new Set([...Object.values(PJ).flatMap(t=>t?.extensions??[]),...FEe].map(t=>t.toLowerCase()))});import{existsSync as LEe,readFileSync as zEe,readdirSync as UEe,statSync as qEe}from"node:fs";import{join as NJ,relative as DJ}from"node:path";function BEe(t,e){if(!LEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=UEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=NJ(i,s),c;try{c=qEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function HEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function ZEe(t){return GEe.test(t)}function VEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>BEe(NJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=zEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ba();jJ="AI_HINTS_FORBIDDEN_PATTERN";GEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;MJ={name:jJ,run:VEe}});function WEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:LJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var LJ,zJ,UJ=y(()=>{"use strict";Ue();LJ="AC_DUPLICATE_WITHIN_FEATURE";zJ={name:LJ,run:WEe}});import{createRequire as KEe}from"module";import{basename as JEe,dirname as NP,normalize as YEe,relative as XEe,resolve as QEe,sep as HJ}from"path";import*as eAe from"fs";function tAe(t){let e=YEe(t);return e.length>1&&e[e.length-1]===HJ&&(e=e.substring(0,e.length-1)),e}function GJ(t,e){return t.replace(rAe,e)}function iAe(t){return t==="/"||nAe.test(t)}function DP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=QEe(t)),(n||o)&&(t=tAe(t)),t===".")return"";let s=t[t.length-1]!==i;return GJ(s?t+i:t,i)}function ZJ(t,e){return e+t}function oAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:GJ(XEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function sAe(t){return t}function aAe(t,e,r){return e+t+r}function cAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?oAe(t,e):n?ZJ:sAe}function lAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function uAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function mAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?uAe(t):lAe(t):n&&n.length?fAe:dAe:pAe}function vAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?bAe:r&&r.length?n?hAe:gAe:n?yAe:_Ae}function xAe(t){return t.group?wAe:SAe}function EAe(t){return t.group?$Ae:kAe}function OAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?TAe:AAe}function VJ(t,e,r){if(r.options.useRealPaths)return RAe(e,r);let n=NP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=NP(n)}return r.symlinks.set(t,e),i>1}function RAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function zv(t,e,r,n){e(t&&!n?t:null,r)}function LAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?IAe:NAe:n?e?PAe:FAe:i?e?DAe:MAe:e?CAe:jAe}function qAe(t){return t?UAe:zAe}function ZAe(t,e){return new Promise((r,n)=>{JJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function JJ(t,e,r){new KJ(t,e,r).start()}function VAe(t,e){return new KJ(t,e).start()}var qJ,rAe,nAe,dAe,fAe,pAe,hAe,gAe,yAe,_Ae,bAe,SAe,wAe,$Ae,kAe,AAe,TAe,IAe,PAe,CAe,DAe,NAe,jAe,MAe,FAe,WJ,zAe,UAe,BAe,HAe,GAe,KJ,BJ,YJ,XJ,QJ=y(()=>{qJ=KEe(import.meta.url);rAe=/[\\/]/g;nAe=/^[a-z]:[\\/]$/i;dAe=(t,e)=>{e.push(t||".")},fAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},pAe=()=>{};hAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},gAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},yAe=(t,e,r,n)=>{r.files++},_Ae=(t,e)=>{e.push(t)},bAe=()=>{};SAe=t=>t,wAe=()=>[""].slice(0,0);$Ae=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},kAe=()=>{};AAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&VJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},TAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&VJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};IAe=t=>t.counts,PAe=t=>t.groups,CAe=t=>t.paths,DAe=t=>t.paths.slice(0,t.options.maxFiles),NAe=(t,e,r)=>(zv(e,r,t.counts,t.options.suppressErrors),null),jAe=(t,e,r)=>(zv(e,r,t.paths,t.options.suppressErrors),null),MAe=(t,e,r)=>(zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),FAe=(t,e,r)=>(zv(e,r,t.groups,t.options.suppressErrors),null);WJ={withFileTypes:!0},zAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",WJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},UAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",WJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};BAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},HAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},GAe=class{aborted=!1;abort(){this.aborted=!0}},KJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=LAe(e,this.isSynchronous),this.root=DP(t,e),this.state={root:iAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new HAe,options:e,queue:new BAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new GAe,fs:e.fs||eAe},this.joinPath=cAe(this.root,e),this.pushDirectory=mAe(this.root,e),this.pushFile=vAe(e),this.getArray=xAe(e),this.groupFiles=EAe(e),this.resolveSymlink=OAe(e,this.isSynchronous),this.walkDirectory=qAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=DP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=JEe(_),x=DP(NP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};BJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return ZAe(this.root,this.options)}withCallback(t){JJ(this.root,this.options,t)}sync(){return VAe(this.root,this.options)}},YJ=null;try{qJ.resolve("picomatch"),YJ=qJ("picomatch")}catch{}XJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:HJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new BJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new BJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||YJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var bp=v(($dt,i8)=>{"use strict";var e8="[^\\\\/]",WAe="(?=.)",t8="[^/]",jP="(?:\\/|$)",r8="(?:^|\\/)",MP=`\\.{1,2}${jP}`,KAe="(?!\\.)",JAe=`(?!${r8}${MP})`,YAe=`(?!\\.{0,1}${jP})`,XAe=`(?!${MP})`,QAe="[^.\\/]",eTe=`${t8}*?`,tTe="/",n8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:WAe,QMARK:t8,END_ANCHOR:jP,DOTS_SLASH:MP,NO_DOT:KAe,NO_DOTS:JAe,NO_DOT_SLASH:YAe,NO_DOTS_SLASH:XAe,QMARK_NO_DOT:QAe,STAR:eTe,START_ANCHOR:r8,SEP:tTe},rTe={...n8,SLASH_LITERAL:"[\\\\/]",QMARK:e8,STAR:`${e8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},nTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};i8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:nTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?rTe:n8}}});var vp=v(Lr=>{"use strict";var{REGEX_BACKSLASH:iTe,REGEX_REMOVE_BACKSLASH:oTe,REGEX_SPECIAL_CHARS:sTe,REGEX_SPECIAL_CHARS_GLOBAL:aTe}=bp();Lr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Lr.hasRegexChars=t=>sTe.test(t);Lr.isRegexChar=t=>t.length===1&&Lr.hasRegexChars(t);Lr.escapeRegex=t=>t.replace(aTe,"\\$1");Lr.toPosixSlashes=t=>t.replace(iTe,"/");Lr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Lr.removeBackslashes=t=>t.replace(oTe,e=>e==="\\"?"":e);Lr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Lr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Lr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Lr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Lr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var f8=v((Edt,d8)=>{"use strict";var o8=vp(),{CHAR_ASTERISK:FP,CHAR_AT:cTe,CHAR_BACKWARD_SLASH:Sp,CHAR_COMMA:lTe,CHAR_DOT:LP,CHAR_EXCLAMATION_MARK:zP,CHAR_FORWARD_SLASH:u8,CHAR_LEFT_CURLY_BRACE:UP,CHAR_LEFT_PARENTHESES:qP,CHAR_LEFT_SQUARE_BRACKET:uTe,CHAR_PLUS:dTe,CHAR_QUESTION_MARK:s8,CHAR_RIGHT_CURLY_BRACE:fTe,CHAR_RIGHT_PARENTHESES:a8,CHAR_RIGHT_SQUARE_BRACKET:pTe}=bp(),c8=t=>t===u8||t===Sp,l8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},mTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&c8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=o8.removeBackslashes(P)),xe&&_===!0&&(xe=o8.removeBackslashes(xe)));let Pr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,c8(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var wp=bp(),cn=vp(),{MAX_LENGTH:Uv,POSIX_REGEX_SOURCE:hTe,REGEX_NON_SPECIAL_CHARS:gTe,REGEX_SPECIAL_CHARS_BACKREF:yTe,REPLACEMENTS:p8}=wp,_Te=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>cn.escapeRegex(i)).join("..")}return r},Vl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,m8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},bTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},h8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(bTe(e))return e.replace(/\\(.)/g,"$1")},vTe=t=>{let e=t.map(h8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},STe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=h8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?cn.escapeRegex(r[0]):`[${r.map(i=>cn.escapeRegex(i)).join("")}]`}*`},wTe=t=>{let e=0,r=t.trim(),n=BP(r);for(;n;)e++,r=n.body.trim(),n=BP(r);return e},xTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:wp.DEFAULT_MAX_EXTGLOB_RECURSION,n=m8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||vTe(n)))return{risky:!0};for(let i of n){let o=STe(i);if(o)return{risky:!0,safeOutput:o};if(wTe(i)>r)return{risky:!0}}return{risky:!1}},HP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=p8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=wp.globChars(r.windows),l=wp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=cn.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Pr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},lo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},$i=H=>{$[H]++,xe.push(H)},Qr=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},uo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;$i("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Wde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=xTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,ki=s[H.tokensIndex];ki.type="text",ki.value=ht,ki.output=lt||cn.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let ki=HP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${ki})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Qr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(yTe,(B,Oe,ut,zt,lt,ki)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):ki===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=cn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=hTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=cn.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){$i("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Vl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Wde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Qr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Vl("closing","]"));P=`\\${P}`}else $i("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Vl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Qr("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||cn.hasRegexChars(B))continue;let Oe=cn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){$i("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=_Te(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Qr("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){uo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){lo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=gTe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){uo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),ki=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!ki){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ei=t[$.index+4];if(Ei&&Ei!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Pr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Pr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ei=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ei})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Vl("closing","]"));$.output=cn.escapeLast($.output,"["),Qr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Vl("closing",")"));$.output=cn.escapeLast($.output,"("),Qr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Vl("closing","}"));$.output=cn.escapeLast($.output,"{"),Qr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};HP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=p8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=wp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=cn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};g8.exports=HP});var v8=v((Tdt,b8)=>{"use strict";var $Te=f8(),GP=y8(),_8=vp(),kTe=bp(),ETe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=ETe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?_8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(_8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):GP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>$Te(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=GP.fastpaths(t,e)),i.output||(i=GP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=kTe;b8.exports=Rt});var $8=v((Odt,x8)=>{"use strict";var S8=v8(),ATe=vp();function w8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:ATe.isWindows()}),S8(t,e,r)}Object.assign(w8,S8);x8.exports=w8});import{readdir as TTe,readdirSync as OTe,realpath as RTe,realpathSync as ITe,stat as PTe,statSync as CTe}from"fs";import{isAbsolute as DTe,posix as Ha,resolve as NTe}from"path";import{fileURLToPath as jTe}from"url";function LTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&FTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function qTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function T8(t){var e;let r=Wl.default.scan(t,BTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function KTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Wl.default.scan(t);return r.isGlob||r.negated}function xp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function O8(t){return typeof t=="string"?[t]:t??[]}function ZP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=WTe(o);s=DTe(s.replace(YTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=JTe.exec(s))===null||i===void 0?void 0:i[0],l=T8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ha.join(o,...d):o}return s}function XTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(ZP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(ZP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(ZP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function QTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=XTe(t,e,n);t.debug&&xp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(E8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Wl.default)(i.match,f),m=(0,Wl.default)(i.ignore,f),h=LTe(i.match,f),g=k8(r,d,o),b=o?g:k8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new XJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&xp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return xp(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&xp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&qTe(r,d)]}function eOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function rOe(t){let e={...tOe,...t};return e.cwd=(e.cwd instanceof URL?jTe(e.cwd):NTe(e.cwd)).replace(E8,"/"),e.ignore=O8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||TTe,readdirSync:e.fs.readdirSync||OTe,realpath:e.fs.realpath||RTe,realpathSync:e.fs.realpathSync||ITe,stat:e.fs.stat||PTe,statSync:e.fs.statSync||CTe}),e.debug&&xp("globbing with options:",e),e}function nOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=MTe(t)||typeof t=="string",i=O8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=rOe(n?e:t);return i.length>0?QTe(o,i):[]}function _s(t,e){let[r,n]=nOe(t,e);return r?eOe(r.sync(),n):[]}var Wl,MTe,E8,A8,FTe,zTe,UTe,BTe,HTe,GTe,ZTe,VTe,WTe,JTe,YTe,tOe,$p=y(()=>{QJ();Wl=St($8(),1),MTe=Array.isArray,E8=/\\/g,A8=process.platform==="win32",FTe=/^(\/?\.\.)+$/;zTe=/^[A-Z]:\/$/i,UTe=A8?t=>zTe.test(t):t=>t==="/";BTe={parts:!0};HTe=/(?t.replace(HTe,"\\$&"),VTe=t=>t.replace(GTe,"\\$&"),WTe=A8?VTe:ZTe;JTe=/^(\/?\.\.)+/,YTe=/\\(?=[()[\]{}!*+?@|])/g;tOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as kp,readFileSync as iOe,readdirSync as oOe,statSync as R8}from"node:fs";import{join as Ga}from"node:path";function sOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Fi(e,n),o=[],{layers:s,forbiddenImports:a}=VP(r);return(s.size>0||a.length>0)&&!kp(Ga(e,i.mainRoot))?[{detector:Ep,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(aOe(e,i,s,o),cOe(e,i,s,o)),a.length>0&&lOe(e,i,a,o),o)}function VP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function aOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of oOe(o)){let a=Ga(o,s);R8(a).isDirectory()&&(r.has(s)||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function cOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of r){let a=Ga(o,s);kp(a)&&R8(a).isDirectory()||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function lOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!kp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=iOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];uOe(p,s.to,e.importStyle)&&n.push({detector:Ep,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function uOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ep,I8,WP=y(()=>{"use strict";$p();Ue();Ba();Ep="ARCHITECTURE_FROM_SPEC";I8={name:Ep,run:sOe}});import{existsSync as dOe,readFileSync as fOe}from"node:fs";import{join as pOe}from"node:path";function hOe(t){let{cwd:e="."}=t,r=pOe(e,"spec/capabilities.yaml");if(!dOe(r))return[];let n;try{let u=fOe(r,"utf8"),d=P8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";P8=St(er(),1);Ue();qv="CAPABILITIES_FEATURE_MAPPING",mOe=8;C8={name:qv,run:hOe}});import{existsSync as gOe,readFileSync as yOe}from"node:fs";import{join as _Oe}from"node:path";function bOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function vOe(t){let{cwd:e="."}=t;return ge(e,KP,r=>SOe(r,e))}function SOe(t,e){let r=Fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=_Oe(e,o);if(!gOe(s))continue;let a=yOe(s,"utf8");bOe(a)||n.push({detector:KP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var KP,N8,j8=y(()=>{"use strict";Ba();wt();KP="CONVENTION_DRIFT";N8={name:KP,run:vOe}});import{existsSync as JP,readFileSync as M8}from"node:fs";import{join as Bv}from"node:path";function wOe(t){return JSON.parse(t).total?.lines?.pct??0}function F8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function kOe(t,e){if(!Av(dt(t).gates.coverage?.cmd))return null;let r;try{r=Tv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=AP.find(d=>JP(Bv(c.dir,d)));if(!l){s.push(c.path);continue}let u=F8(M8(Bv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=L8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function EOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=kOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Fi(e,r),i=dt(e).language==="kotlin"?AP.find(a=>JP(Bv(e,a)))??vJ(e):n.coverageSummary,o=Bv(e,i);if(!JP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=M8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?xOe(a):n.coverageFormat==="cobertura-xml"?$Oe(a):wOe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Hv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Hv}%`}]}var ko,Hv,z8,U8=y(()=>{"use strict";Ue();Iv();Ba();Ov();an();ko="COVERAGE_DROP",Hv=70;z8={name:ko,run:EOe}});import{existsSync as AOe}from"node:fs";import{join as TOe}from"node:path";function ROe(t){let{cwd:e="."}=t;return ge(e,Gv,r=>IOe(r,e))}function IOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Gv="DELIVERABLE_INTEGRITY",OOe=8;q8={name:Gv,run:ROe}});function POe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Zv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function COe(t){let e=POe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Zv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function DOe(t){let{cwd:e="."}=t;return ge(e,Zv,r=>COe(r))}var Zv,H8,G8=y(()=>{"use strict";wt();Zv="SMOKE_PROBE_DEMAND";H8={name:Zv,run:DOe}});function NOe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>jOe(r,e))}function jOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Vv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=V_(n,e,o);s.state!=="fresh"&&i.push({detector:Vv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Vv,Wv,YP=y(()=>{"use strict";wl();wt();Vv="STALE_ATTESTATION";Wv={name:Vv,run:NOe}});function MOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return FOe(r)}function FOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:Z8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var Z8,Kv,XP=y(()=>{"use strict";Ue();Z8="DEPENDENCY_CYCLE";Kv={name:Z8,run:MOe}});import{appendFileSync as LOe,existsSync as V8,mkdirSync as zOe,readFileSync as UOe}from"node:fs";import{dirname as qOe,join as BOe}from"node:path";function W8(t){return BOe(t,HOe,GOe)}function K8(t){return QP.add(t),()=>QP.delete(t)}function Za(t,e){let r=W8(t),n=qOe(r);V8(n)||zOe(n,{recursive:!0}),LOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of QP)try{i(t,e)}catch{}}function fr(t){let e=W8(t);if(!V8(e))return[];let r=UOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var HOe,GOe,QP,ln=y(()=>{"use strict";HOe=".cladding",GOe="audit.log.jsonl";QP=new Set});import{existsSync as ZOe}from"node:fs";import{join as VOe}from"node:path";function WOe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:eC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(ZOe(VOe(e,i.artifact))||n.push({detector:eC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var eC,J8,Y8=y(()=>{"use strict";ln();eC="EVIDENCE_MISMATCH";J8={name:eC,run:WOe}});import{existsSync as KOe,readFileSync as JOe}from"node:fs";import{join as YOe}from"node:path";function XOe(t){let e=YOe(t,t5);if(!KOe(e))return null;try{let n=((0,e5.parse)(JOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*Q8(t,e){for(let r of t??[])r.startsWith(X8)&&(yield{ref:r,name:r.slice(X8.length),field:e})}function QOe(t){let{cwd:e="."}=t,r=XOe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:tC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...Q8(s.evidence_refs,"evidence_refs"),...Q8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:tC,severity:"warn",path:t5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var e5,tC,X8,t5,r5,n5=y(()=>{"use strict";e5=St(er(),1);Ue();tC="FIXTURE_REFERENCE_INVALID",X8="fixture:",t5="conformance/fixtures.yaml";r5={name:tC,run:QOe}});import{existsSync as Kl,readFileSync as rC}from"node:fs";import{join as Va}from"node:path";function eRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Ap(t){if(!Kl(t))return null;try{return JSON.parse(rC(t,"utf8"))}catch{return null}}function tRe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(rC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=eRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function rRe(t,e){for(let r of i5){let n=Va(t,r.path);if(!Kl(n))continue;let i=Ap(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function nRe(t,e){let r=Ap(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of i5){let s=Va(t,o.path);if(!Kl(s))continue;let a=Ap(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(Kl(i)){let o=Ap(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function iRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function oRe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Kl(r)||!Kl(n))return;let i=iRe(rC(r,"utf8"));if(i.length===0)return;let s=Ap(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function sRe(t){let{cwd:e="."}=t,r=[];return tRe(e,r),oRe(e,r),rRe(e,r),nRe(e,r),r}var Eo,i5,o5,s5=y(()=>{"use strict";$p();Eo="HARNESS_INTEGRITY",i5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];o5={name:Eo,run:sRe}});import{existsSync as aRe,readFileSync as cRe}from"node:fs";import{join as lRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>pRe(r,e))}function fRe(t){let e=lRe(t,"spec/capabilities.yaml");if(!aRe(e))return!1;try{let r=a5.default.parse(cRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function pRe(t,e){let r=t.features.length;if(r{"use strict";a5=St(er(),1);wt();Jv="HOLLOW_GOVERNANCE",uRe=8;c5={name:Jv,run:dRe}});import{existsSync as u5,readFileSync as d5}from"node:fs";import{join as f5}from"node:path";function p5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function gRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function yRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function _Re(t){let e=f5(t,"README.md"),r=f5(t,"docs","dogfood","matrix.md");if(!u5(e)||!u5(r))return[];let n=p5(d5(e,"utf8"),mRe),i=p5(d5(r,"utf8"),hRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=yRe(a);if(c===null)continue;let l=i[s]??"not-run",u=gRe(l);u!==null&&c>u&&o.push({detector:m5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function bRe(t){let{cwd:e="."}=t;return _Re(e)}var m5,mRe,hRe,h5,g5=y(()=>{"use strict";m5="HOST_CLAIM_DRIFT",mRe=//,hRe=//;h5={name:m5,run:bRe}});function vRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return y5(r.features.map(i=>i.id),"feature","spec/features/",n),y5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function y5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:_5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var _5,b5,v5=y(()=>{"use strict";Ue();_5="ID_COLLISION";b5={name:_5,run:vRe}});import{existsSync as Tp,readFileSync as nC,readdirSync as iC,statSync as SRe,writeFileSync as w5}from"node:fs";import{join as Ao}from"node:path";function S5(t){if(!Tp(t))return 0;try{return iC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function wRe(t){if(!Tp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=iC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=SRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function xRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Tp(e))return 0;try{let r=Yv.default.parse(nC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=S5(Ao(t,"spec","features")),r=S5(Ao(t,"spec","scenarios")),n=xRe(t),i=wRe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Jl(t,e){let r=Ao(t,"spec.yaml");if(!Tp(r))return;let n=nC(r,"utf8"),i=$Re(n,e);i!==n&&w5(r,i)}function $Re(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`],s=d=>r===`\r @@ -271,51 +271,51 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function Wa(t="."){let e=Eo(t,"spec","features");if(!Tp(e))return!1;let r=[];for(let i of iC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Yv.parse)(nC(Eo(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function Wa(t="."){let e=Ao(t,"spec","features");if(!Tp(e))return!1;let r=[];for(let i of iC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Yv.parse)(nC(Ao(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return w5(Eo(t,"spec","index.yaml"),n,"utf8"),!0}var Yv,Op=y(()=>{"use strict";Yv=St(er(),1)});import{existsSync as x5,readFileSync as $5,readdirSync as wRe}from"node:fs";import{join as oC}from"node:path";function xRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=k5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return sC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...sC(e),{detector:Rp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of k5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Rp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...sC(e)),o}function sC(t){let e=oC(t,"spec","index.yaml"),r=oC(t,"spec","features");if(!x5(e)||!x5(r))return[];let n=new Map;try{for(let l of $5(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of wRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=$5(oC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Rp,k5,E5,A5=y(()=>{"use strict";Op();Ue();Rp="INVENTORY_DRIFT",k5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];E5={name:Rp,run:xRe}});import{existsSync as $Re,readFileSync as kRe}from"node:fs";import{join as ERe}from"node:path";function TRe(t){let{cwd:e="."}=t,r=ERe(e,"src","spec","schema.json"),n=[];if($Re(r)){let i;try{i=JSON.parse(kRe(r,"utf8"))}catch(o){n.push({detector:Ip,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of ARe)i.required?.includes(o)||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==T5&&n.push({detector:Ip,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${T5}'`})}catch{}return n}var Ip,ARe,T5,O5,R5=y(()=>{"use strict";Ue();Ip="META_INTEGRITY",ARe=["schema","project","features"],T5="0.1";O5={name:Ip,run:TRe}});function ORe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return I5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),I5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function I5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:P5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var P5,C5,D5=y(()=>{"use strict";Ue();P5="SLUG_CONFLICT";C5={name:P5,run:ORe}});function Jl(t){return t==="planned"||t==="in_progress"}var Xv=y(()=>{"use strict"});import{existsSync as RRe}from"node:fs";import{join as IRe}from"node:path";function PRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>CRe(r,e))}function CRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=IRe(e,i);RRe(o)||r.push(DRe(n.id,i,n.status))}return r}function DRe(t,e,r){return Jl(r)?{detector:Qv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Qv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Qv,eS,aC=y(()=>{"use strict";Xv();wt();Qv="MISSING_IMPLEMENTATION";eS={name:Qv,run:PRe}});function NRe(t){let{cwd:e="."}=t;return ge(e,cC,jRe)}function jRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:cC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var cC,tS,lC=y(()=>{"use strict";wt();cC="MISSING_TESTS";tS={name:cC,run:NRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as N5}from"node:path";function j5(t){if(MRe(t))try{return JSON.parse(FRe(t,"utf8"))}catch{return}}function qRe(t){let{cwd:e="."}=t,r=j5(N5(e,LRe)),n=j5(N5(e,zRe));if(!r||!n)return[{detector:uC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>URe&&i.push({detector:uC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var uC,LRe,zRe,URe,M5,F5=y(()=>{"use strict";uC="PERFORMANCE_DRIFT",LRe="perf/baseline.json",zRe="perf/current.json",URe=10;M5={name:uC,run:qRe}});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function ZRe(t){let{cwd:e="."}=t;return ge(e,dC,r=>WRe(r,e))}function VRe(t,e){return(t.modules??[]).some(r=>BRe(HRe(e,r)))}function WRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||VRe(s,e)||r.push(s.id);let n=GRe;if(r.length<=n)return[];let i=r.slice(0,L5).join(", "),o=r.length>L5?", \u2026":"";return[{detector:dC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var dC,GRe,L5,z5,U5=y(()=>{"use strict";wt();dC="PLANNED_BACKLOG",GRe=5,L5=8;z5={name:dC,run:ZRe}});import{existsSync as KRe,readFileSync as JRe}from"node:fs";import{join as YRe}from"node:path";function eIe(t){let{cwd:e="."}=t;return ge(e,fC,r=>tIe(r,e))}function tIe(t,e){if(t.features.lengthn.includes(i))?[{detector:fC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var fC,XRe,QRe,q5,B5=y(()=>{"use strict";wt();fC="PROJECT_CONTEXT_DRIFT",XRe=8,QRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];q5={name:fC,run:eIe}});function H5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:rS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function rIe(t){let{cwd:e="."}=t;return ge(e,rS,nIe)}function nIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...H5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:rS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...H5(e,n.features,`scenario ${n.id}.features`));return r}var rS,nS,pC=y(()=>{"use strict";wt();rS="REFERENCE_INTEGRITY";nS={name:rS,run:rIe}});function Pp(t=""){return new RegExp(iIe,t)}var iIe,mC=y(()=>{"use strict";iIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as oIe,readdirSync as sIe,readFileSync as aIe,statSync as cIe,writeFileSync as lIe}from"node:fs";import{dirname as uIe,join as Cp,normalize as dIe,relative as fIe}from"node:path";function yIe(t){let e=[];for(let r of t.matchAll(gIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Pp("g"))??[])e.push(n);return[...new Set(e)].sort()}function _Ie(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function G5(t){return t.split("\\").join("/")}function bIe(t){return pIe.some(e=>t===e||t.startsWith(`${e}/`))}function vIe(t){let e=Cp(t,"docs");if(!oIe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=sIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Cp(i,s),c;try{c=cIe(a)}catch{continue}let l=G5(fIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function SIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=dIe(Cp(uIe(t),e));return G5(r)}function Dp(t="."){let e=[];for(let r of vIe(t)){let n;try{n=aIe(Cp(t,r),"utf8")}catch{continue}let i=_Ie(n),o=yIe(i);if(bIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(mIe)?[]:i.match(Pp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(hIe)){let d=SIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function Z5(t="."){let e=Dp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return lIe(Cp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return w5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var Yv,Op=y(()=>{"use strict";Yv=St(er(),1)});import{existsSync as x5,readFileSync as $5,readdirSync as kRe}from"node:fs";import{join as oC}from"node:path";function ERe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=k5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return sC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...sC(e),{detector:Rp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of k5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Rp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...sC(e)),o}function sC(t){let e=oC(t,"spec","index.yaml"),r=oC(t,"spec","features");if(!x5(e)||!x5(r))return[];let n=new Map;try{for(let l of $5(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of kRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=$5(oC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Rp,k5,E5,A5=y(()=>{"use strict";Op();Ue();Rp="INVENTORY_DRIFT",k5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];E5={name:Rp,run:ERe}});import{existsSync as ARe,readFileSync as TRe}from"node:fs";import{join as ORe}from"node:path";function IRe(t){let{cwd:e="."}=t,r=ORe(e,"src","spec","schema.json"),n=[];if(ARe(r)){let i;try{i=JSON.parse(TRe(r,"utf8"))}catch(o){n.push({detector:Ip,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of RRe)i.required?.includes(o)||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==T5&&n.push({detector:Ip,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${T5}'`})}catch{}return n}var Ip,RRe,T5,O5,R5=y(()=>{"use strict";Ue();Ip="META_INTEGRITY",RRe=["schema","project","features"],T5="0.1";O5={name:Ip,run:IRe}});function PRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return I5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),I5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function I5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:P5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var P5,C5,D5=y(()=>{"use strict";Ue();P5="SLUG_CONFLICT";C5={name:P5,run:PRe}});function Yl(t){return t==="planned"||t==="in_progress"}var Xv=y(()=>{"use strict"});import{existsSync as CRe}from"node:fs";import{join as DRe}from"node:path";function NRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>jRe(r,e))}function jRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=DRe(e,i);CRe(o)||r.push(MRe(n.id,i,n.status))}return r}function MRe(t,e,r){return Yl(r)?{detector:Qv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Qv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Qv,eS,aC=y(()=>{"use strict";Xv();wt();Qv="MISSING_IMPLEMENTATION";eS={name:Qv,run:NRe}});function FRe(t){let{cwd:e="."}=t;return ge(e,cC,LRe)}function LRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:cC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var cC,tS,lC=y(()=>{"use strict";wt();cC="MISSING_TESTS";tS={name:cC,run:FRe}});import{existsSync as zRe,readFileSync as URe}from"node:fs";import{join as N5}from"node:path";function j5(t){if(zRe(t))try{return JSON.parse(URe(t,"utf8"))}catch{return}}function GRe(t){let{cwd:e="."}=t,r=j5(N5(e,qRe)),n=j5(N5(e,BRe));if(!r||!n)return[{detector:uC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>HRe&&i.push({detector:uC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var uC,qRe,BRe,HRe,M5,F5=y(()=>{"use strict";uC="PERFORMANCE_DRIFT",qRe="perf/baseline.json",BRe="perf/current.json",HRe=10;M5={name:uC,run:GRe}});import{existsSync as ZRe}from"node:fs";import{join as VRe}from"node:path";function KRe(t){let{cwd:e="."}=t;return ge(e,dC,r=>YRe(r,e))}function JRe(t,e){return(t.modules??[]).some(r=>ZRe(VRe(e,r)))}function YRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||JRe(s,e)||r.push(s.id);let n=WRe;if(r.length<=n)return[];let i=r.slice(0,L5).join(", "),o=r.length>L5?", \u2026":"";return[{detector:dC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var dC,WRe,L5,z5,U5=y(()=>{"use strict";wt();dC="PLANNED_BACKLOG",WRe=5,L5=8;z5={name:dC,run:KRe}});import{existsSync as XRe,readFileSync as QRe}from"node:fs";import{join as eIe}from"node:path";function nIe(t){let{cwd:e="."}=t;return ge(e,fC,r=>iIe(r,e))}function iIe(t,e){if(t.features.lengthn.includes(i))?[{detector:fC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var fC,tIe,rIe,q5,B5=y(()=>{"use strict";wt();fC="PROJECT_CONTEXT_DRIFT",tIe=8,rIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];q5={name:fC,run:nIe}});function H5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:rS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function oIe(t){let{cwd:e="."}=t;return ge(e,rS,sIe)}function sIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...H5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:rS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...H5(e,n.features,`scenario ${n.id}.features`));return r}var rS,nS,pC=y(()=>{"use strict";wt();rS="REFERENCE_INTEGRITY";nS={name:rS,run:oIe}});function Pp(t=""){return new RegExp(aIe,t)}var aIe,mC=y(()=>{"use strict";aIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as cIe,readdirSync as lIe,readFileSync as uIe,statSync as dIe,writeFileSync as fIe}from"node:fs";import{dirname as pIe,join as Cp,normalize as mIe,relative as hIe}from"node:path";function vIe(t){let e=[];for(let r of t.matchAll(bIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Pp("g"))??[])e.push(n);return[...new Set(e)].sort()}function SIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function G5(t){return t.split("\\").join("/")}function wIe(t){return gIe.some(e=>t===e||t.startsWith(`${e}/`))}function xIe(t){let e=Cp(t,"docs");if(!cIe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=lIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Cp(i,s),c;try{c=dIe(a)}catch{continue}let l=G5(hIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function $Ie(t,e){if(/^[a-z]+:/i.test(e))return null;let r=mIe(Cp(pIe(t),e));return G5(r)}function Dp(t="."){let e=[];for(let r of xIe(t)){let n;try{n=uIe(Cp(t,r),"utf8")}catch{continue}let i=SIe(n),o=vIe(i);if(wIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(yIe)?[]:i.match(Pp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(_Ie)){let d=$Ie(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function Z5(t="."){let e=Dp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return fIe(Cp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var pIe,mIe,hIe,gIe,iS=y(()=>{"use strict";mC();pIe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],mIe="clad-doc-links: ignore",hIe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,gIe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as wIe}from"node:fs";import{join as xIe}from"node:path";function $Ie(t){let{cwd:e="."}=t;return ge(e,oS,r=>kIe(r,e))}function kIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Dp(e).docs){for(let o of i.doc_links)wIe(xIe(e,o))||n.push({detector:oS,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:oS,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var oS,sS,hC=y(()=>{"use strict";iS();wt();oS="DOC_LINK_INTEGRITY";sS={name:oS,run:$Ie}});function EIe(t){let{cwd:e="."}=t;return ge(e,Np,r=>AIe(r))}function AIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=V5,o=t.project.onboarding_seeded===!0&&!i;r>=V5&&n.length===0&&e.push({detector:Np,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let a of n)(a.features??[]).length===0&&e.push({detector:Np,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Np,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Np,V5,W5,K5=y(()=>{"use strict";wt();Np="SCENARIO_COVERAGE",V5=8;W5={name:Np,run:EIe}});import{createHash as TIe}from"node:crypto";function OIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function jp(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??J5),sample:OIe(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(J5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Mp(t){return(t.features??[]).filter(e=>e.status==="done").length}function RIe(t,e){return e<=0?!1:e>=1?!0:parseInt(TIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var J5,aS=y(()=>{"use strict";J5=["unwanted"]});import{chmodSync as IIe,existsSync as X5,readFileSync as PIe,readdirSync as CIe,statSync as Q5,unlinkSync as DIe,utimesSync as NIe,writeFileSync as jIe}from"node:fs";import{join as eY}from"node:path";import tY from"node:process";function MIe(t){return dJ(t).map(e=>{try{let r=Q5(e);return r.isFile()?{path:e,body:PIe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function FIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!X5(r.path))continue;if(!Q5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}DIe(r.path);continue}jIe(r.path,r.body),r.mode!==void 0&&IIe(r.path,r.mode),r.atime&&r.mtime&&NIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function LIe(t){let e=!1,r=n=>{for(let i of CIe(n,{withFileTypes:!0})){if(e)return;let o=eY(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function gC(t={}){let{cwd:e="."}=t,r=eY(e,vs);if(!X5(r)||!LIe(r))return{stage:Ka,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${vs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Ka,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=MIe(e)}catch(d){return{stage:Ka,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,vs];try{s=We(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=FIe(o);if(l.length>0)return{stage:Ka,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Ka,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=Nt(Ka,i.cmd,s,c);return u||Yt(Ka,s)}var Ka,vs,zIe,yC=y(()=>{"use strict";Fr();an();hp();Pn();Ka="stage_2.3",vs="tests/oracle";zIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tY.argv[1]}`;if(zIe){let t=gC();console.log(JSON.stringify(t)),tY.exit(t.exitCode)}});import{existsSync as UIe}from"node:fs";import{join as qIe}from"node:path";function BIe(t){let{cwd:e="."}=t;return ge(e,ii,r=>HIe(r,e))}function HIe(t,e){let r=[],n=jp(t.project,Mp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?fr(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Fp(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:ii,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${vs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!UIe(qIe(e,f))){r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${vs}/`)||r.push({detector:ii,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${vs}/ \u2014 stage_2.3 only runs ${vs}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ii,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:ii,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:ii,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var ii,rY,nY=y(()=>{"use strict";ln();aS();yC();wt();ii="SPEC_CONFORMANCE";rY={name:ii,run:BIe}});function GIe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:_C,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>iY&&i.push({detector:_C,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${iY})`})}return i}var _C,iY,oY,sY=y(()=>{"use strict";ln();_C="STALE_EVIDENCE",iY=90;oY={name:_C,run:GIe}});import{existsSync as aY}from"node:fs";import{join as cY}from"node:path";function ZIe(t){let{cwd:e="."}=t;return ge(e,Yl,r=>VIe(r,e))}function VIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Yl,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Yl,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>aY(cY(e,o)));i.length>0&&r.push({detector:Yl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Jl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>aY(cY(e,i)))&&r.push({detector:Yl,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var Yl,cS,bC=y(()=>{"use strict";Xv();wt();Yl="STALE_SPECIFICATION";cS={name:Yl,run:ZIe}});import{existsSync as lY,statSync as uY}from"node:fs";import{join as dY}from"node:path";function KIe(t,e){let r=0;for(let n of e){let i=dY(t,n);if(!lY(i))continue;let o=uY(i).mtimeMs;o>r&&(r=o)}return r}function JIe(t){let{cwd:e="."}=t;return ge(e,vC,r=>YIe(r,e))}function YIe(t,e){let r=Fi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=KIe(e,n);if(i===0)return[];let o=_s([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=dY(e,a);if(!lY(c))continue;let l=uY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>WIe&&s.push({detector:vC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var vC,WIe,lS,SC=y(()=>{"use strict";$p();Ba();wt();vC="STALE_TESTS",WIe=30;lS={name:vC,run:JIe}});import{existsSync as XIe}from"node:fs";import{join as QIe}from"node:path";function ePe(t){let{cwd:e="."}=t;return ge(e,Lp,r=>tPe(r,e))}function tPe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:Lp,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!XIe(QIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Lp,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:Lp,severity:Jl(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var Lp,uS,wC=y(()=>{"use strict";Xv();wt();Lp="STATUS_DRIFT";uS={name:Lp,run:ePe}});function rPe(t){let{cwd:e="."}=t;return ge(e,dS,r=>nPe(r,e))}function nPe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:dS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:dS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var dS,fY,pY=y(()=>{"use strict";an();wt();dS="TECH_STACK_MISMATCH";fY={name:dS,run:rPe}});function aPe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function cPe(t){let{cwd:e="."}=t;return ge(e,xC,r=>lPe(r,e))}function lPe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=_s([...aPe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:xC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var xC,mY,iPe,oPe,sPe,fS,$C=y(()=>{"use strict";$p();WP();wt();xC="UNMAPPED_ARTIFACT",mY=["src/stages/**/*.ts","src/spec/**/*.ts"],iPe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},oPe={kotlin:"src/main/kotlin"},sPe=8;fS={name:xC,run:cPe}});import{existsSync as hY}from"node:fs";import{join as gY}from"node:path";function dPe(t){return uPe.some(e=>t.startsWith(e))}function fPe(t){let{cwd:e="."}=t;return ge(e,kC,r=>pPe(r,e))}function pPe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(dPe(o))continue;let s=o.split("#",1)[0];hY(gY(e,o))||s&&hY(gY(e,s))||r.push({detector:kC,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`)}`)}return o}function fte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as lqe}from"node:fs";import{dirname as uqe,join as Rj}from"node:path";import{fileURLToPath as dqe}from"node:url";var Ij=uqe(dqe(import.meta.url));function gte(t){for(let e of[Rj(Ij,"viewer",t),Rj(Ij,"..","graph","viewer",t),Rj(Ij,"..","..","dist","viewer",t)])try{return lqe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function yte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -901,21 +901,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}XP();hC();aC();lC();pC();YP();SC();wC();$C();EC();Qm();mC();Ue();var lqe=[tS,pS,eS,fS,nS,sS,Kv,uS,lS,Wv];function uqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Pp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Ux(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of lqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of uqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Pj();Ue();Ii();var fqe=new Set(["mermaid","dot","json","obsidian","html"]);function bte(t={}){try{let e=t.format??"mermaid";if(!fqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=wc(n,".");if(t.focus){let s=Nx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Dx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=hte(i);for(let[c,l]of a){let u=dqe(s,c);Cj(Nj(u),{recursive:!0}),Dj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=zx(i,Ux(i,"."));Cj(Nj(t.out),{recursive:!0}),Dj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?mte(i):r==="json"?Lx(i):pte(i);t.out?(Cj(Nj(t.out),{recursive:!0}),Dj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function vte(){try{let t=wc(q(),".");process.stdout.write(_te(qx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Qm();import{createServer as pqe}from"node:http";import{existsSync as mqe,watch as hqe}from"node:fs";import{join as gqe}from"node:path";Ue();Ii();function yqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}XP();hC();aC();lC();pC();YP();SC();wC();$C();EC();Qm();mC();Ue();var fqe=[tS,pS,eS,fS,nS,sS,Kv,uS,lS,Wv];function pqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Pp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Ux(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of fqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of pqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Pj();Ue();Ii();var hqe=new Set(["mermaid","dot","json","obsidian","html"]);function bte(t={}){try{let e=t.format??"mermaid";if(!hqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=wc(n,".");if(t.focus){let s=Nx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Dx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=hte(i);for(let[c,l]of a){let u=mqe(s,c);Cj(Nj(u),{recursive:!0}),Dj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=zx(i,Ux(i,"."));Cj(Nj(t.out),{recursive:!0}),Dj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?mte(i):r==="json"?Lx(i):pte(i);t.out?(Cj(Nj(t.out),{recursive:!0}),Dj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function vte(){try{let t=wc(q(),".");process.stdout.write(_te(qx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Qm();import{createServer as gqe}from"node:http";import{existsSync as yqe,watch as _qe}from"node:fs";import{join as bqe}from"node:path";Ue();Ii();function vqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=pqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=Lx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Ux(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected +`)}catch{r.delete(u)}},o=gqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=Lx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Ux(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected -`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=zx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=gqe(e,u);if(mqe(d))try{let f=hqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=zx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=bqe(e,u);if(yqe(d))try{let f=_qe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Ste(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await yqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var _qe=["stage_1.1","stage_2.1","stage_2.3"];function bqe(t){return(t.features??[]).filter(e=>e.status==="done")}function vqe(t,e){let r=bqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function wte(t,e){let r=[];for(let n of _qe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=vqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}kS();import xte from"node:process";function Sqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Bx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Sqe(n,t);i.pass||r.push(i)}return r}ln();var jj="stage_4.1";function Mj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:jj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Bx(r);if(n.length===0)return{stage:jj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:jj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var wqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xte.argv[1]}`;if(wqe){let t=Mj();console.log(JSON.stringify(t)),xte.exit(t.exitCode)}xl();import{randomBytes as xqe}from"node:crypto";import{unlinkSync as $qe}from"node:fs";import{tmpdir as kqe}from"node:os";import{join as Eqe,resolve as Fj}from"node:path";import Aqe from"node:process";var Br=null;function $te(t){Br={cwd:Fj(t),run:null,jsonFile:null}}function Lj(){return Br!==null}function zj(t,e){if(!Br||Br.cwd!==Fj(t))return null;if(Br.run)return Br.run;let r=Eqe(kqe(),`clad-shared-vitest-${Aqe.pid}-${xqe(6).toString("hex")}.json`);Br.jsonFile=r;let n=e(r);return Br.run={proc:n,jsonFile:r},Br.run}function kte(t){return!Br||Br.cwd!==Fj(t)?null:Br.run}function Uj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ete(){let t=Br?.jsonFile;if(Br=null,t)try{$qe(t)}catch{}}Fr();import Ate from"node:process";var Hx="stage_1.4";function qj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Hx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Hx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Hx,pass:!0,exitCode:0}:{stage:Hx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var Tqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ate.argv[1]}`;if(Tqe){let t=qj();console.log(JSON.stringify(t)),Ate.exit(t.exitCode)}Fr();import Tte from"node:process";eh();Pn();var Gx="stage_2.2";function Bj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Yi("coverage",t))}catch(c){return{stage:Gx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Gx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=kte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Gx,r,s,n);return a||Yt(Gx,s)}var Iqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tte.argv[1]}`;if(Iqe){let t=Bj();console.log(JSON.stringify(t)),Tte.exit(t.exitCode)}Up();Hj();Fr();an();Pn();import Rte from"node:process";var Wx="stage_3.2";function Gj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Wx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Gl(e,o[o.length-1]))return{stage:Wx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Wx,i,s,o);return a||Yt(Wx,s)}var Yqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(Yqe){let t=Gj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Fr();Ue();Pn();import{existsSync as Xqe}from"node:fs";import{resolve as Pte}from"node:path";import Cte from"node:process";var di="stage_2.4",Zj=5e3,Qqe=3e4;function Vj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:di,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return t4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:di,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:di,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Pte(e,r.path);if(!Xqe(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Zj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(di,r.path,c);if(l)return l;if(c.timedOut)return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:di,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Ite={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},e4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function t4e(t,e,r){let n=Math.min(e.length*Zj,Qqe),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(r4e(t,s,r))}return n4e(o)}function r4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Pte(t,a):a,u=Zj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function n4e(t){let e="skip";for(let o of t)Ite[o.disposition]>Ite[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${e4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:di,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:di,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var i4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(i4e){let t=Vj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}Fr();an();Pn();import Dte from"node:process";var Kx="stage_3.1";function Wj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Kx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Gl(e,o[o.length-1]))return{stage:Kx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Kx,i,s,o);return a||Yt(Kx,s)}var o4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Dte.argv[1]}`;if(o4e){let t=Wj();console.log(JSON.stringify(t)),Dte.exit(t.exitCode)}yC();Kj();Jj();Fr();Zx();import{randomBytes as f4e}from"node:crypto";import{unlinkSync as p4e}from"node:fs";import{tmpdir as m4e}from"node:os";import{join as h4e}from"node:path";import Xj from"node:process";eh();Pn();Ue();import{readFileSync as c4e}from"node:fs";import{resolve as Mte}from"node:path";function l4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Mte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function u4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function d4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=u4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Mte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Yj(t,e){try{let r=l4e(c4e(t,"utf8"));return r?d4e(q(e),r,e):[]}catch{return[]}}var Hr="stage_2.1";function Fte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Lte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function zte(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function g4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Fte(n,i))return null;let o=n,s=i,a=zj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Hr,n,c,s))return null;let u=Yt(Hr,c);if(Uj(u)==="fallback")return null;if(r){let d=Yj(l,e);if(d.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Hr,pass:!0,exitCode:0}}function y4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Lte(n,i))return null;let o=n,s=i,a=zj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Hr,o,a.proc,s))return null;let c=Yt(Hr,a.proc);if(Uj(c)==="fallback")return null;if(r&&zte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Hr,pass:!0,exitCode:0}}function Qj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Yi("test",t))}catch(d){return{stage:Hr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Hr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Fte(n,i),a=Lte(n,i),c=r&&s;if(Lj()&&s){let d=g4e(t,e,c);if(d)return d}if(Lj()&&a){let d=y4e(t,e);if(d)return d}let l,u=i;c&&(l=h4e(m4e(),`clad-vitest-${Xj.pid}-${f4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Hr,n,d,u);if(f)return f;let p=Du("unit",Yt(Hr,d),d);if(r&&p.pass&&zte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Yj(l,e);if(m.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{p4e(l)}catch{}}}var _4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xj.argv[1]}`;if(_4e){let t=Qj();console.log(JSON.stringify(t)),Xj.exit(t.exitCode)}Fr();an();Pn();import Ute from"node:process";var Xx="stage_3.3";function eM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Gl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var b4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ute.argv[1]}`;if(b4e){let t=eM();console.log(JSON.stringify(t)),Ute.exit(t.exitCode)}bC();zf();ba();rM();Op();iS();var Wte=St(er(),1);import{existsSync as nM,readFileSync as R4e,readdirSync as Vte,statSync as I4e,writeFileSync as P4e}from"node:fs";import{basename as oh,join as sh,relative as Zte}from"node:path";var C4e=["self-dogfood:","fixture:","derived:"],Kte=/\.(test|spec)\.[jt]sx?$/;function Jte(t,e=t,r=[]){let n;try{n=Vte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=sh(e,i);try{I4e(o).isDirectory()?Jte(t,o,r):Kte.test(i)&&r.push(o)}catch{continue}}return r}function Yte(t="."){let e=sh(t,"spec","features"),r=sh(t,"tests"),n=[],i=[];if(!nM(e)||!nM(r))return{repaired:n,suggested:i};let o=Jte(r),s=new Map;for(let a of o){let c=Zte(t,a).split("\\").join("/"),l=s.get(oh(a))??[];l.push(c),s.set(oh(a),l)}for(let a of Vte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=sh(e,a),l,u;try{l=R4e(c,"utf8"),u=(0,Wte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(C4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(nM(sh(t,b)))continue;let _=s.get(oh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>oh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Zte(t,h).split("\\").join("/")).find(h=>{let g=oh(h).replace(Kte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Ste(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await vqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Sqe=["stage_1.1","stage_2.1","stage_2.3"];function wqe(t){return(t.features??[]).filter(e=>e.status==="done")}function xqe(t,e){let r=wqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function wte(t,e){let r=[];for(let n of Sqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=xqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}kS();import xte from"node:process";function $qe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Bx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=$qe(n,t);i.pass||r.push(i)}return r}ln();var jj="stage_4.1";function Mj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:jj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Bx(r);if(n.length===0)return{stage:jj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:jj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var kqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xte.argv[1]}`;if(kqe){let t=Mj();console.log(JSON.stringify(t)),xte.exit(t.exitCode)}xl();import{randomBytes as Eqe}from"node:crypto";import{unlinkSync as Aqe}from"node:fs";import{tmpdir as Tqe}from"node:os";import{join as Oqe,resolve as Fj}from"node:path";import Rqe from"node:process";var Br=null;function $te(t){Br={cwd:Fj(t),run:null,jsonFile:null}}function Lj(){return Br!==null}function zj(t,e){if(!Br||Br.cwd!==Fj(t))return null;if(Br.run)return Br.run;let r=Oqe(Tqe(),`clad-shared-vitest-${Rqe.pid}-${Eqe(6).toString("hex")}.json`);Br.jsonFile=r;let n=e(r);return Br.run={proc:n,jsonFile:r},Br.run}function kte(t){return!Br||Br.cwd!==Fj(t)?null:Br.run}function Uj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ete(){let t=Br?.jsonFile;if(Br=null,t)try{Aqe(t)}catch{}}Fr();import Ate from"node:process";var Hx="stage_1.4";function qj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Hx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Hx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Hx,pass:!0,exitCode:0}:{stage:Hx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Iqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ate.argv[1]}`;if(Iqe){let t=qj();console.log(JSON.stringify(t)),Ate.exit(t.exitCode)}Fr();import Tte from"node:process";eh();Pn();var Gx="stage_2.2";function Bj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Yi("coverage",t))}catch(c){return{stage:Gx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Gx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=kte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Gx,r,s,n);return a||Yt(Gx,s)}var Dqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tte.argv[1]}`;if(Dqe){let t=Bj();console.log(JSON.stringify(t)),Tte.exit(t.exitCode)}Up();Hj();Fr();an();Pn();import Rte from"node:process";var Wx="stage_3.2";function Gj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Wx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Zl(e,o[o.length-1]))return{stage:Wx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Wx,i,s,o);return a||Yt(Wx,s)}var e4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(e4e){let t=Gj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Fr();Ue();Pn();import{existsSync as t4e}from"node:fs";import{resolve as Pte}from"node:path";import Cte from"node:process";var di="stage_2.4",Zj=5e3,r4e=3e4;function Vj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:di,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return i4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:di,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:di,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Pte(e,r.path);if(!t4e(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Zj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(di,r.path,c);if(l)return l;if(c.timedOut)return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:di,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Ite={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},n4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function i4e(t,e,r){let n=Math.min(e.length*Zj,r4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(o4e(t,s,r))}return s4e(o)}function o4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Pte(t,a):a,u=Zj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function s4e(t){let e="skip";for(let o of t)Ite[o.disposition]>Ite[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${n4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:di,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:di,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var a4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(a4e){let t=Vj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}Fr();an();Pn();import Dte from"node:process";var Kx="stage_3.1";function Wj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Kx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Zl(e,o[o.length-1]))return{stage:Kx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Kx,i,s,o);return a||Yt(Kx,s)}var c4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Dte.argv[1]}`;if(c4e){let t=Wj();console.log(JSON.stringify(t)),Dte.exit(t.exitCode)}yC();Kj();Jj();Fr();Zx();import{randomBytes as h4e}from"node:crypto";import{unlinkSync as g4e}from"node:fs";import{tmpdir as y4e}from"node:os";import{join as _4e}from"node:path";import Xj from"node:process";eh();Pn();Ue();import{readFileSync as d4e}from"node:fs";import{resolve as Mte}from"node:path";function f4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Mte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function p4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function m4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=p4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Mte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Yj(t,e){try{let r=f4e(d4e(t,"utf8"));return r?m4e(q(e),r,e):[]}catch{return[]}}var Hr="stage_2.1";function Fte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Lte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function zte(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function b4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Fte(n,i))return null;let o=n,s=i,a=zj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Hr,n,c,s))return null;let u=Yt(Hr,c);if(Uj(u)==="fallback")return null;if(r){let d=Yj(l,e);if(d.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Hr,pass:!0,exitCode:0}}function v4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Lte(n,i))return null;let o=n,s=i,a=zj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Hr,o,a.proc,s))return null;let c=Yt(Hr,a.proc);if(Uj(c)==="fallback")return null;if(r&&zte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Hr,pass:!0,exitCode:0}}function Qj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Yi("test",t))}catch(d){return{stage:Hr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Hr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Fte(n,i),a=Lte(n,i),c=r&&s;if(Lj()&&s){let d=b4e(t,e,c);if(d)return d}if(Lj()&&a){let d=v4e(t,e);if(d)return d}let l,u=i;c&&(l=_4e(y4e(),`clad-vitest-${Xj.pid}-${h4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Hr,n,d,u);if(f)return f;let p=Nu("unit",Yt(Hr,d),d);if(r&&p.pass&&zte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Yj(l,e);if(m.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{g4e(l)}catch{}}}var S4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xj.argv[1]}`;if(S4e){let t=Qj();console.log(JSON.stringify(t)),Xj.exit(t.exitCode)}Fr();an();Pn();import Ute from"node:process";var Xx="stage_3.3";function eM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Zl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var w4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ute.argv[1]}`;if(w4e){let t=eM();console.log(JSON.stringify(t)),Ute.exit(t.exitCode)}bC();Uf();ba();rM();Op();iS();var Wte=St(er(),1);import{existsSync as nM,readFileSync as C4e,readdirSync as Vte,statSync as D4e,writeFileSync as N4e}from"node:fs";import{basename as oh,join as sh,relative as Zte}from"node:path";var j4e=["self-dogfood:","fixture:","derived:"],Kte=/\.(test|spec)\.[jt]sx?$/;function Jte(t,e=t,r=[]){let n;try{n=Vte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=sh(e,i);try{D4e(o).isDirectory()?Jte(t,o,r):Kte.test(i)&&r.push(o)}catch{continue}}return r}function Yte(t="."){let e=sh(t,"spec","features"),r=sh(t,"tests"),n=[],i=[];if(!nM(e)||!nM(r))return{repaired:n,suggested:i};let o=Jte(r),s=new Map;for(let a of o){let c=Zte(t,a).split("\\").join("/"),l=s.get(oh(a))??[];l.push(c),s.set(oh(a),l)}for(let a of Vte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=sh(e,a),l,u;try{l=C4e(c,"utf8"),u=(0,Wte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(j4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(nM(sh(t,b)))continue;let _=s.get(oh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>oh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Zte(t,h).split("\\").join("/")).find(h=>{let g=oh(h).replace(Kte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&P4e(c,l,"utf8")}return{repaired:n,suggested:i}}wl();import{existsSync as D4e,readFileSync as N4e}from"node:fs";import{join as j4e}from"node:path";function M4e(t,e){let r=j4e(t,e);if(!D4e(r))return[];let n=[];for(let i of N4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Xte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>M4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Qte(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}aS();Ue();ln();Ii();ln();wl();var iM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],F4e=[...iM,"att"];function L4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Bx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function z4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":V_(e,r,t).state==="fresh"?"\u2713":"!"}function r0(t,e="."){let r=cs(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...iM.map(o=>L4e(i,o,e)),z4e(i,r,e)]}));return{columns:F4e,rows:n}}function ere(t,e=".",r={}){let n=r.internal??!1,i=r0(t,e),o=[...iM.map(c=>n?c.replace("stage_",""):U4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function U4e(t){return Ta(t).slice(0,3)}async function m5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(hde(),mde)),Promise.resolve().then(()=>(vde(),bde)),Promise.resolve().then(()=>(rm(),R7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ote(s),prepareInit:({cwd:s,mode:a,intent:c})=>nte(s,a,c),initialize:bj,prepareClarify:(s,{cwd:a})=>ite(a,s),clarify:xj,resolveReview:(s,{cwd:a})=>Qee(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function h5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await bj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&N4e(c,l,"utf8")}return{repaired:n,suggested:i}}wl();import{existsSync as M4e,readFileSync as F4e}from"node:fs";import{join as L4e}from"node:path";function z4e(t,e){let r=L4e(t,e);if(!M4e(r))return[];let n=[];for(let i of F4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Xte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>z4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Qte(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}aS();Ue();ln();Ii();ln();wl();var iM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],U4e=[...iM,"att"];function q4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Bx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function B4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":V_(e,r,t).state==="fresh"?"\u2713":"!"}function r0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...iM.map(o=>q4e(i,o,e)),B4e(i,r,e)]}));return{columns:U4e,rows:n}}function ere(t,e=".",r={}){let n=r.internal??!1,i=r0(t,e),o=[...iM.map(c=>n?c.replace("stage_",""):H4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function H4e(t){return Ta(t).slice(0,3)}async function y5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(hde(),mde)),Promise.resolve().then(()=>(vde(),bde)),Promise.resolve().then(()=>(rm(),R7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ote(s),prepareInit:({cwd:s,mode:a,intent:c})=>nte(s,a,c),initialize:bj,prepareClarify:(s,{cwd:a})=>ite(a,s),clarify:xj,resolveReview:(s,{cwd:a})=>Qee(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function _5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await bj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} `),G.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){G.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())G.stdout.write(` ${o+1}. ${s} @@ -926,32 +926,32 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&P4e(c,l,"u `),G.stdout.write(` e.g. clad init payment SaaS for B2B `),G.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));G.exit(0)}async function g5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Gde(),Hde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} +`));G.exit(0)}async function b5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Gde(),Hde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} `);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>lR(l,s)),c=`${bG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function y5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Kl(".",r),Wa("."),Z5(".");let n=iu(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Yte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=t0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=cS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function _5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=R_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function b5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=I_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}P_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function v5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Jl(".",r),Wa("."),Z5(".");let n=ou(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Yte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=t0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=cS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function S5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=R_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function w5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=I_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}P_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} `):G.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),G.exit(0)}async function v5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await XC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function S5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await e7(".",{wireHosts:async()=>(await XC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` +`),G.exit(0)}async function x5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await XC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function $5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await e7(".",{wireHosts:async()=>(await XC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),TA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var w5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function TA(t){let e=t.tier??"all",r=t.silent===!0,n=w5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>nh(i)],["stage_1.2",()=>rh(i)],["stage_1.3",()=>oi({...i,strict:t.strict})],["stage_1.4",qj],["stage_1.5",rc],["stage_1.6",Jp],["stage_2.1",()=>Qj({...i,strict:t.strict})],["stage_2.2",()=>Bj(i)],["stage_2.3",gC],["stage_2.4",Vj],["stage_3.1",Wj],["stage_3.2",Gj],["stage_3.3",eM],["stage_4.1",Mj],["stage_4.2",ih]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ci(d)?"fail":"skip",u=[];W_("."),$te(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=UX(p);ci(h)&&(c=!0,a=Math.max(a,qX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),ci(h)&&R5e(p))}}finally{J_(),Ete()}if(t.strict)try{let d=q();for(let f of wte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!ci(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>ci(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{BG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function x5e(t){try{let e=q(),r=ml(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} -`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function $5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} -`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function k5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=mS(e,o=>{try{return Vde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function E5e(t={}){try{if(t.sessions){cte(t);return}if(t.trend!==void 0&&t.trend!==!1){lte(t);return}let e=q(),n=FH(e,o=>{try{return Vde(o,"utf8")}catch{return null}},"."),i=zH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} +`),TA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var k5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function TA(t){let e=t.tier??"all",r=t.silent===!0,n=k5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>nh(i)],["stage_1.2",()=>rh(i)],["stage_1.3",()=>oi({...i,strict:t.strict})],["stage_1.4",qj],["stage_1.5",rc],["stage_1.6",Jp],["stage_2.1",()=>Qj({...i,strict:t.strict})],["stage_2.2",()=>Bj(i)],["stage_2.3",gC],["stage_2.4",Vj],["stage_3.1",Wj],["stage_3.2",Gj],["stage_3.3",eM],["stage_4.1",Mj],["stage_4.2",ih]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ci(d)?"fail":"skip",u=[];W_("."),$te(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=UX(p);ci(h)&&(c=!0,a=Math.max(a,qX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),ci(h)&&C5e(p))}}finally{J_(),Ete()}if(t.strict)try{let d=q();for(let f of wte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!ci(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>ci(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{BG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function E5e(t){try{let e=q(),r=ml(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} +`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function A5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} +`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function T5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=mS(e,o=>{try{return Vde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function O5e(t={}){try{if(t.sessions){cte(t);return}if(t.trend!==void 0&&t.trend!==!1){lte(t);return}let e=q(),n=FH(e,o=>{try{return Vde(o,"utf8")}catch{return null}},"."),i=zH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} `);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${hl}`];G.stdout.write(`${c.join(` `)} -`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function A5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=TA({...t,focusModules:e});if(!t.json){let n=SX(".");n&&G.stdout.write(`\u2139 ${n} -`)}G.exitCode=r.worst}function T5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=dX(".",t,{checkStages:TA,onIndex:Wa,gitOpInProgress:OO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function O5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function R5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=TA({...t,focusModules:e});if(!t.json){let n=SX(".");n&&G.stdout.write(`\u2139 ${n} +`)}G.exitCode=r.worst}function I5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=dX(".",t,{checkStages:TA,onIndex:Wa,gitOpInProgress:OO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function P5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') `);let o=Y5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),G.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";G.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}G.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. `),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Xte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${Qte(i)} -`),G.exit(0)}function R5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Zde(vl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] +`),G.exit(0)}function C5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Zde(vl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&G.stdout.write(` \u2026 and ${n.length-3} more finding(s) `),t.hint&&G.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` `).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Zde(e.trim(),160)} -`)}}function Zde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function I5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(r0(e,"."),null,2)} +`)}}function Zde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function D5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(r0(e,"."),null,2)} `),G.exitCode=0;return}G.stdout.write(`${ere(e,".",{internal:t.internal})} -`),G.exit(0)}function P5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function C5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=r0(i,e),s={gitHead:Sa(e),version:eu(),generatedAt:t.now??new Date().toISOString()},a=_l(i),c;try{let l=t.since??rs(e),u=ns(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:gl(u),auditMarkdown:yl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{p5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${P5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function D5e(t){let e=VA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function N5e(){let t=new T4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(h5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(g5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(y5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(v5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(S5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(A5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(_5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(T5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>O5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(b5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(I5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(x5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>$5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>KX(r,{checkStages:TA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>k5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>E5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>bte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>vte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Ste(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>_G(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>PY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>C5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(D5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(zX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(m5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){aX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}NY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(rte),t}var j5e=!!globalThis.__CLADDING_BUNDLED,M5e=j5e||import.meta.url===`file://${G.argv[1]}`;M5e&&N5e().parse();export{w5e as TIER_STAGES,N5e as createProgram,C5e as runBundleCommand,A5e as runCheckCommand,TA as runCheckStages,_5e as runCheckpointCommand,x5e as runContextCommand,T5e as runDoneCommand,$5e as runImpactCommand,k5e as runInferDepsCommand,h5e as runInitCommand,E5e as runMeasureCommand,O5e as runOracleCommand,b5e as runRollbackCommand,D5e as runRouteCommand,g5e as runRunCommand,m5e as runServeCommand,v5e as runSetupCommand,I5e as runStatusCommand,y5e as runSyncCommand,S5e as runUpdateCommand}; +`),G.exit(0)}function N5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function j5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=r0(i,e),s={gitHead:Sa(e),version:tu(),generatedAt:t.now??new Date().toISOString()},a=_l(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:gl(u),auditMarkdown:yl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{g5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${N5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function M5e(t){let e=VA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function F5e(){let t=new T4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(_5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(b5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(v5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(x5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action($5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(R5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(S5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(I5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>P5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(w5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(D5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(E5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>A5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>KX(r,{checkStages:TA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>T5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>O5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>bte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>vte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Ste(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>_G(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>PY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>j5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(M5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(zX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(y5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){aX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}NY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(rte),t}var L5e=!!globalThis.__CLADDING_BUNDLED,z5e=L5e||import.meta.url===`file://${G.argv[1]}`;z5e&&F5e().parse();export{k5e as TIER_STAGES,F5e as createProgram,j5e as runBundleCommand,R5e as runCheckCommand,TA as runCheckStages,S5e as runCheckpointCommand,E5e as runContextCommand,I5e as runDoneCommand,A5e as runImpactCommand,T5e as runInferDepsCommand,_5e as runInitCommand,O5e as runMeasureCommand,P5e as runOracleCommand,w5e as runRollbackCommand,M5e as runRouteCommand,b5e as runRunCommand,y5e as runServeCommand,x5e as runSetupCommand,D5e as runStatusCommand,v5e as runSyncCommand,$5e as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index a3f88d8b..149945fa 100644 --- a/spec.yaml +++ b/spec.yaml @@ -54,7 +54,7 @@ project: # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 272 + features: 273 scenarios: 2 capabilities: 6 test_files: 249 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 8a426873..be1e05f5 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -20,12 +20,12 @@ attested_modules: CHANGELOG.md: 033d721cd4fe05a4 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 56adb19dd6f4f7b0 - README.ja.md: 28eddff1f60c71c1 - README.ko.html: 23a412d68e7affbd - README.ko.md: 5dacfa067b26329a - README.md: f6c11815b54592e6 - README.zh.md: 61771611b221bf71 + README.html: 5aaa96fa216831d0 + README.ja.md: 3036dfcef2fced96 + README.ko.html: 8b0f541247c0c493 + README.ko.md: a3bb75415567217d + README.md: 40ed53a88b561247 + README.zh.md: f86fadac147c0613 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -117,7 +117,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: 7a38d9f04c46dd69 + spec.yaml: a4b96c80076cda52 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -317,7 +317,7 @@ attested_modules: src/stages/spec-conformance.ts: 1e9b052a2a268d7a src/stages/test-run-cache.ts: 462a5ef1d30eb766 src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e - src/stages/toolchain/detect.ts: 36d4947e5567bd5f + src/stages/toolchain/detect.ts: 630d123781c6d49c src/stages/toolchain/gate-config.ts: 818a0a549d875581 src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 @@ -425,7 +425,7 @@ attested_modules: tests/stages/stale-tests.test.ts: 1467ceedb8019e86 tests/stages/status-drift.test.ts: cff1092eeb23c268 tests/stages/tech-stack-mismatch.test.ts: 878436ffd2f94c97 - tests/stages/toolchain.test.ts: 04e12be4ac1dee5c + tests/stages/toolchain.test.ts: e5b26494c00782f5 tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 @@ -548,6 +548,7 @@ attested_features: F-284be4f6: ok F-288864ae: ok F-2be3e3bb: ok + F-2c02991f: ok F-2de65d: ok F-2e28cc72: ok F-315fd7: ok diff --git a/spec/features/arch-gate-skips-build-output-2c02991f.yaml b/spec/features/arch-gate-skips-build-output-2c02991f.yaml new file mode 100644 index 00000000..6b5d0158 --- /dev/null +++ b/spec/features/arch-gate-skips-build-output-2c02991f.yaml @@ -0,0 +1,35 @@ +id: F-2c02991f +slug: arch-gate-skips-build-output +title: "The architecture gate scans source, not build output" +status: done +modules: + - src/stages/toolchain/detect.ts +acceptance_criteria: + - id: AC-caa9471d + ears: event + condition: "when the TypeScript or JavaScript architecture gate is composed for a project" + text: "When the TypeScript or JavaScript architecture gate is composed for a project, then the system shall exclude generated build-output directories from the circular-dependency scan." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: a bundler's output legitimately contains mutual imports, so scanning it reports cycles that exist in no hand-written file. Measured on a live adopter: five recorded hard-blocking gate failures, all five inside a version-ignored bundle — 100% false with respect to source. The adopter's recorded root cause was wrong and the issue stayed open for sixteen days. A second adopter reproduces the same shape today, four for four." + - id: AC-554d9436 + ears: unwanted + condition: "if the project declares its own dependency-scanner configuration" + text: "If the project declares its own dependency-scanner configuration, then the system shall not pass its own exclusion, leaving the project's rules in force." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: the scanner REPLACES its configured exclusions with the command-line flag rather than merging them. Passing ours unconditionally would silently delete an adopter's own rules — including the workaround one adopter is currently relying on, which they discovered alone and buried in an unrelated commit." + - id: AC-c04171bd + ears: ubiquitous + text: "The system shall keep the repository root as the scan root, so a project whose layout has no conventional source directory is scanned rather than silently skipped." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: narrowing the root to a named directory was measured to be worse than the defect it fixes. A missing root makes the scanner exit with a file-not-found error, which the harness classifies as a setup gap and reports as advisory — so the whole stage skips and the gate goes green having checked nothing. One adopter's front-end has exactly that layout. Trading a loud false failure for a silent pass is a mistake this project has already made once." + - id: AC-dd5c3abf + ears: event + condition: "when a circular dependency exists among hand-written source files" + text: "When a circular dependency exists among hand-written source files, then the system shall still report it after the exclusion is applied." + test_refs: ["tests/stages/toolchain.test.ts"] + notes: "WHY: this change may only remove findings, never hide a real one. Measured before implementing: the excluded files pull ninety-four further files transitively and contain zero source-level cycles, so the measured false-negative count is zero — but that is a property of three repositories, not a proof, so it is pinned as a requirement." +design_impact: + classification: none + rationale: "Corrects which files an existing gate scans. No new capability, no architecture change, no project-context change, no schema field — the gate, its severity, and its exit contract are untouched." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index 5ef0feaf..376866d5 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -114,6 +114,7 @@ features: F-284be4f6: {slug: init-empty-layers-valid-yaml, status: done, modules: 1} F-288864ae: {slug: claude-md-diet, status: done, modules: 2} F-2be3e3bb: {slug: infer-depends-on, status: done, modules: 2} + F-2c02991f: {slug: arch-gate-skips-build-output, status: done, modules: 1} F-2de65d: {slug: drive-auto-rollback, status: done, modules: 1} F-2e28cc72: {slug: clad-verdict, status: done, modules: 2} F-315fd7: {slug: scenario-coverage-detector, status: done, modules: 2} diff --git a/src/stages/toolchain/detect.ts b/src/stages/toolchain/detect.ts index a52a3a5b..862c25e6 100644 --- a/src/stages/toolchain/detect.ts +++ b/src/stages/toolchain/detect.ts @@ -46,6 +46,7 @@ interface PackageManifest { readonly peerDependencies?: Readonly>; readonly eslintConfig?: unknown; readonly jest?: unknown; + readonly madge?: unknown; } /** npx must resolve only already-installed/cacheable tools and never touch the network. */ @@ -364,6 +365,27 @@ const ESLINT_CONFIGS: readonly string[] = [ '.eslintrc.yml', ]; +/** + * Generated build output, excluded from the circular-dependency scan (AC-caa9471d). + * + * A bundler's output legitimately contains mutual imports — that is what bundling + * produces — so scanning it reports cycles that exist in no hand-written file. On one + * adopter this blocked the gate five times, every one of them inside a version-ignored + * bundle; the recorded root cause was wrong and the issue stayed open for sixteen days. + * + * Anchored at the repository root (`^`) so a source directory that merely happens to be + * named `build/` deeper in the tree is still scanned. + */ +const BUILD_OUTPUT_EXCLUDE = + '^(dist|build|out|coverage|target|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/'; + +/** + * Files that mean "this project configures the dependency scanner itself". + * `rc` resolves `.madgerc` and its typed variants; `package.json#madge` is the + * inline form. + */ +const MADGE_CONFIGS: readonly string[] = ['.madgerc', '.madgerc.json', '.madgerc.js', '.madgerc.yaml', '.madgerc.yml']; + /** Reads package.json once for gate refinement; malformed input declares nothing. */ function readPackageManifest(cwd: string): PackageManifest { try { @@ -385,6 +407,32 @@ function hasPackageDependency(pkg: PackageManifest, name: string): boolean { .some((group) => group?.[name] !== undefined); } +/** + * The TS/JS architecture gate, with build output excluded unless the project + * configures the scanner itself (AC-caa9471d, AC-554d9436). + * + * The guard is not politeness — madge REPLACES its configured `excludeRegExp` + * with the command-line flag rather than merging the two. Passing ours + * unconditionally would silently delete an adopter's own rules, including the + * workaround one adopter is currently relying on. When they have declared + * nothing we supply the default; when they have, we stay out of the way. + * + * The scan ROOT is deliberately left at `.` (AC-c04171bd): narrowing it to a + * named source directory was measured to be worse than the defect it fixes — + * a missing root makes madge exit with ENOENT, which classifies as a scanner + * setup gap (advisory), so the whole stage skips and the gate goes green having + * checked nothing. + */ +function resolveTsArch(cwd: string, base: ToolSpec, pkg: PackageManifest): ToolSpec { + const projectConfigures = + pkg.madge !== undefined || MADGE_CONFIGS.some((c) => existsSync(join(cwd, c))); + if (projectConfigures) return base; + const args = [...base.args]; + // Before the trailing scan root, so the root stays last as madge expects. + args.splice(args.length - 1, 0, '--exclude', BUILD_OUTPUT_EXCLUDE); + return {...base, args}; +} + /** The project's declared TS/JS lint gate, or undefined when lint is unconfigured. */ function resolveTsLint(cwd: string, eslintDefault: ToolSpec, pkg: PackageManifest): ToolSpec | undefined { if (packageScript(pkg, 'lint')) return {cmd: 'npm', args: ['run', '--silent', 'lint']}; @@ -455,7 +503,10 @@ function withoutGate(base: ToolchainGates, gate: 'lint' | 'coverage'): Toolchain function resolveTsGates(cwd: string, base: ToolchainGates): ToolchainGates { const pkg = readPackageManifest(cwd); const lint = base.lint ? resolveTsLint(cwd, base.lint, pkg) : undefined; - let out: ToolchainGates = lint ? {...base, lint} : withoutGate(base, 'lint'); + const withArch: ToolchainGates = base.arch + ? {...base, arch: resolveTsArch(cwd, base.arch, pkg)} + : base; + let out: ToolchainGates = lint ? {...withArch, lint} : withoutGate(withArch, 'lint'); const testScript = packageScript(pkg, 'test'); const runner = testScript ? simpleTestRunner(testScript) : undefined; diff --git a/tests/stages/toolchain.test.ts b/tests/stages/toolchain.test.ts index 59fecb89..f09ceaeb 100644 --- a/tests/stages/toolchain.test.ts +++ b/tests/stages/toolchain.test.ts @@ -277,7 +277,85 @@ describe('detectToolchain', () => { test('typescript arch gate scans ts,tsx,js,jsx extensions', () => { writeFileSync(join(dir, 'package.json'), '{}'); - expect(detectToolchain(dir).gates.arch).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'madge', '--circular', '--extensions', 'ts,tsx,js,jsx', '.']}); + expect(detectToolchain(dir).gates.arch).toEqual({ + cmd: 'npx', + args: [ + '--offline', '--no-install', 'madge', '--circular', + '--extensions', 'ts,tsx,js,jsx', + '--exclude', '^(dist|build|out|coverage|target|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/', + '.', + ], + }); + }); + + // ─── Architecture gate scans source, not build output (F-2c02991f) ─── + + /** The exclusion the arch gate carries, read back off the composed gate. */ + function archExclude(cwd: string): string | undefined { + const args = detectToolchain(cwd).gates.arch?.args ?? []; + const i = args.indexOf('--exclude'); + return i >= 0 ? args[i + 1] : undefined; + } + + test('AC-caa9471d · build output is excluded from the circular-dependency scan', () => { + writeFileSync(join(dir, 'package.json'), '{}'); + const pattern = archExclude(dir); + expect(pattern).toBeDefined(); + const re = new RegExp(pattern!); + // A bundler's output legitimately contains mutual imports; scanning it + // reported cycles that exist in no hand-written file. + for (const generated of [ + 'dist/index.js', 'build/main.js', 'out/app.js', 'coverage/lcov-report/x.js', + 'target/classes/a.js', '.next/server/page.js', '.nuxt/dist/client.js', + '.output/server/index.mjs', '.svelte-kit/output/x.js', '.vite/deps/chunk.js', + ]) { + expect(re.test(generated), `${generated} should be excluded`).toBe(true); + } + }); + + test('AC-dd5c3abf · hand-written source stays in scan, so a real cycle is still reported', () => { + writeFileSync(join(dir, 'package.json'), '{}'); + const re = new RegExp(archExclude(dir)!); + for (const source of [ + 'src/index.ts', 'tests/unit.test.ts', 'lib/util.ts', 'app/page.tsx', + 'packages/core/src/a.ts', 'backend/api/main.ts', + // Anchored at the repository root: a SOURCE directory that merely happens + // to be named build/ or dist/ deeper in the tree must keep being scanned. + 'src/build/compile.ts', 'app/dist/renderer.ts', 'packages/out/index.ts', + ]) { + expect(re.test(source), `${source} must NOT be excluded`).toBe(false); + } + }); + + test('AC-554d9436 · a project that configures the scanner itself keeps its own rules', () => { + // madge REPLACES its configured excludeRegExp with the command-line flag + // rather than merging, so passing ours would silently delete theirs. + for (const config of ['.madgerc', '.madgerc.json', '.madgerc.js', '.madgerc.yaml', '.madgerc.yml']) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, config), '{"excludeRegExp": ["^vendor/"]}'); + expect(detectToolchain(own).gates.arch?.args, config).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + test('AC-554d9436 · an inline package.json madge block also wins', () => { + writeFileSync(join(dir, 'package.json'), JSON.stringify({madge: {excludeRegExp: ['^vendor/']}})); + expect(detectToolchain(dir).gates.arch?.args).not.toContain('--exclude'); + }); + + test('AC-c04171bd · the scan root stays the repository root, never a named directory', () => { + // Narrowing the root is worse than the defect: a missing directory makes + // madge exit ENOENT, which classifies as a scanner setup gap and skips the + // whole stage — a green gate that checked nothing. + writeFileSync(join(dir, 'package.json'), '{}'); + const args = detectToolchain(dir).gates.arch?.args ?? []; + expect(args.at(-1)).toBe('.'); + expect(args).not.toContain('src'); + expect(args.filter((a) => a === '.')).toHaveLength(1); }); // ─── Swift (SPM) + Flutter/Dart toolchain (F-e4159959) ─── From 2a740d397b920931cec8be635eb02455aba6506b Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Mon, 3 Aug 2026 13:03:22 +0900 Subject: [PATCH 3/8] fix(report): correct the packet's claims about itself, and name what it audited against MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two features that shipped on this branch left four false statements behind — three of them printed to users, one of them a shipped acceptance criterion. The irony is the point: the feature built to expose contract drift caused contract drift, and its own commit never touched the entry it falsified. - AC-cbf1c202 of the review-packet feature says the report prints FOUR sections. It has printed six since 308b3e7. The criterion, `clad report --help`, and the doc comment on the function that assembles them all said four. No test caught it: they assert only that the original four are present and in order. - The packet anchors on the merge base of your ref and HEAD, then stamped the header and the JSON with the ref you typed. On a branch that forked earlier those are different commits — three apart on the corpus this was measured on — so an auditor reproducing by hand used a different base than the tool did, and the artifact never named the revision it audited against. Both are now stamped, and the markdown says so only when they differ. - The criterion-movement section asserted a rewrite is invisible "because the code was changed to match it". The population is deliberately status-blind, so that line also sat above entries with no code yet. It is now conditional. - The `planner` brief asked for an `archive_reason` when removing an acceptance criterion. That field exists only at feature level and the criterion schema refuses unknown keys, so following the instruction failed the sync barrier. Also: the six READMEs disagreed with the spec and, in two places, with themselves inside the same file — 308b3e7 corrected some numbers and not others, leaving a hero that said 266 of 270 above a record row that said 273 (269 done). Feature, done and test-file totals now match spec/index.yaml and the tests on disk. And the 0.9.3 changelog section, which GOVERNANCE.md §4.3 requires of every PR and the release ritual consumes by name. It carries the `.madgerc` override for the architecture-gate change: `package.json#files` ships no `docs/`, so for an npm adopter the changelog is the only file that can tell them. Verified: every claim above was reproduced before the fix and re-probed after — including the base stamp against a real 3-commit fork gap. 2783 tests green, `clad check --tier=pre-push --strict` exits 0. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 19 ++++++++ README.html | 12 ++--- README.ja.md | 8 ++-- README.ko.html | 12 ++--- README.ko.md | 8 ++-- README.md | 8 ++-- README.zh.md | 8 ++-- plugins/antigravity/skills/planner/SKILL.md | 2 +- plugins/claude-code/agents/planner.md | 2 +- plugins/claude-code/dist/agents/planner.md | 2 +- plugins/claude-code/dist/clad.js | 10 ++-- plugins/codex/skills/planner/SKILL.md | 2 +- spec/attestation.yaml | 26 +++++------ spec/features/pr-review-packet-f6cc5e5a.yaml | 6 +-- src/agents/planner.md | 2 +- src/cli/clad.ts | 11 +++-- src/cli/report.ts | 4 +- src/report/report.ts | 22 ++++++++- tests/report/report-cli.test.ts | 49 +++++++++++++++++++- tests/report/report.test.ts | 32 +++++++++++-- 20 files changed, 176 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01c82a82..fff1f577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to Cladding are documented here. Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). +## [0.9.3] — The review packet shows how the contract itself moved (unreleased) + +**In one line:** a pull request now shows which acceptance criteria were rewritten while the code changed, and the architecture gate stops failing on generated build output. + +### Added + +- **"How the acceptance criteria moved" in `clad report`.** For every feature spec entry the range touched, each criterion is classified new / rewritten / removed / unchanged by matching on its id, alongside the entry's status transition and any EARS pattern shift. Rewriting a requirement to match what you built leaves code and spec agreeing, so no drift check can see it; this is the surface that does. +- **"Declared tests" in `clad report`** — for each criterion, whether the test it names also changed in the range, distinguishing a real path that did not change from a placeholder the harness suggested. It grades nothing: whether a test genuinely verifies its criterion is not mechanically decidable, so the packet shows what was declared and leaves the judgement to the reviewer. +- **The packet names the revision it compared against.** The range anchors on the merge base of your ref and HEAD, which on a branch that forked earlier is not the tag you named — so both are now stamped in the header and the JSON. + +### Fixed + +- **The architecture gate no longer scans generated build output.** A bundler's output legitimately contains mutual imports, so scanning it reported circular dependencies that exist in no hand-written file — and blocked the gate on them. `dist`, `build`, `out`, `coverage`, `target`, `.next`, `.nuxt`, `.output`, `.svelte-kit` and `.vite` are now excluded, matched at the repository root only, so a source directory that merely happens to be named `build/` deeper in the tree is still scanned. **If your project declares its own `.madgerc` or a `madge` block in `package.json`, cladding passes no exclusion at all and your rules are the only ones in force** — madge replaces its configured exclusions with a command-line flag rather than merging them, so the two cannot coexist. +- **A review range that forked earlier no longer charges the base branch's commits to the range under review.** +- **The packet described itself as four sections when it renders six** — in `clad report --help`, in the module that assembles it, and in the acceptance criterion that enumerates them. The criterion appears as `REWRITTEN` in this release's own packet, which is the correct outcome. +- **A section lead asserted that the code had been changed to match a rewritten criterion.** The population is deliberately status-blind, so the line also sat above entries with no code yet; it is now conditional. +- **An instruction the schema rejects.** The `planner` brief asked for an `archive_reason` on a removed acceptance criterion, but that field exists only at feature level and the criterion schema refuses unknown keys — following the instruction failed the sync barrier. +- **Stale and self-contradicting counts across the six READMEs**, where feature and test-file totals disagreed with the spec and, in places, with each other inside the same file. + ## [0.9.2] — Completions record whether anything checked them independently (2026-07-26) **In one line:** every finished feature is now marked `independent` or `self-certified` from the evidence it actually recorded, and cladding stops prescribing how you arrange your agents. diff --git a/README.html b/README.html index f26b9d1c..57ab43fa 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -271,7 +271,7 @@

cladding

- cladding builds itself with cladding too — 266 of its 270 features cleared this same gate, the first L4 implementation of the Ironclad standard. + cladding builds itself with cladding too — 269 of its 273 features cleared this same gate, the first L4 implementation of the Ironclad standard.

@@ -566,7 +566,7 @@

Status

tests
-
2779/2779
+
2783/2783
all pass
@@ -576,13 +576,13 @@

Status

features
-
270
-
266 done · self-spec
+
273
+
269 done · self-spec
-

248 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector

+

249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector

Road to Ironclad 1.0 — 1.0 locks only when two independent implementations pass the L4 conformance fixtures (GOVERNANCE § 1). cladding is the first.
diff --git a/README.ja.md b/README.ja.md index eb543de0..9f8b11c3 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **たどれる** — **出荷されたものは記録に残る**: 何を検証したかはコミットされた内容に刻まれ、誰がいつやったかはローカルのセッション台帳に、なぜかは spec に残る — だから引き継ぎもレビューも、掘り起こさずに済む。 - **拡張しても揺るがない** — 人と AI が増えれば、普通は衝突と乖離も増える。だが全員が一つの spec を基準に働くので、それらは自動でせき止められる — だから規模を広げても崩れない。 -cladding は **自分自身も cladding で作っている** — 270 個の feature のうち 266 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 +cladding は **自分自身も cladding で作っている** — 273 個の feature のうち 269 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 @@ -347,9 +347,9 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 | 15 段階 · 41 detectors | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 | 15 段階 · 41 detectors | 273(269 done) | -248 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック +249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック > **Ironclad 1.0 への道** — 1.0 は *独立した二つの実装が L4 準拠フィクスチャを通過してはじめて* 確定する([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md))。cladding はその一つ目だ。 diff --git a/README.ko.html b/README.ko.html index 06b40fba..80f1f17b 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -304,7 +304,7 @@

cladding

- cladding은 자기 자신도 cladding으로 만든다 — 기능 270개 중 266개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다. + cladding은 자기 자신도 cladding으로 만든다 — 기능 273개 중 269개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다.

@@ -600,7 +600,7 @@

Status

tests
-
2779/2779
+
2783/2783
all pass
@@ -610,13 +610,13 @@

Status

features
-
270
-
266 done · 자기 스펙
+
273
+
269 done · 자기 스펙
-

248 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단

+

249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단

Ironclad 1.0까지의 길 — 1.0은 독립적인 두 개의 구현이 L4 검증 셋을 통과해야 잠긴다 (GOVERNANCE § 1). cladding이 첫 번째.
diff --git a/README.ko.md b/README.ko.md index 030ef196..8a8ea90d 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **추적** — **나간 것은 기록에 남는다**: 무엇을 검증했는지는 커밋된 내용에 새겨지고, 누가·언제는 로컬 세션 로그에, 왜는 스펙에 남아, 인수인계와 리뷰가 파헤치지 않아도 된다. - **확장** — 사람과 AI를 늘리면 보통 충돌과 어긋남도 함께 불어난다. 하지만 모두가 스펙 하나를 기준으로 일하니 그게 자동으로 걸린다 — 그래서 규모를 키워도 무너지지 않는다. -cladding은 **자기 자신도 cladding으로 만든다** — 기능 270개 중 266개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. +cladding은 **자기 자신도 cladding으로 만든다** — 기능 273개 중 269개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. @@ -346,9 +346,9 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | -248 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 +249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 > **Ironclad 1.0까지의 길** — 1.0은 *독립적인 두 개의 구현이 L4 검증 셋을 통과해야* 잠긴다 ([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md)). cladding이 첫 번째. diff --git a/README.md b/README.md index 074bb223..33e92d9b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ So you can ship AI-written code held to **the same standard as human-written cod - **Traced** — **What shipped is on the record**: what was verified is stamped into committed content, who and when land in the local session ledger, and the why lives in the spec — so handoff and review skip the archaeology. - **Scales** — adding people and AIs would normally multiply conflicts and drift; because everyone works from one shared spec, those get caught automatically — so you can grow without it breaking down. -cladding builds **itself** with cladding too — 266 of its 270 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. +cladding builds **itself** with cladding too — 269 of its 273 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. @@ -360,9 +360,9 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 | 15 stages · 41 detectors | 273 (269 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 | 15 stages · 41 detectors | 273 (269 done) | -248 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector +249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector > **Road to Ironclad 1.0** — 1.0 locks only when *two independent implementations pass the L4 conformance fixtures* ([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md)). cladding is the first. diff --git a/README.zh.md b/README.zh.md index b37e8c65..b364c53c 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **可追溯** —— **交付出去的一切都留有记录**:验证了什么,写进已提交的内容;谁、何时,记在本地会话账本;为什么,留在 spec —— 于是交接与评审无需考古,就能追溯每一个决定。 - **可扩展** —— 人和 AI 越多,通常冲突和漂移也越多。但所有人都以同一份 spec 为基准,这些会被自动挡下 —— 所以不断扩张也不会崩。 -cladding 连**自己**也是用 cladding 造的 —— 270 个 feature 里有 266 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 +cladding 连**自己**也是用 cladding 造的 —— 273 个 feature 里有 269 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 @@ -343,9 +343,9 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2779 / 2779 | 15 阶段 · 41 检测器 | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 | 15 阶段 · 41 检测器 | 273(269 done) | -248 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 +249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 > **通往 Ironclad 1.0 之路** —— 只有当*两个独立实现都通过 L4 一致性测试夹具*时,1.0 才会锁定([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md))。cladding 是第一个。 diff --git a/plugins/antigravity/skills/planner/SKILL.md b/plugins/antigravity/skills/planner/SKILL.md index 74a4755f..f3cacac9 100644 --- a/plugins/antigravity/skills/planner/SKILL.md +++ b/plugins/antigravity/skills/planner/SKILL.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/claude-code/agents/planner.md b/plugins/claude-code/agents/planner.md index 74a4755f..f3cacac9 100644 --- a/plugins/claude-code/agents/planner.md +++ b/plugins/claude-code/agents/planner.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/claude-code/dist/agents/planner.md b/plugins/claude-code/dist/agents/planner.md index 74a4755f..f3cacac9 100644 --- a/plugins/claude-code/dist/agents/planner.md +++ b/plugins/claude-code/dist/agents/planner.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index f285b93d..613302aa 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -600,15 +600,15 @@ body{font-size:11px} `)}function J_e(t){return`"${t.title}" (${t.id})`}function Y_e(t){let e=["## Code changes \u2192 owning features"];if(t.codeChanges.length===0)e.push("","_No owned source files changed in this range._");else{e.push("");for(let r of t.codeChanges)e.push(`- ${r.path} \u2192 ${r.owners.map(J_e).join(", ")}`)}if(t.unowned.length>0){e.push("","### Unowned changes",""),e.push("_Changed source files no feature declares in its `modules` \u2014 surfaced, never dropped._","");for(let r of t.unowned)e.push(`- ${r}`)}return e.join(` `)}function X_e(t){let e=["## Regression set"];if(e.push("","_Deduped union of test_refs across the impact slices of the changed modules._",""),t.regressionSet.length===0)e.push("_No test_refs resolved for the changed modules._");else for(let r of t.regressionSet)e.push(`- ${r}`);return t.ledgerEmpty&&e.push("",Z_e),e.join(` `)}function Q_e(t){return t.statusBefore===null?`added as ${t.statusAfter??"unknown"}`:t.statusAfter===null?`was ${t.statusBefore}, now deleted`:t.statusBefore===t.statusAfter?t.statusAfter:`${t.statusBefore} \u2192 ${t.statusAfter}`}function ebe(t){let e=["## How the acceptance criteria moved"];if(t.specEntryDeltas.length===0)return e.push("","_No feature spec entry changed in this range._"),e.join(` -`);e.push("","_Each criterion compared against its own earlier revision, matched by id. A rewrite here is invisible to every drift check, because the code was changed to match it._");for(let r of t.specEntryDeltas){let n=r.counts;e.push("",`### "${r.title}" (${r.id}) \u2014 ${Q_e(r)}`,""),e.push(`- new ${n.new} \xB7 rewritten ${n.rewritten} \xB7 removed ${n.removed} \xB7 unchanged ${n.unchanged}`);for(let i of r.rows){if(i.kind==="unchanged")continue;let o=i.earsShift?` \u2014 pattern ${i.earsShift}`:"";e.push(`- ${i.kind.toUpperCase()} ${i.id}${o}`)}}return e.join(` +`);e.push("","_Each criterion compared against its own earlier revision, matched by id. A rewrite is invisible to every drift check if the code was changed to match it._");for(let r of t.specEntryDeltas){let n=r.counts;e.push("",`### "${r.title}" (${r.id}) \u2014 ${Q_e(r)}`,""),e.push(`- new ${n.new} \xB7 rewritten ${n.rewritten} \xB7 removed ${n.removed} \xB7 unchanged ${n.unchanged}`);for(let i of r.rows){if(i.kind==="unchanged")continue;let o=i.earsShift?` \u2014 pattern ${i.earsShift}`:"";e.push(`- ${i.kind.toUpperCase()} ${i.id}${o}`)}}return e.join(` `)}function tbe(t){let e=["## Declared tests"];if(t.testRefRows.length===0)return e.push("","_No touched entry declares a test._"),e.join(` `);e.push("","_`changed` = the named file also moved in this range. `unchanged` = declared, untouched. `no file` = a placeholder the harness suggested, not a test that exists._","");let r="";for(let n of t.testRefRows){n.featureId!==r&&(r=n.featureId,e.push(`- ${n.featureId}`));let i=n.state==="co-changed"?"changed":n.state==="unchanged"?"unchanged":"no file";e.push(` - ${n.acId} \xB7 ${n.ref} \u2014 ${i}`)}return e.join(` `)}function rbe(t){let e=["## Gate & attestation",""];if(t.attestedCount===null?e.push("- Verification attestation: none on record \u2014 this tree's verification state is unknown."):e.push(`- Verification attestation: ${t.attestedCount} done feature(s) attested to their module tree-hash.`),t.lastGateRun===null)e.push("- Last recorded gate run: none in this working tree's ledger (`.cladding/` is git-ignored; fresh clones and CI start empty).");else{let r=t.lastGateRun,n=r.anyFailed===!1?"PASSED":r.anyFailed===!0?"FAILED":"unknown",i=[r.tier?`tier ${r.tier}`:"tier unknown",`strict=${r.strict===!0}`,`${n}`,typeof r.worst=="number"?`(worst exit ${r.worst})`:""].filter(o=>o.length>0);e.push(`- Last recorded gate run: ${i.join(", ")}.`)}return e.join(` -`)}function FG(t,e){let r=e.head.slice(0,12);return[`# Review packet \u2014 ${e.sinceRef}..${r}`,"",K_e(t.specChanges),"",ebe(t),"",Y_e(t),"",tbe(t),"",X_e(t),"",rbe(t.gate),""].join(` +`)}function FG(t,e){let r=e.head.slice(0,12),n=e.baseSha&&!e.baseSha.startsWith(e.sinceRef)&&e.sinceRef!==e.baseSha?[`_Compared against ${e.baseSha.slice(0,12)} \u2014 the merge base of ${e.sinceRef} and HEAD._`,""]:[];return[`# Review packet \u2014 ${e.sinceRef}..${r}`,"",...n,K_e(t.specChanges),"",ebe(t),"",Y_e(t),"",tbe(t),"",X_e(t),"",rbe(t.gate),""].join(` `)}var nbe="2.1.0",ibe="https://json.schemastore.org/sarif-2.1.0.json",obe="https://github.com/qwerfunch/cladding",sbe={error:"error",warn:"warning"};function abe(t,e){return[{physicalLocation:{artifactLocation:{uri:t},region:{startLine:typeof e=="number"&&e>0?e:1}}}]}function LG(t){let e=new Map,r=[];for(let i of t){if(i.severity==="info")continue;let o=sbe[i.severity];e.has(i.detector)||e.set(i.detector,{id:i.detector,name:i.detector,shortDescription:{text:`cladding drift detector ${i.detector}`}}),r.push({ruleId:i.detector,level:o,message:{text:i.message},...i.path?{locations:abe(i.path,i.line)}:{}})}r.sort((i,o)=>{let s=i.ruleId.localeCompare(o.ruleId);if(s!==0)return s;let a=i.locations?.[0]?.physicalLocation.artifactLocation.uri??"",c=o.locations?.[0]?.physicalLocation.artifactLocation.uri??"";if(a!==c)return a.localeCompare(c);let l=i.locations?.[0]?.physicalLocation.region.startLine??0,u=o.locations?.[0]?.physicalLocation.region.startLine??0;return l!==u?l-u:i.message.text.localeCompare(o.message.text)});let n=[...e.values()].sort((i,o)=>i.id.localeCompare(o.id));return{$schema:ibe,version:nbe,runs:[{tool:{driver:{name:"cladding",informationUri:obe,rules:n}},results:r}]}}wl();Ue();os();Up();Ii();var DPe=["md","sarif","json"],NPe=new Set(["ts","tsx","mts","cts","js","jsx","mjs","cjs","py","go","rs","java","kt","kts","rb","c","h","cc","cpp","cxx","hpp","hh","cs","swift","php","scala","m","mm","sh","bash","lua","dart","ex","exs","clj","ml","vue","svelte"]),jPe=new Set(["node_modules","dist","build","out","coverage",".git",".cladding","vendor",".next","target"]);function MPe(t){if(t.split("/").some(n=>jPe.has(n)))return!1;let r=t.lastIndexOf(".");return r<0?!1:NPe.has(t.slice(r+1).toLowerCase())}function FPe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("report: empty --since ref \u2014 pass --since ");if(!k_(t,r))throw new Error(`report: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unresolvable ref is an error, never a silently-empty report.`)}function LPe(t,e){let r;try{r=CPe("git",["diff","--name-only",`${e}..HEAD`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch{return[]}return[...new Set(r.split(` `).map(n=>n.trim()).filter(n=>n.length>0))].sort((n,i)=>n.localeCompare(i))}function zPe(t,e){let r=e.get(t),n=r?r.slug:void 0;return{id:t,title:r?.title??t,...n?{slug:n}:{}}}function UPe(t){let e=ls(t),r=zf(t,"gate_run"),n=r?{tier:typeof r.payload.tier=="string"?r.payload.tier:void 0,strict:typeof r.payload.strict=="boolean"?r.payload.strict:void 0,worst:typeof r.payload.worst=="number"?r.payload.worst:void 0,anyFailed:typeof r.payload.anyFailed=="boolean"?r.payload.anyFailed:void 0}:null;return{attestedCount:e===null?null:Z_(e),lastGateRun:n}}function qPe(t,e,r,n){let i=On(e),o=qO(i).depends_on_edges===0,s=new Map((e.features??[]).map(l=>[l.id,l])),a=LPe(t,r),c=a.filter(MPe).map(l=>{let u=Sr(e,l);if("not_found"in u)return{path:l,owners:[],testRefs:[]};let d=(u.focus.owners??[]).map(f=>zPe(f,s));return{path:l,owners:d,testRefs:u.test_refs}});return{specChanges:n,codeChanges:c,ledgerEmpty:o,gate:UPe(t),specEntries:wH(t,r),changedPaths:a}}function PY(t){let e=t.cwd??".",r=t.format??"md";if(!DPe.includes(r)){L("fail","report",`unknown --format '${r}' (expected md | sarif | json)`),qp.exit(1);return}let n;try{n=t.since??ns(e),FPe(e,n)}catch(i){L("fail","report",i.message),qp.exit(2);return}try{let i;if(r==="sarif"){let{findings:o}=oi({cwd:e});i=`${JSON.stringify(LG(o),null,2)} -`}else{let o=_H(e,n),s=is(e,o),a=q(e),c=MG(qPe(e,a,o,s));i=r==="json"?`${JSON.stringify({since:n,head:s.head,...c},null,2)} -`:`${FG(c,{sinceRef:n,head:s.head})} +`}else{let o=_H(e,n),s=is(e,o),a=q(e),c=MG(qPe(e,a,o,s));i=r==="json"?`${JSON.stringify({since:n,base:o,head:s.head,...c},null,2)} +`:`${FG(c,{sinceRef:n,baseSha:o,head:s.head})} `}qp.stdout.write(i),qp.exitCode=0}catch(i){L("fail","report",i.message),qp.exit(1)}}jr();wl();Ii();import{existsSync as BPe}from"node:fs";import{join as HPe}from"node:path";import xt from"node:process";function CY(t){let e={},r={},n={},i=new Map,o=[],s=new Set,a=0;for(let l=t.length-1;l>=0;l--){let u=t[l];if(u.type!=="sentinel_miss")continue;a+=1,NC(e,hS(u.payload.phase)),NC(r,hS(u.payload.cause)),NC(n,hS(u.payload.fallback));let d=u.payload.missed_sections;if(Array.isArray(d))for(let p of d){let m=hS(p);i.set(m,(i.get(m)??0)+1)}let f=u.payload.error;typeof f=="string"&&f.length>0&&!s.has(f)&&o.length<3&&(s.add(f),o.push(f))}let c=[...i.entries()].map(([l,u])=>({name:l,count:u})).sort((l,u)=>u.count-l.count||l.name.localeCompare(u.name)).slice(0,5);return{total:a,byPhase:e,byCause:r,byFallback:n,topMissedSections:c,recentErrors:o}}function DY(t){let e={};for(let r of t)e[r.type]=(e[r.type]??0)+1;return{total:t.length,byType:e}}function NC(t,e){e&&(t[e]=(t[e]??0)+1)}function hS(t){return typeof t=="string"?t:""}function GPe(t,e){let r=e.filter(s=>s.type==="gate_run"),n=e.filter(s=>s.type==="done_attempted"),i=r.at(-1)?.payload,o=ls(t);return{gateRuns:r.length,lastGate:i?{tier:i.tier,strict:i.strict,worst:i.worst}:null,doneAttempts:n.length,doneRejected:n.filter(s=>s.payload.kept!==!0).length,stopBlocked:e.filter(s=>s.type==="stop_blocked").length,unresolvedStopBlock:BPe(HPe(t,".cladding","stop-block.json")),attestation:{present:o!==null,entries:o===null?0:Z_(o)}}}function NY(t={}){let e=t.cwd??".",r;try{r=va(e)}catch(a){L("fail","doctor",a.message),xt.exit(1);return}let n=DY(r),i=CY(r),o=GPe(e,r),s={cwd:e,events:n,sentinelMiss:i,governance:o};if(t.json){xt.stdout.write(`${JSON.stringify(s,null,2)} `),xt.exit(0);return}if(n.total===0){L("note","doctor","no events recorded yet \u2014 run `clad init --scan` or a stage to populate .cladding/events.log.jsonl"),xt.exit(0);return}ZPe(s),xt.exit(0)}function ZPe(t){let{events:e,sentinelMiss:r}=t,n=r.total===0?`${e.total} events \xB7 0 sentinel-miss (host is healthy)`:`${e.total} events \xB7 ${r.total} sentinel-miss`;L(r.total===0?"pass":"note","doctor",n);let i=Object.entries(e.byType).filter(([,a])=>(a??0)>0).sort(([a],[c])=>a.localeCompare(c)).map(([a,c])=>`${a}=${c}`).join(" ");i.length>0&&xt.stdout.write(`Events: ${i} `),xt.stdout.write(` @@ -954,4 +954,4 @@ ${o.length} AC(s) required, ${s.length} missing an oracle. `).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Zde(e.trim(),160)} `)}}function Zde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function D5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(r0(e,"."),null,2)} `),G.exitCode=0;return}G.stdout.write(`${ere(e,".",{internal:t.internal})} -`),G.exit(0)}function N5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function j5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=r0(i,e),s={gitHead:Sa(e),version:tu(),generatedAt:t.now??new Date().toISOString()},a=_l(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:gl(u),auditMarkdown:yl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{g5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${N5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function M5e(t){let e=VA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function F5e(){let t=new T4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(_5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(b5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(v5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(x5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action($5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(R5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(S5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(I5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>P5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(w5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(D5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(E5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>A5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>KX(r,{checkStages:TA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>T5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>O5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>bte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>vte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Ste(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>_G(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>PY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>j5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(M5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(zX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(y5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){aX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}NY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(rte),t}var L5e=!!globalThis.__CLADDING_BUNDLED,z5e=L5e||import.meta.url===`file://${G.argv[1]}`;z5e&&F5e().parse();export{k5e as TIER_STAGES,F5e as createProgram,j5e as runBundleCommand,R5e as runCheckCommand,TA as runCheckStages,S5e as runCheckpointCommand,E5e as runContextCommand,I5e as runDoneCommand,A5e as runImpactCommand,T5e as runInferDepsCommand,_5e as runInitCommand,O5e as runMeasureCommand,P5e as runOracleCommand,w5e as runRollbackCommand,M5e as runRouteCommand,b5e as runRunCommand,y5e as runServeCommand,x5e as runSetupCommand,D5e as runStatusCommand,v5e as runSyncCommand,$5e as runUpdateCommand}; +`),G.exit(0)}function N5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function j5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=r0(i,e),s={gitHead:Sa(e),version:tu(),generatedAt:t.now??new Date().toISOString()},a=_l(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:gl(u),auditMarkdown:yl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{g5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${N5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function M5e(t){let e=VA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function F5e(){let t=new T4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(_5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(b5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(v5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(x5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action($5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(R5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(S5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(I5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>P5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(w5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(D5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(E5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>A5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>KX(r,{checkStages:TA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>T5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>O5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>bte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>vte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Ste(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>_G(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>PY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>j5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(M5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(zX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(y5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){aX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}NY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(rte),t}var L5e=!!globalThis.__CLADDING_BUNDLED,z5e=L5e||import.meta.url===`file://${G.argv[1]}`;z5e&&F5e().parse();export{k5e as TIER_STAGES,F5e as createProgram,j5e as runBundleCommand,R5e as runCheckCommand,TA as runCheckStages,S5e as runCheckpointCommand,E5e as runContextCommand,I5e as runDoneCommand,A5e as runImpactCommand,T5e as runInferDepsCommand,_5e as runInitCommand,O5e as runMeasureCommand,P5e as runOracleCommand,w5e as runRollbackCommand,M5e as runRouteCommand,b5e as runRunCommand,y5e as runServeCommand,x5e as runSetupCommand,D5e as runStatusCommand,v5e as runSyncCommand,$5e as runUpdateCommand}; diff --git a/plugins/codex/skills/planner/SKILL.md b/plugins/codex/skills/planner/SKILL.md index 74a4755f..f3cacac9 100644 --- a/plugins/codex/skills/planner/SKILL.md +++ b/plugins/codex/skills/planner/SKILL.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/spec/attestation.yaml b/spec/attestation.yaml index be1e05f5..a8f18b1b 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -17,15 +17,15 @@ attested_modules: .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: 033d721cd4fe05a4 + CHANGELOG.md: af69d16f2b298b79 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 5aaa96fa216831d0 - README.ja.md: 3036dfcef2fced96 - README.ko.html: 8b0f541247c0c493 - README.ko.md: a3bb75415567217d - README.md: 40ed53a88b561247 - README.zh.md: f86fadac147c0613 + README.html: b54da47187e0d23a + README.ja.md: f69f828a85166942 + README.ko.html: c234b7f20cfd0941 + README.ko.md: 10e6fd0dded8af59 + README.md: 92ebf6ffccbb27e6 + README.zh.md: 56bf8c47e2a979a4 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -77,7 +77,7 @@ attested_modules: plugins/claude-code/agents/developer.md: 3002b4ef69ddab43 plugins/claude-code/agents/observability.md: 637fde18c012e2a7 plugins/claude-code/agents/orchestrator.md: 1b758de0bdab8eb0 - plugins/claude-code/agents/planner.md: d1f895a20fb3a3ed + plugins/claude-code/agents/planner.md: 2ca87ed1fe99c913 plugins/claude-code/agents/reviewer.md: cdf7469a3e58b438 plugins/claude-code/commands/init.md: 5529b13d0f1ab4bf plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 @@ -88,7 +88,7 @@ attested_modules: plugins/codex/skills/init/SKILL.md: 5529b13d0f1ab4bf plugins/codex/skills/observability/SKILL.md: 637fde18c012e2a7 plugins/codex/skills/orchestrator/SKILL.md: 1b758de0bdab8eb0 - plugins/codex/skills/planner/SKILL.md: d1f895a20fb3a3ed + plugins/codex/skills/planner/SKILL.md: 2ca87ed1fe99c913 plugins/codex/skills/reviewer/SKILL.md: cdf7469a3e58b438 plugins/codex/skills/run/SKILL.md: 9f95ff17d70c8dd1 plugins/codex/skills/serve/SKILL.md: f08bbdbbfeb05041 @@ -143,14 +143,14 @@ attested_modules: src/agents/loader.ts: 6d35560c47f9ae85 src/agents/observability.md: 637fde18c012e2a7 src/agents/orchestrator.md: 1b758de0bdab8eb0 - src/agents/planner.md: d1f895a20fb3a3ed + src/agents/planner.md: 2ca87ed1fe99c913 src/agents/reviewer.md: cdf7469a3e58b438 src/changelog/collect.ts: bb0830526334da9f src/changelog/render.ts: 83dd2d95f24ca68c src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: 0501f16f74b2a8dc + src/cli/clad.ts: 3906f5320f1e6d13 src/cli/clarify.ts: f17177969d5b75ff src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 src/cli/doctor.ts: b98b955fe75e7f7e @@ -163,7 +163,7 @@ attested_modules: src/cli/init.ts: 91cf7be2b7427fbf src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 - src/cli/report.ts: bf44afa516ade7f3 + src/cli/report.ts: dc5233ffb3398cdc src/cli/scan/architecture.ts: c9cfd5445ea77e45 src/cli/scan/conventions.ts: 577468c0fc3fdf6a src/cli/scan/dispatcher.ts: 97bd3f12cece4fc4 @@ -230,7 +230,7 @@ attested_modules: src/oracle/record.ts: 0b9c124225abe1ac src/report/ac-delta.ts: d5f219cee7691d01 src/report/bundle.ts: f8a2fb6c2d02326f - src/report/report.ts: 983dae356d42af0b + src/report/report.ts: 01bcc88dc44e77f6 src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 diff --git a/spec/features/pr-review-packet-f6cc5e5a.yaml b/spec/features/pr-review-packet-f6cc5e5a.yaml index 0c18ae0b..d60963be 100644 --- a/spec/features/pr-review-packet-f6cc5e5a.yaml +++ b/spec/features/pr-review-packet-f6cc5e5a.yaml @@ -11,12 +11,12 @@ acceptance_criteria: - id: AC-cbf1c202 ears: event condition: "when clad report --since runs in a repo with spec.yaml" - text: "When clad report runs, the system shall print a markdown report with four sections — spec changes (from the changelog collector), code changes resolved to owning features via the reverse index, the deduped regression set (union of test_refs across impact slices), and gate plus attestation state — byte-identical across two runs on the same repository state." + text: "When clad report runs, the system shall print a markdown report with six sections — spec entry changes (from the changelog collector), how each acceptance criterion moved, code changes resolved to owning features via the reverse index, the tests those features declare, the deduped regression set (union of test_refs across impact slices), and gate plus attestation state — byte-identical across two runs on the same repository state." test_refs: - - "tests/report/report.test.ts#emits the four mandated sections in order" + - "tests/report/report.test.ts#emits the six mandated sections in order" - "tests/report/report.test.ts#two renders on the same model are byte-identical" - "tests/report/report.test.ts#partitions changed files into owned vs unowned by owner count" - - "tests/report/report-cli.test.ts#AC-cbf1c202 · renders all four sections in order and exits 0" + - "tests/report/report-cli.test.ts#AC-cbf1c202 · renders all six sections in order and exits 0" - "tests/report/report-cli.test.ts#AC-cbf1c202 · two runs on the same repo state are byte-identical" notes: "WHY: the doc-value A/B proved traceability value to reviewers and auditors; a PR is where they consume it without reading the spec tree." - id: AC-7672ce5d diff --git a/src/agents/planner.md b/src/agents/planner.md index 74a4755f..f3cacac9 100644 --- a/src/agents/planner.md +++ b/src/agents/planner.md @@ -52,7 +52,7 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read ## What you don't do - You do not write production code or tests (`developer` does). - You do not pass philosophical judgement (`reviewer` does). -- You do not silently drop ACs — every removal needs an `archive_reason`. +- You do not silently drop ACs — say why in the criterion's `notes` first. ## EARS reminder diff --git a/src/cli/clad.ts b/src/cli/clad.ts index c8475424..7df73663 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -1252,15 +1252,16 @@ export function createProgram(): Command { program .command('report') .description( - 'Render one deterministic review packet for a git range (F-f6cc5e5a) — spec-shard movement (from the ' + - 'changelog), changed source files resolved to their owning features via the reverse index, the deduped ' + - 'regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it ' + - 'gates nothing. Byte-identical across two runs on the same repository state.', + 'Render one deterministic review packet for a git range (F-f6cc5e5a) — spec entry movement (from the ' + + 'changelog), how each acceptance criterion moved, changed source files resolved to their owning features ' + + 'via the reverse index, the tests those features declare, the deduped regression set, and gate + ' + + 'attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. ' + + 'Byte-identical across two runs on the same repository state.', ) .option('--since ', 'git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)') .option( '--format ', - 'md (default, the four-section markdown packet) | sarif (SARIF 2.1.0 — one result per error/warn drift ' + + 'md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 — one result per error/warn drift ' + 'finding, for code-scanning UIs) | json (the raw deterministic model)', ) .action((opts: {since?: string; format?: string}) => runReportCommand(opts)); diff --git a/src/cli/report.ts b/src/cli/report.ts index 72acdd99..5e5fc96c 100644 --- a/src/cli/report.ts +++ b/src/cli/report.ts @@ -210,8 +210,8 @@ export function runReportCommand(opts: ReportCommandOptions): void { const model = buildReportModel(gatherInputs(cwd, spec, baseRef, manifest)); out = format === 'json' - ? `${JSON.stringify({since: sinceRef, head: manifest.head, ...model}, null, 2)}\n` - : `${renderReportMarkdown(model, {sinceRef, head: manifest.head})}\n`; + ? `${JSON.stringify({since: sinceRef, base: baseRef, head: manifest.head, ...model}, null, 2)}\n` + : `${renderReportMarkdown(model, {sinceRef, baseSha: baseRef, head: manifest.head})}\n`; } // Set exitCode and let the event loop DRAIN stdout instead of process.exit(): // the packet can exceed the 64KB pipe buffer, and a forced exit truncates a diff --git a/src/report/report.ts b/src/report/report.ts index ce8829c8..272b2a2d 100644 --- a/src/report/report.ts +++ b/src/report/report.ts @@ -108,6 +108,16 @@ export interface ReportMeta { readonly sinceRef: string; /** Full HEAD sha (from `git rev-parse HEAD`); deterministic for a fixed state. */ readonly head: string; + /** + * The commit the packet actually compared against — the merge base of + * `sinceRef` and HEAD, or `sinceRef` itself when no merge base resolves. + * + * It is stamped because it can DIFFER from what the reader asked for: on a + * branch that forked earlier, the named tag can sit several commits off the + * fork point. An audit artifact that does not name the revision it audited + * against cannot be reproduced by hand. + */ + readonly baseSha?: string; } /** Human-readable label for a changelog change kind. */ @@ -287,7 +297,7 @@ function renderSpecEntryDeltas(model: ReportModel): string { } lines.push( '', - '_Each criterion compared against its own earlier revision, matched by id. A rewrite here is invisible to every drift check, because the code was changed to match it._', + '_Each criterion compared against its own earlier revision, matched by id. A rewrite is invisible to every drift check if the code was changed to match it._', ); for (const d of model.specEntryDeltas) { const c = d.counts; @@ -364,15 +374,23 @@ function renderGate(gate: GateStateInput): string { } /** - * Renders the full four-section markdown packet. Deterministic: the only + * Renders the full six-section markdown packet. Deterministic: the only * variable inputs are `meta.sinceRef` + `meta.head`, both stable for a fixed * repository state — so two runs produce byte-identical output. */ export function renderReportMarkdown(model: ReportModel, meta: ReportMeta): string { const shortHead = meta.head.slice(0, 12); + // Name the revision actually compared against when it is not the ref the + // reader named — otherwise reproducing the packet by hand silently uses a + // different base. + const base = + meta.baseSha && !meta.baseSha.startsWith(meta.sinceRef) && meta.sinceRef !== meta.baseSha + ? [`_Compared against ${meta.baseSha.slice(0, 12)} — the merge base of ${meta.sinceRef} and HEAD._`, ''] + : []; return [ `# Review packet — ${meta.sinceRef}..${shortHead}`, '', + ...base, renderSpecChanges(model.specChanges), '', renderSpecEntryDeltas(model), diff --git a/tests/report/report-cli.test.ts b/tests/report/report-cli.test.ts index 99a8be8a..743dc0bc 100644 --- a/tests/report/report-cli.test.ts +++ b/tests/report/report-cli.test.ts @@ -5,7 +5,7 @@ // unowned file), because the CLI's contract is about what git + spec say. The // CLI is spawned as a subprocess so its real exit codes are observable // (runReportCommand calls process.exit on the error paths). -// - AC-cbf1c202 · four sections present; two runs byte-identical; exit 0 +// - AC-cbf1c202 · six sections present; two runs byte-identical; exit 0 // - AC-7672ce5d · the unowned file surfaces; the owned file never does // - AC-67fa1d25 · unresolvable --since → exit 2 naming the ref; valid → exit 0 // - unknown --format → exit 1 (pinned current behaviour) @@ -78,7 +78,9 @@ const SPEC_YAML = [ const SECTIONS = [ '## Spec changes', + '## How the acceptance criteria moved', '## Code changes → owning features', + '## Declared tests', '## Regression set', '## Gate & attestation', ] as const; @@ -116,7 +118,7 @@ describe('clad report — integration (F-f6cc5e5a)', () => { rmSync(dir, {recursive: true, force: true}); }); - test('AC-cbf1c202 · renders all four sections in order and exits 0', () => { + test('AC-cbf1c202 · renders all six sections in order and exits 0', () => { const run = runClad(dir, ['report', '--since', 'v0']); expect(run.status, run.stderr).toBe(0); const positions = SECTIONS.map((h) => run.stdout.indexOf(h)); @@ -292,3 +294,46 @@ describe('AC-1a6cb22f / AC-4b6fe145 / AC-8e748acb · anchoring the range on the expect(noMovement.status).toBe(0); }); }); + +describe('the packet names the revision it audited against', () => { + test('the json model carries the resolved base alongside the ref the user named', () => { + // Recorded on the fork-point fixture built above: `main` and the merge base + // are different commits there, so `since` alone does not identify the + // comparison. Both must be present for an auditor to reproduce it. + const forked = mkdtempSync(join(tmpdir(), 'clad-report-basestamp-')); + try { + git(forked, ['init', '-q']); + git(forked, ['config', 'user.email', 'test@example.com']); + git(forked, ['config', 'user.name', 'test']); + git(forked, ['config', 'commit.gpgsign', 'false']); + mkdirSync(join(forked, 'spec', 'features'), {recursive: true}); + writeFileSync(join(forked, 'spec.yaml'), SPEC_YAML); + writeFileSync(join(forked, 'spec', 'features', 'owned-feature-aaaa1111.yaml'), shard('in_progress')); + writeFileSync(join(forked, 'src.ts'), 'export const a = 1;\n'); + git(forked, ['add', '-A']); + git(forked, ['commit', '-q', '-m', 'baseline']); + git(forked, ['tag', 'v0']); + git(forked, ['branch', '-M', 'main']); + // main moves on; our branch forks from v0, so v0 !== the merge base of main and HEAD. + writeFileSync(join(forked, 'src.ts'), 'export const a = 2;\n'); + git(forked, ['add', '-A']); + git(forked, ['commit', '-q', '-m', 'their work']); + git(forked, ['checkout', '-q', '-b', 'mine', 'v0']); + writeFileSync(join(forked, 'src.ts'), 'export const a = 3;\n'); + git(forked, ['add', '-A']); + git(forked, ['commit', '-q', '-m', 'my work']); + + const ran = runClad(forked, ['report', '--since', 'main', '--format', 'json']); + expect(ran.status).toBe(0); + const model = JSON.parse(ran.stdout) as {since: string; base: string; head: string}; + expect(model.since).toBe('main'); + expect(model.base).toBeTruthy(); + expect(model.base).not.toBe(model.head); + // The stamped base is the fork point, not the tip of the ref that was named. + const mainTip = execFileSync('git', ['rev-parse', 'main'], {cwd: forked, encoding: 'utf8'}).trim(); + expect(model.base).not.toBe(mainTip); + } finally { + rmSync(forked, {recursive: true, force: true}); + } + }); +}); diff --git a/tests/report/report.test.ts b/tests/report/report.test.ts index 425a10bb..2d351b03 100644 --- a/tests/report/report.test.ts +++ b/tests/report/report.test.ts @@ -2,7 +2,7 @@ // // Pure-level contract of the review-packet renderer. Written from the ACs, not // the implementation body — a synthetic model in, deterministic markdown out. -// - AC-cbf1c202 · four ## sections in order, byte-identical across two renders +// - AC-cbf1c202 · six ## sections in order, byte-identical across two renders // - AC-cbf1c202 · buildReportModel folds inputs → sorted/deduped model // - AC-7672ce5d · unowned files surface under a section, owned never do, // empty unowned → no section (pinned current behaviour) @@ -46,10 +46,12 @@ const NO_GATE: GateStateInput = {attestedCount: null, lastGateRun: null}; const META: ReportMeta = {sinceRef: 'v0', head: 'deadbeefcafe0000000000000000000000000000'}; -/** The four mandated section headers, in the order the packet must present them. */ +/** The six mandated section headers, in the order the packet must present them. */ const SECTIONS = [ '## Spec changes', + '## How the acceptance criteria moved', '## Code changes → owning features', + '## Declared tests', '## Regression set', '## Gate & attestation', ] as const; @@ -122,8 +124,8 @@ describe('report/report — buildReportModel (AC-cbf1c202)', () => { }); }); -describe('report/report — renderReportMarkdown four sections + determinism (AC-cbf1c202)', () => { - test('emits the four mandated sections in order', () => { +describe('report/report — renderReportMarkdown six sections + determinism (AC-cbf1c202)', () => { + test('emits the six mandated sections in order', () => { const model = buildReportModel( mkInputs({ codeChanges: [ @@ -162,6 +164,28 @@ describe('report/report — renderReportMarkdown four sections + determinism (AC const md = renderReportMarkdown(buildReportModel(mkInputs()), META); expect(md).toContain('# Review packet — v0..deadbeefcafe'); }); + + test('names the revision actually compared against when it differs from the named ref', () => { + // The packet anchors on the merge base, which on a branch that forked + // earlier is NOT the tag the reader named. An audit artifact that does not + // say what it audited against cannot be reproduced by hand. + const md = renderReportMarkdown(buildReportModel(mkInputs()), { + ...META, + baseSha: 'abc123def4560000000000000000000000000000', + }); + expect(md).toContain('Compared against abc123def456'); + expect(md).toContain('the merge base of v0 and HEAD'); + }); + + test('stays silent when the base IS the named ref — no noise on a linear range', () => { + const md = renderReportMarkdown(buildReportModel(mkInputs()), {...META, baseSha: 'v0'}); + expect(md).not.toContain('Compared against'); + }); + + test('an absent base sha renders as before — the field is additive', () => { + const without = renderReportMarkdown(buildReportModel(mkInputs()), META); + expect(without).not.toContain('Compared against'); + }); }); describe('report/report — unowned surfacing (AC-7672ce5d)', () => { From 0a2ee794791533c61ef2ff46c131d05f655ded82 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Mon, 3 Aug 2026 14:26:31 +0900 Subject: [PATCH 4/8] fix(arch,report): repair what an independent audit found in the last three commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The author of those commits also wrote the probes that "proved" them. An independent audit re-derived every claim and found eight defects; all eight survived a refutation attempt. Three were blocking. THE ARCHITECTURE GUARD ASKED THE WRONG QUESTION, IN BOTH DIRECTIONS. It decided "this project configures the scanner" by looking for five filenames in the gate's own directory. madge's loader does neither of those things: it reads the exact name `.madgerc` walked UP to the filesystem root, plus four `$HOME` locations and two under `/etc`, and it never reads `.madgerc.json`, `.js` or `.yaml` at all. - A user whose `.madgerc` sits one directory up was GREEN before, and this branch turned them RED: cladding sent `--exclude`, madge replaced their rules with ours, and the cycles they had suppressed came back and blocked the gate. That is the exact harm the criterion was written to prevent, and the shipped test could never catch it — it wrote the config into the very directory it queried. - An empty `.madgerc`, or one carrying only `detectiveOptions`, sets no exclusion, yet tripped the guard — so the fix switched itself off and the gate kept blocking on generated output. The guard now asks what madge asks: does an exclusion actually apply, anywhere on madge's real search path. Two tests that fail against the old code cover the parent directory and `$HOME`; a third covers the configs that set nothing. A REWRITTEN OBLIGATION COULD PASS AS UNCHANGED. The criterion comparison read `text`, `ears` and `condition` — not `action` and `response`, which state the obligation itself: the impl-blind oracle renders `action` as "system shall:", and a criterion carrying only these fields is fully specified. Four out of five criteria here carry them, and a sibling project has criteria with no `text` at all. Measured against this repository's own history, the blind spot hid 31 rewrites in 400 commits. THE EXCLUSION MISSED THE SHAPE THE MOTIVATING ADOPTER HAS. Anchored at depth 0, it left `frontend/dist` and `packages/*/dist` blocking. `dist`, `coverage` and the framework caches now match at any depth; `build`, `out` and `target` stay at the root, because those names do occur as real source directories and a false negative is worse than the false RED being fixed. The criterion's measurement note now says plainly that its four-cycles-to-zero figure came from a directory that is not a gate root, and that on the gate roots on record this removes no findings today. Also fixed, none of them blocking: - The base disclosure compared a ref NAME to a 40-hex sha, so it announced a difference on every linear range — the previous commit's claim that it speaks "only when they differ" was false on every invocation. The CLI now resolves both to commits, which also peels an annotated tag. - A declared test with no file behind it was labelled `unchanged`, the same as a real untouched test, while the legend reserved a state for exactly that case. It now reads `absent`; six such rows exist in this repo today. - The verb glossary and two module headers still described the four-section packet, and two determinism notes were falsified by the base field the previous commit added. Every new test was mutation-checked: reverting each fix makes them fail (2, 2 and 3 respectively). 2794 tests green, `clad check --tier=pre-push --strict` exits 0. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 9 +- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- docs/glossary.md | 2 +- plugins/claude-code/dist/clad.js | 788 +++++++++--------- spec/attestation.yaml | 26 +- ...arch-gate-skips-build-output-2c02991f.yaml | 4 +- .../review-packet-ac-delta-5dfbac9c.yaml | 2 +- src/cli/report.ts | 44 +- src/report/ac-delta.ts | 27 +- src/report/report.ts | 71 +- src/stages/toolchain/detect.ts | 104 ++- tests/report/ac-delta.test.ts | 34 + tests/report/report-cli.test.ts | 56 ++ tests/report/report.test.ts | 35 +- tests/stages/toolchain.test.ts | 97 ++- 20 files changed, 834 insertions(+), 489 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fff1f577..e982b8fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,15 +12,18 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ### Added - **"How the acceptance criteria moved" in `clad report`.** For every feature spec entry the range touched, each criterion is classified new / rewritten / removed / unchanged by matching on its id, alongside the entry's status transition and any EARS pattern shift. Rewriting a requirement to match what you built leaves code and spec agreeing, so no drift check can see it; this is the surface that does. -- **"Declared tests" in `clad report`** — for each criterion, whether the test it names also changed in the range, distinguishing a real path that did not change from a placeholder the harness suggested. It grades nothing: whether a test genuinely verifies its criterion is not mechanically decidable, so the packet shows what was declared and leaves the judgement to the reviewer. -- **The packet names the revision it compared against.** The range anchors on the merge base of your ref and HEAD, which on a branch that forked earlier is not the tag you named — so both are now stamped in the header and the JSON. +- **"Declared tests" in `clad report`** — for each criterion, whether the test it names also changed in the range, telling apart a real path that did not change, a concrete path with no file behind it, and a placeholder the harness suggested. It grades nothing: whether a test genuinely verifies its criterion is not mechanically decidable, so the packet shows what was declared and leaves the judgement to the reviewer. The dangling-path case matters because every other existence check in the harness only looks at finished features. +- **The packet names the revision it compared against**, when that is not the commit you named. The range anchors on the merge base of your ref and HEAD, which on a branch that forked earlier is a different commit — an audit artifact that silently compared against something else cannot be reproduced by hand. ### Fixed -- **The architecture gate no longer scans generated build output.** A bundler's output legitimately contains mutual imports, so scanning it reported circular dependencies that exist in no hand-written file — and blocked the gate on them. `dist`, `build`, `out`, `coverage`, `target`, `.next`, `.nuxt`, `.output`, `.svelte-kit` and `.vite` are now excluded, matched at the repository root only, so a source directory that merely happens to be named `build/` deeper in the tree is still scanned. **If your project declares its own `.madgerc` or a `madge` block in `package.json`, cladding passes no exclusion at all and your rules are the only ones in force** — madge replaces its configured exclusions with a command-line flag rather than merging them, so the two cannot coexist. +- **The architecture gate no longer scans generated build output.** A bundler's output legitimately contains mutual imports, so scanning it reported circular dependencies that exist in no hand-written file — and blocked the gate on them. `dist`, `build`, `out`, `coverage`, `target`, `.next`, `.nuxt`, `.output`, `.svelte-kit` and `.vite` are now excluded, matched at the repository root only, so a source directory that merely happens to be named `build/` deeper in the tree is still scanned. `dist`, `coverage` and the framework caches are excluded at any depth, because a monorepo package or a front-end subdirectory keeps its bundle one level down; `build`, `out` and `target` stay anchored at the root, because they name real source directories often enough that excluding them deeper would drop hand-written code from the scan. + + **If your project has its own madge exclusion in force, cladding passes none of its own and your rules are the only ones that apply** — madge replaces its configured exclusions with a command-line flag rather than merging them, so the two cannot coexist. That is decided the way madge decides it: by reading `.madgerc` up the directory tree, plus `$HOME` and `/etc`, and by checking that an exclusion is actually set rather than that a file merely exists. - **A review range that forked earlier no longer charges the base branch's commits to the range under review.** - **The packet described itself as four sections when it renders six** — in `clad report --help`, in the module that assembles it, and in the acceptance criterion that enumerates them. The criterion appears as `REWRITTEN` in this release's own packet, which is the correct outcome. - **A section lead asserted that the code had been changed to match a rewritten criterion.** The population is deliberately status-blind, so the line also sat above entries with no code yet; it is now conditional. +- **A rewritten obligation could pass as unchanged.** The criterion comparison read only the statement, the pattern and the trigger — not `action` and `response`, which state the obligation itself and which four out of five criteria in this project carry. Rewriting one of them classified as no change at all; in this repository's own history that hid 31 rewrites. - **An instruction the schema rejects.** The `planner` brief asked for an `archive_reason` on a removed acceptance criterion, but that field exists only at feature level and the criterion schema refuses unknown keys — following the instruction failed the sync barrier. - **Stale and self-contradicting counts across the six READMEs**, where feature and test-file totals disagreed with the spec and, in places, with each other inside the same file. diff --git a/README.html b/README.html index 57ab43fa..3c4b6cdf 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2783/2783
+
2794/2794
all pass
diff --git a/README.ja.md b/README.ja.md index 9f8b11c3..0a1d3e9b 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 | 15 段階 · 41 detectors | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 | 15 段階 · 41 detectors | 273(269 done) | 249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 80f1f17b..88fb2b1f 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2783/2783
+
2794/2794
all pass
diff --git a/README.ko.md b/README.ko.md index 8a8ea90d..92f134ae 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | 249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 33e92d9b..8cd78d28 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 | 15 stages · 41 detectors | 273 (269 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 | 15 stages · 41 detectors | 273 (269 done) | 249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index b364c53c..3d190aac 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2783 / 2783 | 15 阶段 · 41 检测器 | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 | 15 阶段 · 41 检测器 | 273(269 done) | 249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/glossary.md b/docs/glossary.md index 91bff1a7..5aca0da2 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -70,7 +70,7 @@ | `graph` | stable (0.7.0) | Render the spec↔code↔doc knowledge graph: `export` → mermaid/dot/json/Obsidian-vault or a self-contained offline `html` viewer (WebGL, three.js bundled); `serve` → the same viewer live on localhost, auto-reloading as spec/docs change; `stats` → counts + hubs. | 지식 그래프 | | `hook` | stable (0.6.0) | Host hook protocol adapter — consumes one host lifecycle event (SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop) as stdin JSON; always exits 0. Honest limit: PreToolUse blocking only sees Edit/Write tool calls — a YAML edit made through Bash bypasses lane one; the Stop hook's post-hoc detectors are lane two. Neither lane alone is the guarantee. | 호스트 훅 프로토콜 어댑터 | | `changelog` | stable (0.6.0) | Render shipped changes since a git ref into human-facing documents — capability-grouped markdown / `--json` manifest / `--audit` verification table / `--catalog` spec listing. Named `changelog` deliberately, NOT `digest` (which means cryptographic hash in this domain — see Naming conventions). | 변경 이력 렌더링 | -| `report` | stable (0.8.0) | Render one deterministic review packet for a git range — spec-shard movement (from `changelog`), changed source files resolved to their owning features via the reverse index, the deduped regression set, and gate + attestation state. `--format md \| sarif \| json`. For PR reviewers/team-leads/auditors: it RENDERS, it gates nothing. | 리뷰 패킷 렌더링 | +| `report` | stable (0.8.0) | Render one deterministic review packet for a git range — spec entry movement (from `changelog`), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. `--format md \| sarif \| json`. For PR reviewers/team-leads/auditors: it RENDERS, it gates nothing. | 리뷰 패킷 렌더링 | | `bundle` | stable (0.8.0) | Write ONE self-contained offline HTML audit bundle (`--out [--since ]`) a non-coder can double-click — provenance banner, project header + inventory, feature × stage matrix, capability catalog, shipped changes, audit table, attestation summary. Zero network, no scripts. Deterministic modulo the date stamp; a range that cannot be anchored degrades the changelog + audit sections to a notice while the rest still renders. | 감사 번들 | > **Internal name — the drive loop.** The `run` verb's loop is internally the diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 613302aa..69fce466 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,102 +4,102 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var Kde=Object.create;var OA=Object.defineProperty;var Jde=Object.getOwnPropertyDescriptor;var Yde=Object.getOwnPropertyNames;var Xde=Object.getPrototypeOf,Qde=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{for(var r in e)OA(t,r,{get:e[r],enumerable:!0})},efe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Yde(e))!Qde.call(t,i)&&i!==r&&OA(t,i,{get:()=>e[i],enumerable:!(n=Jde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Kde(Xde(t)):{},efe(e||!t||!t.__esModule?OA(r,"default",{value:t,enumerable:!0}):r,t));var cf=v(IA=>{var wy=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},RA=class extends wy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};IA.CommanderError=wy;IA.InvalidArgumentError=RA});var xy=v(CA=>{var{InvalidArgumentError:tfe}=cf(),PA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new tfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function rfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}CA.Argument=PA;CA.humanReadableArgName=rfe});var jA=v(NA=>{var{humanReadableArgName:nfe}=xy(),DA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>nfe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` -`)}displayWidth(e){return h4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return utypeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dr=(t,e)=>{for(var r in e)PA(t,r,{get:e[r],enumerable:!0})},tfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xde(e))!efe.call(t,i)&&i!==r&&PA(t,i,{get:()=>e[i],enumerable:!(n=Yde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Jde(Qde(t)):{},tfe(e||!t||!t.__esModule?PA(r,"default",{value:t,enumerable:!0}):r,t));var lf=v(DA=>{var ky=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},CA=class extends ky{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};DA.CommanderError=ky;DA.InvalidArgumentError=CA});var Ey=v(jA=>{var{InvalidArgumentError:rfe}=lf(),NA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new rfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function nfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}jA.Argument=NA;jA.humanReadableArgName=nfe});var LA=v(FA=>{var{humanReadableArgName:ife}=Ey(),MA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>ife(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +`)}displayWidth(e){return y4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function h4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}NA.Help=DA;NA.stripColor=h4});var zA=v(LA=>{var{InvalidArgumentError:ife}=cf(),MA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ofe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ife(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?g4(this.name().replace(/^no-/,"")):g4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},FA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function g4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function ofe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function y4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}FA.Help=MA;FA.stripColor=y4});var BA=v(qA=>{var{InvalidArgumentError:ofe}=lf(),zA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=sfe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ofe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?_4(this.name().replace(/^no-/,"")):_4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},UA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function _4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function sfe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}LA.Option=MA;LA.DualOptions=FA});var _4=v(y4=>{function sfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function afe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=sfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}qA.Option=zA;qA.DualOptions=UA});var v4=v(b4=>{function afe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function cfe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=afe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}y4.suggestSimilar=afe});var w4=v(GA=>{var cfe=Ge("node:events").EventEmitter,UA=Ge("node:child_process"),fo=Ge("node:path"),$y=Ge("node:fs"),Be=Ge("node:process"),{Argument:lfe,humanReadableArgName:ufe}=xy(),{CommanderError:qA}=cf(),{Help:dfe,stripColor:ffe}=jA(),{Option:b4,DualOptions:pfe}=zA(),{suggestSimilar:v4}=_4(),BA=class t extends cfe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>HA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>HA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>ffe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new dfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name -- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new lfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. -Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new qA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new b4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' -- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof b4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. -- 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(e,r,n){if($y.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist +(Did you mean ${n[0]}?)`:""}b4.suggestSimilar=cfe});var $4=v(WA=>{var lfe=Ge("node:events").EventEmitter,HA=Ge("node:child_process"),po=Ge("node:path"),Ay=Ge("node:fs"),Be=Ge("node:process"),{Argument:ufe,humanReadableArgName:dfe}=Ey(),{CommanderError:GA}=lf(),{Help:ffe,stripColor:pfe}=LA(),{Option:S4,DualOptions:mfe}=BA(),{suggestSimilar:w4}=v4(),ZA=class t extends lfe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>VA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>VA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>pfe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new ffe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new ufe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. +Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new GA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new S4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' +- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof S4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. +- 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(e,r,n){if(Ay.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=fo.resolve(u,d);if($y.existsSync(f))return f;if(i.includes(fo.extname(d)))return;let p=i.find(m=>$y.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=$y.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=fo.resolve(fo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=fo.basename(this._scriptPath,fo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(fo.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=S4(Be.execArgv).concat(r),c=UA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=UA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=S4(Be.execArgv).concat(r),c=UA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new qA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new qA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=po.resolve(u,d);if(Ay.existsSync(f))return f;if(i.includes(po.extname(d)))return;let p=i.find(m=>Ay.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=po.resolve(po.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=po.basename(this._scriptPath,po.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(po.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=x4(Be.execArgv).concat(r),c=HA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=HA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=x4(Be.execArgv).concat(r),c=HA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new GA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new GA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` -`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new pfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=v4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=v4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} -`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>ufe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=fo.basename(e,fo.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new mfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=w4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=w4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} +`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>dfe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=po.basename(e,po.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function S4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function HA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}GA.Command=BA;GA.useColor=HA});var E4=v(An=>{var{Argument:x4}=xy(),{Command:ZA}=w4(),{CommanderError:mfe,InvalidArgumentError:$4}=cf(),{Help:hfe}=jA(),{Option:k4}=zA();An.program=new ZA;An.createCommand=t=>new ZA(t);An.createOption=(t,e)=>new k4(t,e);An.createArgument=(t,e)=>new x4(t,e);An.Command=ZA;An.Option=k4;An.Argument=x4;An.Help=hfe;An.CommanderError=mfe;An.InvalidArgumentError=$4;An.InvalidOptionArgumentError=$4});var De=v(Qt=>{"use strict";var WA=Symbol.for("yaml.alias"),R4=Symbol.for("yaml.document"),ky=Symbol.for("yaml.map"),I4=Symbol.for("yaml.pair"),KA=Symbol.for("yaml.scalar"),Ey=Symbol.for("yaml.seq"),po=Symbol.for("yaml.node.type"),Sfe=t=>!!t&&typeof t=="object"&&t[po]===WA,wfe=t=>!!t&&typeof t=="object"&&t[po]===R4,xfe=t=>!!t&&typeof t=="object"&&t[po]===ky,$fe=t=>!!t&&typeof t=="object"&&t[po]===I4,P4=t=>!!t&&typeof t=="object"&&t[po]===KA,kfe=t=>!!t&&typeof t=="object"&&t[po]===Ey;function C4(t){if(t&&typeof t=="object")switch(t[po]){case ky:case Ey:return!0}return!1}function Efe(t){if(t&&typeof t=="object")switch(t[po]){case WA:case ky:case KA:case Ey:return!0}return!1}var Afe=t=>(P4(t)||C4(t))&&!!t.anchor;Qt.ALIAS=WA;Qt.DOC=R4;Qt.MAP=ky;Qt.NODE_TYPE=po;Qt.PAIR=I4;Qt.SCALAR=KA;Qt.SEQ=Ey;Qt.hasAnchor=Afe;Qt.isAlias=Sfe;Qt.isCollection=C4;Qt.isDocument=wfe;Qt.isMap=xfe;Qt.isNode=Efe;Qt.isPair=$fe;Qt.isScalar=P4;Qt.isSeq=kfe});var lf=v(JA=>{"use strict";var Ut=De(),Dr=Symbol("break visit"),D4=Symbol("skip children"),Ai=Symbol("remove node");function Ay(t,e){let r=N4(e);Ut.isDocument(t)?Qc(null,t.contents,r,Object.freeze([t]))===Ai&&(t.contents=null):Qc(null,t,r,Object.freeze([]))}Ay.BREAK=Dr;Ay.SKIP=D4;Ay.REMOVE=Ai;function Qc(t,e,r,n){let i=j4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return M4(t,n,i),Qc(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var F4=De(),Tfe=lf(),Ofe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rfe=t=>t.replace(/[!,[\]{}]/g,e=>Ofe[e]),uf=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Rfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&F4.isNode(e.contents)){let o={};Tfe.visit(e.contents,(s,a)=>{F4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};uf.defaultYaml={explicit:!1,version:"1.2"};uf.defaultTags={"!!":"tag:yaml.org,2002:"};L4.Directives=uf});var Oy=v(df=>{"use strict";var z4=De(),Ife=lf();function Pfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function U4(t){let e=new Set;return Ife.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function q4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Cfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=U4(t));let s=q4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(z4.isScalar(s.node)||z4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}df.anchorIsValid=Pfe;df.anchorNames=U4;df.createNodeAnchors=Cfe;df.findNewAnchor=q4});var XA=v(B4=>{"use strict";function ff(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Dfe=De();function H4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>H4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Dfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}G4.toJS=H4});var Ry=v(V4=>{"use strict";var Nfe=XA(),Z4=De(),jfe=Vo(),QA=class{constructor(e){Object.defineProperty(this,Z4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!Z4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=jfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Nfe.applyReviver(o,{"":a},"",a):a}};V4.NodeBase=QA});var pf=v(W4=>{"use strict";var Mfe=Oy(),Ffe=lf(),tl=De(),Lfe=Ry(),zfe=Vo(),eT=class extends Lfe.NodeBase{constructor(e){super(tl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Ffe.visit(e,{Node:(o,s)=>{(tl.isAlias(s)||tl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(zfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Iy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Mfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Iy(t,e,r){if(tl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(tl.isCollection(e)){let n=0;for(let i of e.items){let o=Iy(t,i,r);o>n&&(n=o)}return n}else if(tl.isPair(e)){let n=Iy(t,e.key,r),i=Iy(t,e.value,r);return Math.max(n,i)}return 1}W4.Alias=eT});var Dt=v(tT=>{"use strict";var Ufe=De(),qfe=Ry(),Bfe=Vo(),Hfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends qfe.NodeBase{constructor(e){super(Ufe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Bfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";tT.Scalar=Wo;tT.isScalarValue=Hfe});var mf=v(J4=>{"use strict";var Gfe=pf(),fa=De(),K4=Dt(),Zfe="tag:yaml.org,2002:";function Vfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Wfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Gfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Zfe+e.slice(2));let l=Vfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new K4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new K4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}J4.createNode=Wfe});var Cy=v(Py=>{"use strict";var Kfe=mf(),Ti=De(),Jfe=Ry();function rT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Kfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Y4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nT=class extends Jfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Y4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Ti.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Ti.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,rT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Py.Collection=nT;Py.collectionFromPath=rT;Py.isEmptyPath=Y4});var hf=v(Dy=>{"use strict";var Yfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function iT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Xfe=(t,e,r)=>t.endsWith(` -`)?iT(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function x4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function VA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}WA.Command=ZA;WA.useColor=VA});var T4=v(Tn=>{var{Argument:k4}=Ey(),{Command:KA}=$4(),{CommanderError:hfe,InvalidArgumentError:E4}=lf(),{Help:gfe}=LA(),{Option:A4}=BA();Tn.program=new KA;Tn.createCommand=t=>new KA(t);Tn.createOption=(t,e)=>new A4(t,e);Tn.createArgument=(t,e)=>new k4(t,e);Tn.Command=KA;Tn.Option=A4;Tn.Argument=k4;Tn.Help=gfe;Tn.CommanderError=hfe;Tn.InvalidArgumentError=E4;Tn.InvalidOptionArgumentError=E4});var De=v(Qt=>{"use strict";var YA=Symbol.for("yaml.alias"),P4=Symbol.for("yaml.document"),Ty=Symbol.for("yaml.map"),C4=Symbol.for("yaml.pair"),XA=Symbol.for("yaml.scalar"),Oy=Symbol.for("yaml.seq"),mo=Symbol.for("yaml.node.type"),wfe=t=>!!t&&typeof t=="object"&&t[mo]===YA,xfe=t=>!!t&&typeof t=="object"&&t[mo]===P4,$fe=t=>!!t&&typeof t=="object"&&t[mo]===Ty,kfe=t=>!!t&&typeof t=="object"&&t[mo]===C4,D4=t=>!!t&&typeof t=="object"&&t[mo]===XA,Efe=t=>!!t&&typeof t=="object"&&t[mo]===Oy;function N4(t){if(t&&typeof t=="object")switch(t[mo]){case Ty:case Oy:return!0}return!1}function Afe(t){if(t&&typeof t=="object")switch(t[mo]){case YA:case Ty:case XA:case Oy:return!0}return!1}var Tfe=t=>(D4(t)||N4(t))&&!!t.anchor;Qt.ALIAS=YA;Qt.DOC=P4;Qt.MAP=Ty;Qt.NODE_TYPE=mo;Qt.PAIR=C4;Qt.SCALAR=XA;Qt.SEQ=Oy;Qt.hasAnchor=Tfe;Qt.isAlias=wfe;Qt.isCollection=N4;Qt.isDocument=xfe;Qt.isMap=$fe;Qt.isNode=Afe;Qt.isPair=kfe;Qt.isScalar=D4;Qt.isSeq=Efe});var uf=v(QA=>{"use strict";var Ut=De(),Nr=Symbol("break visit"),j4=Symbol("skip children"),Ti=Symbol("remove node");function Ry(t,e){let r=M4(e);Ut.isDocument(t)?el(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):el(null,t,r,Object.freeze([]))}Ry.BREAK=Nr;Ry.SKIP=j4;Ry.REMOVE=Ti;function el(t,e,r,n){let i=F4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return L4(t,n,i),el(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var z4=De(),Ofe=uf(),Rfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ife=t=>t.replace(/[!,[\]{}]/g,e=>Rfe[e]),df=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Ife(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&z4.isNode(e.contents)){let o={};Ofe.visit(e.contents,(s,a)=>{z4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};df.defaultYaml={explicit:!1,version:"1.2"};df.defaultTags={"!!":"tag:yaml.org,2002:"};U4.Directives=df});var Py=v(ff=>{"use strict";var q4=De(),Pfe=uf();function Cfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function B4(t){let e=new Set;return Pfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function H4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Dfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=B4(t));let s=H4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(q4.isScalar(s.node)||q4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}ff.anchorIsValid=Cfe;ff.anchorNames=B4;ff.createNodeAnchors=Dfe;ff.findNewAnchor=H4});var tT=v(G4=>{"use strict";function pf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Nfe=De();function Z4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Z4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Nfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}V4.toJS=Z4});var Cy=v(K4=>{"use strict";var jfe=tT(),W4=De(),Mfe=Vo(),rT=class{constructor(e){Object.defineProperty(this,W4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!W4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Mfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?jfe.applyReviver(o,{"":a},"",a):a}};K4.NodeBase=rT});var mf=v(J4=>{"use strict";var Ffe=Py(),Lfe=uf(),rl=De(),zfe=Cy(),Ufe=Vo(),nT=class extends zfe.NodeBase{constructor(e){super(rl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Lfe.visit(e,{Node:(o,s)=>{(rl.isAlias(s)||rl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(Ufe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Dy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Ffe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Dy(t,e,r){if(rl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(rl.isCollection(e)){let n=0;for(let i of e.items){let o=Dy(t,i,r);o>n&&(n=o)}return n}else if(rl.isPair(e)){let n=Dy(t,e.key,r),i=Dy(t,e.value,r);return Math.max(n,i)}return 1}J4.Alias=nT});var Dt=v(iT=>{"use strict";var qfe=De(),Bfe=Cy(),Hfe=Vo(),Gfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends Bfe.NodeBase{constructor(e){super(qfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Hfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";iT.Scalar=Wo;iT.isScalarValue=Gfe});var hf=v(X4=>{"use strict";var Zfe=mf(),fa=De(),Y4=Dt(),Vfe="tag:yaml.org,2002:";function Wfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Kfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Zfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Vfe+e.slice(2));let l=Wfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Y4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Y4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}X4.createNode=Kfe});var jy=v(Ny=>{"use strict";var Jfe=hf(),Oi=De(),Yfe=Cy();function oT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Jfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Q4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,sT=class extends Yfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Q4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ny.Collection=sT;Ny.collectionFromPath=oT;Ny.isEmptyPath=Q4});var gf=v(My=>{"use strict";var Xfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function aT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Qfe=(t,e,r)=>t.endsWith(` +`)?aT(r,e):r.includes(` `)?` -`+iT(r,e):(t.endsWith(" ")?"":" ")+r;Dy.indentComment=iT;Dy.lineComment=Xfe;Dy.stringifyComment=Yfe});var Q4=v(gf=>{"use strict";var Qfe="flow",oT="block",Ny="quoted";function epe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===oT&&(h=X4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Ny&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` -`)r===oT&&(h=X4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+aT(r,e):(t.endsWith(" ")?"":" ")+r;My.indentComment=aT;My.lineComment=Qfe;My.stringifyComment=Xfe});var t6=v(yf=>{"use strict";var epe="flow",cT="block",Fy="quoted";function tpe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===cT&&(h=e6(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Fy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`)r===cT&&(h=e6(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` -`&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Ny){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Jn=Dt(),Ko=Q4(),My=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Fy=t=>/^(%|---|\.\.\.)/m.test(t);function tpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function yf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Fy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Fy){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Yn=Dt(),Ko=t6(),zy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Uy=t=>/^(%|---|\.\.\.)/m.test(t);function rpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function _f(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Uy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` `);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(aT,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Ko.foldFlowLines(`${_}${w}${p}`,l,Ko.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=zy(n,!0);s!=="folded"&&e!==Yn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Ko.foldFlowLines(`${_}${w}${p}`,l,Ko.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function rpe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` -`)||u&&/[[\]{},]/.test(o))return rl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?rl(o,e):jy(t,e,r,n);if(!a&&!u&&i!==Jn.Scalar.PLAIN&&o.includes(` -`))return jy(t,e,r,n);if(Fy(o)){if(c==="")return e.forceBlockIndent=!0,jy(t,e,r,n);if(a&&c===l)return rl(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return rl(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,My(e,!1))}function npe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Jn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Jn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Jn.Scalar.BLOCK_FOLDED:case Jn.Scalar.BLOCK_LITERAL:return i||o?rl(s.value,e):jy(s,e,r,n);case Jn.Scalar.QUOTE_DOUBLE:return yf(s.value,e);case Jn.Scalar.QUOTE_SINGLE:return sT(s.value,e);case Jn.Scalar.PLAIN:return rpe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}e6.stringifyString=npe});var bf=v(cT=>{"use strict";var ipe=Oy(),Jo=De(),ope=hf(),spe=_f();function ape(t,e){let r=Object.assign({blockQuote:!0,commentString:ope.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function cpe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function lpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&ipe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function upe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=cpe(e.doc.schema.tags,o));let s=lpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?spe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}cT.createStringifyContext=ape;cT.stringify=upe});var i6=v(n6=>{"use strict";var mo=De(),t6=Dt(),r6=bf(),vf=hf();function dpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=mo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mo.isCollection(t)||!mo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||mo.isCollection(t)||(mo.isScalar(t)?t.type===t6.Scalar.BLOCK_FOLDED||t.type===t6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=r6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=vf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=vf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=vf.lineComment(g,r.indent,l(f))));let b,_,S;mo.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&mo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=r6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function npe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` +`)||u&&/[[\]{},]/.test(o))return nl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?nl(o,e):Ly(t,e,r,n);if(!a&&!u&&i!==Yn.Scalar.PLAIN&&o.includes(` +`))return Ly(t,e,r,n);if(Uy(o)){if(c==="")return e.forceBlockIndent=!0,Ly(t,e,r,n);if(a&&c===l)return nl(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return nl(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,zy(e,!1))}function ipe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Yn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Yn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Yn.Scalar.BLOCK_FOLDED:case Yn.Scalar.BLOCK_LITERAL:return i||o?nl(s.value,e):Ly(s,e,r,n);case Yn.Scalar.QUOTE_DOUBLE:return _f(s.value,e);case Yn.Scalar.QUOTE_SINGLE:return lT(s.value,e);case Yn.Scalar.PLAIN:return npe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}r6.stringifyString=ipe});var vf=v(dT=>{"use strict";var ope=Py(),Jo=De(),spe=gf(),ape=bf();function cpe(t,e){let r=Object.assign({blockQuote:!0,commentString:spe.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function lpe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function upe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&ope.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function dpe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=lpe(e.doc.schema.tags,o));let s=upe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?ape.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}dT.createStringifyContext=cpe;dT.stringify=dpe});var s6=v(o6=>{"use strict";var ho=De(),n6=Dt(),i6=vf(),Sf=gf();function fpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=ho.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ho.isCollection(t)||!ho.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||ho.isCollection(t)||(ho.isScalar(t)?t.type===n6.Scalar.BLOCK_FOLDED||t.type===n6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=i6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=Sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Sf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=Sf.lineComment(g,r.indent,l(f))));let b,_,S;ho.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&ho.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ho.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=i6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${vf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${Sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&mo.isCollection(e)){let T=w[0],A=w.indexOf(` +${r.indent}`}else if(!p&&ho.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let re=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var o6=Ge("process");function fpe(t,...e){t==="debug"&&console.log(...e)}function ppe(t,e){(t==="debug"||t==="warn")&&(typeof o6.emitWarning=="function"?o6.emitWarning(e):console.warn(e))}lT.debug=fpe;lT.warn=ppe});var By=v(qy=>{"use strict";var Uy=De(),s6=Dt(),Ly="<<",zy={identify:t=>t===Ly||typeof t=="symbol"&&t.description===Ly,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new s6.Scalar(Symbol(Ly)),{addToJSMap:a6}),stringify:()=>Ly},mpe=(t,e)=>(zy.identify(e)||Uy.isScalar(e)&&(!e.type||e.type===s6.Scalar.PLAIN)&&zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===zy.tag&&r.default);function a6(t,e,r){let n=c6(t,r);if(Uy.isSeq(n))for(let i of n.items)dT(t,e,i);else if(Array.isArray(n))for(let i of n)dT(t,e,i);else dT(t,e,n)}function dT(t,e,r){let n=c6(t,r);if(!Uy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function c6(t,e){return t&&Uy.isAlias(e)?e.resolve(t.doc,t):e}qy.addMergeToJSMap=a6;qy.isMergeKey=mpe;qy.merge=zy});var pT=v(d6=>{"use strict";var hpe=uT(),l6=By(),gpe=bf(),u6=De(),fT=Vo();function ype(t,e,{key:r,value:n}){if(u6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(l6.isMergeKey(t,r))l6.addMergeToJSMap(t,e,n);else{let i=fT.toJS(r,"",t);if(e instanceof Map)e.set(i,fT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=_pe(r,i,t),s=fT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function _pe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(u6.isNode(t)&&r?.doc){let n=gpe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),hpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}d6.addPairToJSMap=ype});var Yo=v(mT=>{"use strict";var f6=mf(),bpe=i6(),vpe=pT(),Hy=De();function Spe(t,e,r){let n=f6.createNode(t,void 0,r),i=f6.createNode(e,void 0,r);return new Gy(n,i)}var Gy=class t{constructor(e,r=null){Object.defineProperty(this,Hy.NODE_TYPE,{value:Hy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Hy.isNode(r)&&(r=r.clone(e)),Hy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return vpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?bpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};mT.Pair=Gy;mT.createPair=Spe});var hT=v(m6=>{"use strict";var pa=De(),p6=bf(),Zy=hf();function wpe(t,e,r){return(e.inFlow??t.flow?$pe:xpe)(t,e,r)}function xpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Zy.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var a6=Ge("process");function ppe(t,...e){t==="debug"&&console.log(...e)}function mpe(t,e){(t==="debug"||t==="warn")&&(typeof a6.emitWarning=="function"?a6.emitWarning(e):console.warn(e))}fT.debug=ppe;fT.warn=mpe});var Zy=v(Gy=>{"use strict";var Hy=De(),c6=Dt(),qy="<<",By={identify:t=>t===qy||typeof t=="symbol"&&t.description===qy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c6.Scalar(Symbol(qy)),{addToJSMap:l6}),stringify:()=>qy},hpe=(t,e)=>(By.identify(e)||Hy.isScalar(e)&&(!e.type||e.type===c6.Scalar.PLAIN)&&By.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===By.tag&&r.default);function l6(t,e,r){let n=u6(t,r);if(Hy.isSeq(n))for(let i of n.items)mT(t,e,i);else if(Array.isArray(n))for(let i of n)mT(t,e,i);else mT(t,e,n)}function mT(t,e,r){let n=u6(t,r);if(!Hy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function u6(t,e){return t&&Hy.isAlias(e)?e.resolve(t.doc,t):e}Gy.addMergeToJSMap=l6;Gy.isMergeKey=hpe;Gy.merge=By});var gT=v(p6=>{"use strict";var gpe=pT(),d6=Zy(),ype=vf(),f6=De(),hT=Vo();function _pe(t,e,{key:r,value:n}){if(f6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(d6.isMergeKey(t,r))d6.addMergeToJSMap(t,e,n);else{let i=hT.toJS(r,"",t);if(e instanceof Map)e.set(i,hT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=bpe(r,i,t),s=hT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function bpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(f6.isNode(t)&&r?.doc){let n=ype.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),gpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}p6.addPairToJSMap=_pe});var Yo=v(yT=>{"use strict";var m6=hf(),vpe=s6(),Spe=gT(),Vy=De();function wpe(t,e,r){let n=m6.createNode(t,void 0,r),i=m6.createNode(e,void 0,r);return new Wy(n,i)}var Wy=class t{constructor(e,r=null){Object.defineProperty(this,Vy.NODE_TYPE,{value:Vy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Vy.isNode(r)&&(r=r.clone(e)),Vy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Spe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?vpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};yT.Pair=Wy;yT.createPair=wpe});var _T=v(g6=>{"use strict";var pa=De(),h6=vf(),Ky=gf();function xpe(t,e,r){return(e.inFlow??t.flow?kpe:$pe)(t,e,r)}function $pe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Ky.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` -`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Zy.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` +`+Ky.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function kpe({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` +`)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Ky.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Vy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Zy.indentComment(e(n),t);r.push(o.trimStart())}}m6.stringifyCollection=wpe});var Qo=v(yT=>{"use strict";var kpe=hT(),Epe=pT(),Ape=Cy(),Xo=De(),Wy=Yo(),Tpe=Dt();function Sf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var gT=class extends Ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Wy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Wy.Pair(e,e?.value):n=new Wy.Pair(e.key,e.value);let i=Sf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Tpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=Sf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Sf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!Sf(this.items,e)}set(e,r){this.add(new Wy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Epe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),kpe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};yT.YAMLMap=gT;yT.findPair=Sf});var nl=v(g6=>{"use strict";var Ope=De(),h6=Qo(),Rpe={collection:"map",default:!0,nodeClass:h6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ope.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>h6.YAMLMap.from(t,e,r)};g6.map=Rpe});var es=v(y6=>{"use strict";var Ipe=mf(),Ppe=hT(),Cpe=Cy(),Jy=De(),Dpe=Dt(),Npe=Vo(),_T=class extends Cpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Jy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ky(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ky(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Jy.isScalar(i)?i.value:i}has(e){let r=Ky(e);return typeof r=="number"&&r=0?e:null}y6.YAMLSeq=_T});var il=v(b6=>{"use strict";var jpe=De(),_6=es(),Mpe={collection:"seq",default:!0,nodeClass:_6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return jpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>_6.YAMLSeq.from(t,e,r)};b6.seq=Mpe});var wf=v(v6=>{"use strict";var Fpe=_f(),Lpe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Fpe.stringifyString(t,e,r,n)}};v6.string=Lpe});var Yy=v(x6=>{"use strict";var S6=Dt(),w6={identify:t=>t==null,createNode:()=>new S6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&w6.test.test(t)?t:e.options.nullStr};x6.nullTag=w6});var bT=v(k6=>{"use strict";var zpe=Dt(),$6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new zpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&$6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};k6.boolTag=$6});var ol=v(E6=>{"use strict";function Upe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}E6.stringifyNumber=Upe});var ST=v(Xy=>{"use strict";var qpe=Dt(),vT=ol(),Bpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vT.stringifyNumber},Hpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():vT.stringifyNumber(t)}},Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new qpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:vT.stringifyNumber};Xy.float=Gpe;Xy.floatExp=Hpe;Xy.floatNaN=Bpe});var xT=v(e_=>{"use strict";var A6=ol(),Qy=t=>typeof t=="bigint"||Number.isInteger(t),wT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function T6(t,e,r){let{value:n}=t;return Qy(n)&&n>=0?r+n.toString(e):A6.stringifyNumber(t)}var Zpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>wT(t,2,8,r),stringify:t=>T6(t,8,"0o")},Vpe={identify:Qy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>wT(t,0,10,r),stringify:A6.stringifyNumber},Wpe={identify:t=>Qy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>wT(t,2,16,r),stringify:t=>T6(t,16,"0x")};e_.int=Vpe;e_.intHex=Wpe;e_.intOct=Zpe});var R6=v(O6=>{"use strict";var Kpe=nl(),Jpe=Yy(),Ype=il(),Xpe=wf(),Qpe=bT(),$T=ST(),kT=xT(),eme=[Kpe.map,Ype.seq,Xpe.string,Jpe.nullTag,Qpe.boolTag,kT.intOct,kT.int,kT.intHex,$T.floatNaN,$T.floatExp,$T.float];O6.schema=eme});var C6=v(P6=>{"use strict";var tme=Dt(),rme=nl(),nme=il();function I6(t){return typeof t=="bigint"||Number.isInteger(t)}var t_=({value:t})=>JSON.stringify(t),ime=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:t_},{identify:t=>t==null,createNode:()=>new tme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:t_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:t_},{identify:I6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>I6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:t_}],ome={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},sme=[rme.map,nme.seq].concat(ime,ome);P6.schema=sme});var AT=v(D6=>{"use strict";var xf=Ge("buffer"),ET=Dt(),ame=_f(),cme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof xf.Buffer=="function")return xf.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var r_=De(),TT=Yo(),lme=Dt(),ume=es();function N6(t,e){if(r_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new TT.Pair(new lme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Jy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ky.indentComment(e(n),t);r.push(o.trimStart())}}g6.stringifyCollection=xpe});var Qo=v(vT=>{"use strict";var Epe=_T(),Ape=gT(),Tpe=jy(),Xo=De(),Yy=Yo(),Ope=Dt();function wf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var bT=class extends Tpe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Yy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yy.Pair(e,e?.value):n=new Yy.Pair(e.key,e.value);let i=wf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Ope.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=wf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=wf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!wf(this.items,e)}set(e,r){this.add(new Yy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Ape.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Epe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};vT.YAMLMap=bT;vT.findPair=wf});var il=v(_6=>{"use strict";var Rpe=De(),y6=Qo(),Ipe={collection:"map",default:!0,nodeClass:y6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Rpe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>y6.YAMLMap.from(t,e,r)};_6.map=Ipe});var es=v(b6=>{"use strict";var Ppe=hf(),Cpe=_T(),Dpe=jy(),Qy=De(),Npe=Dt(),jpe=Vo(),ST=class extends Dpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Xy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Xy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Qy.isScalar(i)?i.value:i}has(e){let r=Xy(e);return typeof r=="number"&&r=0?e:null}b6.YAMLSeq=ST});var ol=v(S6=>{"use strict";var Mpe=De(),v6=es(),Fpe={collection:"seq",default:!0,nodeClass:v6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Mpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>v6.YAMLSeq.from(t,e,r)};S6.seq=Fpe});var xf=v(w6=>{"use strict";var Lpe=bf(),zpe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Lpe.stringifyString(t,e,r,n)}};w6.string=zpe});var e_=v(k6=>{"use strict";var x6=Dt(),$6={identify:t=>t==null,createNode:()=>new x6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new x6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&$6.test.test(t)?t:e.options.nullStr};k6.nullTag=$6});var wT=v(A6=>{"use strict";var Upe=Dt(),E6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Upe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&E6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};A6.boolTag=E6});var sl=v(T6=>{"use strict";function qpe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}T6.stringifyNumber=qpe});var $T=v(t_=>{"use strict";var Bpe=Dt(),xT=sl(),Hpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xT.stringifyNumber},Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():xT.stringifyNumber(t)}},Zpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Bpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:xT.stringifyNumber};t_.float=Zpe;t_.floatExp=Gpe;t_.floatNaN=Hpe});var ET=v(n_=>{"use strict";var O6=sl(),r_=t=>typeof t=="bigint"||Number.isInteger(t),kT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R6(t,e,r){let{value:n}=t;return r_(n)&&n>=0?r+n.toString(e):O6.stringifyNumber(t)}var Vpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>kT(t,2,8,r),stringify:t=>R6(t,8,"0o")},Wpe={identify:r_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>kT(t,0,10,r),stringify:O6.stringifyNumber},Kpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>kT(t,2,16,r),stringify:t=>R6(t,16,"0x")};n_.int=Wpe;n_.intHex=Kpe;n_.intOct=Vpe});var P6=v(I6=>{"use strict";var Jpe=il(),Ype=e_(),Xpe=ol(),Qpe=xf(),eme=wT(),AT=$T(),TT=ET(),tme=[Jpe.map,Xpe.seq,Qpe.string,Ype.nullTag,eme.boolTag,TT.intOct,TT.int,TT.intHex,AT.floatNaN,AT.floatExp,AT.float];I6.schema=tme});var N6=v(D6=>{"use strict";var rme=Dt(),nme=il(),ime=ol();function C6(t){return typeof t=="bigint"||Number.isInteger(t)}var i_=({value:t})=>JSON.stringify(t),ome=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:i_},{identify:t=>t==null,createNode:()=>new rme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:i_},{identify:C6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>C6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:i_}],sme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},ame=[nme.map,ime.seq].concat(ome,sme);D6.schema=ame});var RT=v(j6=>{"use strict";var $f=Ge("buffer"),OT=Dt(),cme=bf(),lme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $f.Buffer=="function")return $f.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var o_=De(),IT=Yo(),ume=Dt(),dme=es();function M6(t,e){if(o_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new IT.Pair(new ume.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=r_.isPair(n)?n:new TT.Pair(n)}}else e("Expected a sequence for this tag");return t}function j6(t,e,r){let{replacer:n}=r,i=new ume.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(TT.createPair(a,c,r))}return i}var dme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:N6,createNode:j6};n_.createPairs=j6;n_.pairs=dme;n_.resolvePairs=N6});var IT=v(RT=>{"use strict";var M6=De(),OT=Vo(),$f=Qo(),fme=es(),F6=i_(),ma=class t extends fme.YAMLSeq{constructor(){super(),this.add=$f.YAMLMap.prototype.add.bind(this),this.delete=$f.YAMLMap.prototype.delete.bind(this),this.get=$f.YAMLMap.prototype.get.bind(this),this.has=$f.YAMLMap.prototype.has.bind(this),this.set=$f.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(M6.isPair(i)?(o=OT.toJS(i.key,"",r),s=OT.toJS(i.value,o,r)):o=OT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=F6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var pme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=F6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)M6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};RT.YAMLOMap=ma;RT.omap=pme});var B6=v(PT=>{"use strict";var L6=Dt();function z6({value:t,source:e},r){return e&&(t?U6:q6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var U6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new L6.Scalar(!0),stringify:z6},q6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new L6.Scalar(!1),stringify:z6};PT.falseTag=q6;PT.trueTag=U6});var H6=v(o_=>{"use strict";var mme=Dt(),CT=ol(),hme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:CT.stringifyNumber},gme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():CT.stringifyNumber(t)}},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new mme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:CT.stringifyNumber};o_.float=yme;o_.floatExp=gme;o_.floatNaN=hme});var Z6=v(Ef=>{"use strict";var G6=ol(),kf=t=>typeof t=="bigint"||Number.isInteger(t);function s_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function DT(t,e,r){let{value:n}=t;if(kf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return G6.stringifyNumber(t)}var _me={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>s_(t,2,2,r),stringify:t=>DT(t,2,"0b")},bme={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>s_(t,1,8,r),stringify:t=>DT(t,8,"0")},vme={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>s_(t,0,10,r),stringify:G6.stringifyNumber},Sme={identify:kf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>s_(t,2,16,r),stringify:t=>DT(t,16,"0x")};Ef.int=vme;Ef.intBin=_me;Ef.intHex=Sme;Ef.intOct=bme});var jT=v(NT=>{"use strict";var l_=De(),a_=Yo(),c_=Qo(),ha=class t extends c_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;l_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new a_.Pair(e.key,null):r=new a_.Pair(e,null),c_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=c_.findPair(this.items,e);return!r&&l_.isPair(n)?l_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=c_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new a_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(a_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var wme={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(l_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};NT.YAMLSet=ha;NT.set=wme});var FT=v(u_=>{"use strict";var xme=ol();function MT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function V6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return xme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $me={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>MT(t,r),stringify:V6},kme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>MT(t,!1),stringify:V6},W6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(W6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=MT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};u_.floatTime=kme;u_.intTime=$me;u_.timestamp=W6});var Y6=v(J6=>{"use strict";var Eme=nl(),Ame=Yy(),Tme=il(),Ome=wf(),Rme=AT(),K6=B6(),LT=H6(),d_=Z6(),Ime=By(),Pme=IT(),Cme=i_(),Dme=jT(),zT=FT(),Nme=[Eme.map,Tme.seq,Ome.string,Ame.nullTag,K6.trueTag,K6.falseTag,d_.intBin,d_.intOct,d_.int,d_.intHex,LT.floatNaN,LT.floatExp,LT.float,Rme.binary,Ime.merge,Pme.omap,Cme.pairs,Dme.set,zT.intTime,zT.floatTime,zT.timestamp];J6.schema=Nme});var aB=v(BT=>{"use strict";var tB=nl(),jme=Yy(),rB=il(),Mme=wf(),Fme=bT(),UT=ST(),qT=xT(),Lme=R6(),zme=C6(),nB=AT(),Af=By(),iB=IT(),oB=i_(),X6=Y6(),sB=jT(),f_=FT(),Q6=new Map([["core",Lme.schema],["failsafe",[tB.map,rB.seq,Mme.string]],["json",zme.schema],["yaml11",X6.schema],["yaml-1.1",X6.schema]]),eB={binary:nB.binary,bool:Fme.boolTag,float:UT.float,floatExp:UT.floatExp,floatNaN:UT.floatNaN,floatTime:f_.floatTime,int:qT.int,intHex:qT.intHex,intOct:qT.intOct,intTime:f_.intTime,map:tB.map,merge:Af.merge,null:jme.nullTag,omap:iB.omap,pairs:oB.pairs,seq:rB.seq,set:sB.set,timestamp:f_.timestamp},Ume={"tag:yaml.org,2002:binary":nB.binary,"tag:yaml.org,2002:merge":Af.merge,"tag:yaml.org,2002:omap":iB.omap,"tag:yaml.org,2002:pairs":oB.pairs,"tag:yaml.org,2002:set":sB.set,"tag:yaml.org,2002:timestamp":f_.timestamp};function qme(t,e,r){let n=Q6.get(e);if(n&&!t)return r&&!n.includes(Af.merge)?n.concat(Af.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Q6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Af.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?eB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(eB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}BT.coreKnownTags=Ume;BT.getTags=qme});var ZT=v(cB=>{"use strict";var HT=De(),Bme=nl(),Hme=il(),Gme=wf(),p_=aB(),Zme=(t,e)=>t.keye.key?1:0,GT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?p_.getTags(e,"compat"):e?p_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?p_.coreKnownTags:{},this.tags=p_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,HT.MAP,{value:Bme.map}),Object.defineProperty(this,HT.SCALAR,{value:Gme.string}),Object.defineProperty(this,HT.SEQ,{value:Hme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Zme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};cB.Schema=GT});var uB=v(lB=>{"use strict";var Vme=De(),VT=bf(),Tf=hf();function Wme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=VT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Tf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Vme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Tf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=VT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Tf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(VT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(Tf.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Tf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=o_.isPair(n)?n:new IT.Pair(n)}}else e("Expected a sequence for this tag");return t}function F6(t,e,r){let{replacer:n}=r,i=new dme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(IT.createPair(a,c,r))}return i}var fme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:M6,createNode:F6};s_.createPairs=F6;s_.pairs=fme;s_.resolvePairs=M6});var DT=v(CT=>{"use strict";var L6=De(),PT=Vo(),kf=Qo(),pme=es(),z6=a_(),ma=class t extends pme.YAMLSeq{constructor(){super(),this.add=kf.YAMLMap.prototype.add.bind(this),this.delete=kf.YAMLMap.prototype.delete.bind(this),this.get=kf.YAMLMap.prototype.get.bind(this),this.has=kf.YAMLMap.prototype.has.bind(this),this.set=kf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(L6.isPair(i)?(o=PT.toJS(i.key,"",r),s=PT.toJS(i.value,o,r)):o=PT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=z6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var mme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=z6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)L6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};CT.YAMLOMap=ma;CT.omap=mme});var G6=v(NT=>{"use strict";var U6=Dt();function q6({value:t,source:e},r){return e&&(t?B6:H6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var B6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new U6.Scalar(!0),stringify:q6},H6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new U6.Scalar(!1),stringify:q6};NT.falseTag=H6;NT.trueTag=B6});var Z6=v(c_=>{"use strict";var hme=Dt(),jT=sl(),gme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jT.stringifyNumber},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():jT.stringifyNumber(t)}},_me={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new hme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:jT.stringifyNumber};c_.float=_me;c_.floatExp=yme;c_.floatNaN=gme});var W6=v(Af=>{"use strict";var V6=sl(),Ef=t=>typeof t=="bigint"||Number.isInteger(t);function l_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function MT(t,e,r){let{value:n}=t;if(Ef(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return V6.stringifyNumber(t)}var bme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>l_(t,2,2,r),stringify:t=>MT(t,2,"0b")},vme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>l_(t,1,8,r),stringify:t=>MT(t,8,"0")},Sme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>l_(t,0,10,r),stringify:V6.stringifyNumber},wme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>l_(t,2,16,r),stringify:t=>MT(t,16,"0x")};Af.int=Sme;Af.intBin=bme;Af.intHex=wme;Af.intOct=vme});var LT=v(FT=>{"use strict";var f_=De(),u_=Yo(),d_=Qo(),ha=class t extends d_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;f_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new u_.Pair(e.key,null):r=new u_.Pair(e,null),d_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=d_.findPair(this.items,e);return!r&&f_.isPair(n)?f_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=d_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new u_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(u_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var xme={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(f_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};FT.YAMLSet=ha;FT.set=xme});var UT=v(p_=>{"use strict";var $me=sl();function zT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function K6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return $me.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var kme={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>zT(t,r),stringify:K6},Eme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zT(t,!1),stringify:K6},J6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(J6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=zT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};p_.floatTime=Eme;p_.intTime=kme;p_.timestamp=J6});var Q6=v(X6=>{"use strict";var Ame=il(),Tme=e_(),Ome=ol(),Rme=xf(),Ime=RT(),Y6=G6(),qT=Z6(),m_=W6(),Pme=Zy(),Cme=DT(),Dme=a_(),Nme=LT(),BT=UT(),jme=[Ame.map,Ome.seq,Rme.string,Tme.nullTag,Y6.trueTag,Y6.falseTag,m_.intBin,m_.intOct,m_.int,m_.intHex,qT.floatNaN,qT.floatExp,qT.float,Ime.binary,Pme.merge,Cme.omap,Dme.pairs,Nme.set,BT.intTime,BT.floatTime,BT.timestamp];X6.schema=jme});var lB=v(ZT=>{"use strict";var nB=il(),Mme=e_(),iB=ol(),Fme=xf(),Lme=wT(),HT=$T(),GT=ET(),zme=P6(),Ume=N6(),oB=RT(),Tf=Zy(),sB=DT(),aB=a_(),eB=Q6(),cB=LT(),h_=UT(),tB=new Map([["core",zme.schema],["failsafe",[nB.map,iB.seq,Fme.string]],["json",Ume.schema],["yaml11",eB.schema],["yaml-1.1",eB.schema]]),rB={binary:oB.binary,bool:Lme.boolTag,float:HT.float,floatExp:HT.floatExp,floatNaN:HT.floatNaN,floatTime:h_.floatTime,int:GT.int,intHex:GT.intHex,intOct:GT.intOct,intTime:h_.intTime,map:nB.map,merge:Tf.merge,null:Mme.nullTag,omap:sB.omap,pairs:aB.pairs,seq:iB.seq,set:cB.set,timestamp:h_.timestamp},qme={"tag:yaml.org,2002:binary":oB.binary,"tag:yaml.org,2002:merge":Tf.merge,"tag:yaml.org,2002:omap":sB.omap,"tag:yaml.org,2002:pairs":aB.pairs,"tag:yaml.org,2002:set":cB.set,"tag:yaml.org,2002:timestamp":h_.timestamp};function Bme(t,e,r){let n=tB.get(e);if(n&&!t)return r&&!n.includes(Tf.merge)?n.concat(Tf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(tB.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Tf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?rB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(rB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ZT.coreKnownTags=qme;ZT.getTags=Bme});var KT=v(uB=>{"use strict";var VT=De(),Hme=il(),Gme=ol(),Zme=xf(),g_=lB(),Vme=(t,e)=>t.keye.key?1:0,WT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?g_.getTags(e,"compat"):e?g_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?g_.coreKnownTags:{},this.tags=g_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,VT.MAP,{value:Hme.map}),Object.defineProperty(this,VT.SCALAR,{value:Zme.string}),Object.defineProperty(this,VT.SEQ,{value:Gme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Vme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};uB.Schema=WT});var fB=v(dB=>{"use strict";var Wme=De(),JT=vf(),Of=gf();function Kme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=JT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Of.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Wme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Of.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=JT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Of.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(JT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(Of.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Of.indentComment(o(c),"")))}return r.join(` `)+` -`}lB.stringifyDocument=Wme});var Of=v(dB=>{"use strict";var Kme=pf(),sl=Cy(),Tn=De(),Jme=Yo(),Yme=Vo(),Xme=ZT(),Qme=uB(),WT=Oy(),ehe=XA(),the=mf(),KT=YA(),JT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new KT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[Tn.NODE_TYPE]:{value:Tn.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Tn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){al(this.contents)&&this.contents.add(e)}addIn(e,r){al(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=WT.anchorNames(this);e.anchor=!r||n.has(r)?WT.findNewAnchor(r||"a",n):r}return new Kme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=WT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=the.createNode(e,u,m);return a&&Tn.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Jme.Pair(i,o)}delete(e){return al(this.contents)?this.contents.delete(e):!1}deleteIn(e){return sl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):al(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Tn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return sl.isEmptyPath(e)?!r&&Tn.isScalar(this.contents)?this.contents.value:this.contents:Tn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Tn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return sl.isEmptyPath(e)?this.contents!==void 0:Tn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=sl.collectionFromPath(this.schema,[e],r):al(this.contents)&&this.contents.set(e,r)}setIn(e,r){sl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=sl.collectionFromPath(this.schema,Array.from(e),r):al(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new KT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new KT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Xme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Yme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?ehe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Qme.stringifyDocument(this,e)}};function al(t){if(Tn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}dB.Document=JT});var Pf=v(If=>{"use strict";var Rf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},YT=class extends Rf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},XT=class extends Rf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},rhe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}dB.stringifyDocument=Kme});var Rf=v(pB=>{"use strict";var Jme=mf(),al=jy(),On=De(),Yme=Yo(),Xme=Vo(),Qme=KT(),ehe=fB(),YT=Py(),the=tT(),rhe=hf(),XT=eT(),QT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,On.NODE_TYPE,{value:On.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new XT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[On.NODE_TYPE]:{value:On.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=On.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){cl(this.contents)&&this.contents.add(e)}addIn(e,r){cl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=YT.anchorNames(this);e.anchor=!r||n.has(r)?YT.findNewAnchor(r||"a",n):r}return new Jme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=YT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=rhe.createNode(e,u,m);return a&&On.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Yme.Pair(i,o)}delete(e){return cl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return al.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):cl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return On.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return al.isEmptyPath(e)?!r&&On.isScalar(this.contents)?this.contents.value:this.contents:On.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return On.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return al.isEmptyPath(e)?this.contents!==void 0:On.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=al.collectionFromPath(this.schema,[e],r):cl(this.contents)&&this.contents.set(e,r)}setIn(e,r){al.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=al.collectionFromPath(this.schema,Array.from(e),r):cl(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new XT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new XT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Qme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Xme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?the.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return ehe.stringifyDocument(this,e)}};function cl(t){if(On.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}pB.Document=QT});var Cf=v(Pf=>{"use strict";var If=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},eO=class extends If{constructor(e,r,n){super("YAMLParseError",e,r,n)}},tO=class extends If{constructor(e,r,n){super("YAMLWarning",e,r,n)}},nhe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};If.YAMLError=Rf;If.YAMLParseError=YT;If.YAMLWarning=XT;If.prettifyError=rhe});var Cf=v(fB=>{"use strict";function nhe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}fB.resolveProps=nhe});var m_=v(pB=>{"use strict";function QT(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(QT(e.key)||QT(e.value))return!0}return!1;default:return!0}}pB.containsNewline=QT});var eO=v(mB=>{"use strict";var ihe=m_();function ohe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&ihe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}mB.flowIndentCheck=ohe});var tO=v(gB=>{"use strict";var hB=De();function she(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||hB.isScalar(o)&&hB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}gB.mapIncludes=she});var wB=v(SB=>{"use strict";var yB=Yo(),ahe=Qo(),_B=Cf(),che=m_(),bB=eO(),lhe=tO(),vB="All mapping items must start at the same column";function uhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??ahe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=_B.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",vB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||che.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",vB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&bB.flowIndentCheck(n.indent,f,i),r.atKey=!1,lhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=_B.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var dhe=es(),fhe=Cf(),phe=eO();function mhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??dhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=fhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&phe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}xB.resolveBlockSeq=mhe});var cl=v(kB=>{"use strict";function hhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}kB.resolveEnd=hhe});var OB=v(TB=>{"use strict";var ghe=De(),yhe=Yo(),EB=Qo(),_he=es(),bhe=cl(),AB=Cf(),vhe=m_(),She=tO(),rO="Block collections are not allowed within flow collections",nO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function whe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?EB.YAMLMap:_he.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=bhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}TB.resolveFlowCollection=whe});var IB=v(RB=>{"use strict";var xhe=De(),$he=Dt(),khe=Qo(),Ehe=es(),Ahe=wB(),The=$B(),Ohe=OB();function iO(t,e,r,n,i,o){let s=r.type==="block-map"?Ahe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?The.resolveBlockSeq(t,e,r,n,o):Ohe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Rhe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),iO(t,e,r,i,s)}let l=iO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=xhe.isNode(u)?u:new $he.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}RB.composeCollection=Rhe});var sO=v(PB=>{"use strict";var oO=Dt();function Ihe(t,e,r){let n=e.offset,i=Phe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?oO.Scalar.BLOCK_FOLDED:oO.Scalar.BLOCK_LITERAL,s=e.source?Che(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`}};Pf.YAMLError=If;Pf.YAMLParseError=eO;Pf.YAMLWarning=tO;Pf.prettifyError=nhe});var Df=v(mB=>{"use strict";function ihe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}mB.resolveProps=ihe});var y_=v(hB=>{"use strict";function rO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(rO(e.key)||rO(e.value))return!0}return!1;default:return!0}}hB.containsNewline=rO});var nO=v(gB=>{"use strict";var ohe=y_();function she(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&ohe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gB.flowIndentCheck=she});var iO=v(_B=>{"use strict";var yB=De();function ahe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||yB.isScalar(o)&&yB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}_B.mapIncludes=ahe});var $B=v(xB=>{"use strict";var bB=Yo(),che=Qo(),vB=Df(),lhe=y_(),SB=nO(),uhe=iO(),wB="All mapping items must start at the same column";function dhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??che.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=vB.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",wB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||lhe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",wB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&SB.flowIndentCheck(n.indent,f,i),r.atKey=!1,uhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=vB.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var fhe=es(),phe=Df(),mhe=nO();function hhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??fhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=phe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&mhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}kB.resolveBlockSeq=hhe});var ll=v(AB=>{"use strict";function ghe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}AB.resolveEnd=ghe});var IB=v(RB=>{"use strict";var yhe=De(),_he=Yo(),TB=Qo(),bhe=es(),vhe=ll(),OB=Df(),She=y_(),whe=iO(),oO="Block collections are not allowed within flow collections",sO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function xhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?TB.YAMLMap:bhe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=vhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}RB.resolveFlowCollection=xhe});var CB=v(PB=>{"use strict";var $he=De(),khe=Dt(),Ehe=Qo(),Ahe=es(),The=$B(),Ohe=EB(),Rhe=IB();function aO(t,e,r,n,i,o){let s=r.type==="block-map"?The.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Ohe.resolveBlockSeq(t,e,r,n,o):Rhe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Ihe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),aO(t,e,r,i,s)}let l=aO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=$he.isNode(u)?u:new khe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}PB.composeCollection=Ihe});var lO=v(DB=>{"use strict";var cO=Dt();function Phe(t,e,r){let n=e.offset,i=Che(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?cO.Scalar.BLOCK_FOLDED:cO.Scalar.BLOCK_LITERAL,s=e.source?Dhe(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -112,92 +112,92 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function Phe({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var aO=Dt(),Dhe=cl();function Nhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=aO.Scalar.PLAIN,c=jhe(o,l);break;case"single-quoted-scalar":a=aO.Scalar.QUOTE_SINGLE,c=Mhe(o,l);break;case"double-quoted-scalar":a=aO.Scalar.QUOTE_DOUBLE,c=Fhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=Dhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function jhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),CB(t)}function Mhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),CB(t.slice(1,-1)).replace(/''/g,"'")}function CB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var uO=Dt(),Nhe=ll();function jhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=uO.Scalar.PLAIN,c=Mhe(o,l);break;case"single-quoted-scalar":a=uO.Scalar.QUOTE_SINGLE,c=Fhe(o,l);break;case"double-quoted-scalar":a=uO.Scalar.QUOTE_DOUBLE,c=Lhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=Nhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Mhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),NB(t)}function Fhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),NB(t.slice(1,-1)).replace(/''/g,"'")}function NB(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Lhe(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function zhe(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var zhe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Uhe(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}DB.resolveFlowScalar=Nhe});var MB=v(jB=>{"use strict";var ga=De(),NB=Dt(),qhe=sO(),Bhe=cO();function Hhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?qhe.resolveBlockScalar(t,e,n):Bhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Ghe(t.schema,i,c,r,n):e.type==="scalar"?l=Zhe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new NB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new NB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Ghe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Zhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}jB.composeScalar=Hhe});var LB=v(FB=>{"use strict";function Vhe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}FB.emptyScalarPosition=Vhe});var qB=v(uO=>{"use strict";var Whe=pf(),Khe=De(),Jhe=IB(),zB=MB(),Yhe=cl(),Xhe=LB(),Qhe={composeNode:UB,composeEmptyNode:lO};function UB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=ege(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=zB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Jhe.composeCollection(Qhe,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=lO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Khe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function lO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Xhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=zB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function ege({options:t},{offset:e,source:r,end:n},i){let o=new Whe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Yhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}uO.composeEmptyNode=lO;uO.composeNode=UB});var GB=v(HB=>{"use strict";var tge=Of(),BB=qB(),rge=cl(),nge=Cf();function ige(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new tge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=nge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?BB.composeNode(l,i,u,s):BB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=rge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}HB.composeDoc=ige});var fO=v(WB=>{"use strict";var oge=Ge("process"),sge=YA(),age=Of(),Df=Pf(),ZB=De(),cge=GB(),lge=cl();function Nf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function VB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ga=De(),MB=Dt(),Bhe=lO(),Hhe=dO();function Ghe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Bhe.resolveBlockScalar(t,e,n):Hhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Zhe(t.schema,i,c,r,n):e.type==="scalar"?l=Vhe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new MB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new MB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Zhe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Vhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}FB.composeScalar=Ghe});var UB=v(zB=>{"use strict";function Whe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}zB.emptyScalarPosition=Whe});var HB=v(pO=>{"use strict";var Khe=mf(),Jhe=De(),Yhe=CB(),qB=LB(),Xhe=ll(),Qhe=UB(),ege={composeNode:BB,composeEmptyNode:fO};function BB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=tge(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=qB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Yhe.composeCollection(ege,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=fO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Jhe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function fO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Qhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=qB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function tge({options:t},{offset:e,source:r,end:n},i){let o=new Khe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Xhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}pO.composeEmptyNode=fO;pO.composeNode=BB});var VB=v(ZB=>{"use strict";var rge=Rf(),GB=HB(),nge=ll(),ige=Df();function oge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new rge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=ige.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?GB.composeNode(l,i,u,s):GB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=nge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}ZB.composeDoc=oge});var hO=v(JB=>{"use strict";var sge=Ge("process"),age=eT(),cge=Rf(),Nf=Cf(),WB=De(),lge=VB(),uge=ll();function jf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function KB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Nf(r);o?this.warnings.push(new Df.YAMLWarning(s,n,i)):this.errors.push(new Df.YAMLParseError(s,n,i))},this.directives=new sge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=VB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(ZB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];ZB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var mO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=jf(r);o?this.warnings.push(new Nf.YAMLWarning(s,n,i)):this.errors.push(new Nf.YAMLParseError(s,n,i))},this.directives=new age.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=KB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(WB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];WB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=Nf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=cge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Df.YAMLParseError(Nf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Df.YAMLParseError(Nf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=lge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Df.YAMLParseError(Nf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new age.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};WB.Composer=dO});var YB=v(h_=>{"use strict";var uge=sO(),dge=cO(),fge=Pf(),KB=_f();function pge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new fge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return dge.resolveFlowScalar(t,e,n);case"block-scalar":return uge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function mge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=KB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=jf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=lge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=uge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new cge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};JB.Composer=mO});var QB=v(__=>{"use strict";var dge=lO(),fge=dO(),pge=Cf(),YB=bf();function mge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new pge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return fge.resolveFlowScalar(t,e,n);case"block-scalar":return dge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function hge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=YB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` -`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return JB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function hge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=KB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":gge(t,c);break;case'"':pO(t,c,"double-quoted-scalar");break;case"'":pO(t,c,"single-quoted-scalar");break;default:pO(t,c,"scalar")}}function gge(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return XB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function gge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=YB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":yge(t,c);break;case'"':gO(t,c,"double-quoted-scalar");break;case"'":gO(t,c,"single-quoted-scalar");break;default:gO(t,c,"scalar")}}function yge(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` -`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];JB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` -`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function JB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function pO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}h_.createScalarToken=mge;h_.resolveAsScalar=pge;h_.setScalarValue=hge});var QB=v(XB=>{"use strict";var yge=t=>"type"in t?y_(t):g_(t);function y_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=y_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=g_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=g_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=g_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function g_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=y_(e)),r)for(let o of r)i+=o.source;return n&&(i+=y_(n)),i}XB.stringify=yge});var nH=v(rH=>{"use strict";var mO=Symbol("break visit"),_ge=Symbol("skip children"),eH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),tH(Object.freeze([]),t,e)}ya.BREAK=mO;ya.SKIP=_ge;ya.REMOVE=eH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function tH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var hO=YB(),bge=QB(),vge=nH(),gO="\uFEFF",yO="",_O="",bO="",Sge=t=>!!t&&"items"in t,wge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function xge(t){switch(t){case gO:return"";case yO:return"";case _O:return"";case bO:return"";default:return JSON.stringify(t)}}function $ge(t){switch(t){case gO:return"byte-order-mark";case yO:return"doc-mode";case _O:return"flow-error-end";case bO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];XB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function XB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function gO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}__.createScalarToken=hge;__.resolveAsScalar=mge;__.setScalarValue=gge});var tH=v(eH=>{"use strict";var _ge=t=>"type"in t?v_(t):b_(t);function v_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=v_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=b_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=b_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=b_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function b_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=v_(e)),r)for(let o of r)i+=o.source;return n&&(i+=v_(n)),i}eH.stringify=_ge});var oH=v(iH=>{"use strict";var yO=Symbol("break visit"),bge=Symbol("skip children"),rH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nH(Object.freeze([]),t,e)}ya.BREAK=yO;ya.SKIP=bge;ya.REMOVE=rH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function nH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var _O=QB(),vge=tH(),Sge=oH(),bO="\uFEFF",vO="",SO="",wO="",wge=t=>!!t&&"items"in t,xge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function $ge(t){switch(t){case bO:return"";case vO:return"";case SO:return"";case wO:return"";default:return JSON.stringify(t)}}function kge(t){switch(t){case bO:return"byte-order-mark";case vO:return"doc-mode";case SO:return"flow-error-end";case wO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Nr.createScalarToken=hO.createScalarToken;Nr.resolveAsScalar=hO.resolveAsScalar;Nr.setScalarValue=hO.setScalarValue;Nr.stringify=bge.stringify;Nr.visit=vge.visit;Nr.BOM=gO;Nr.DOCUMENT=yO;Nr.FLOW_END=_O;Nr.SCALAR=bO;Nr.isCollection=Sge;Nr.isScalar=wge;Nr.prettyToken=xge;Nr.tokenType=$ge});var wO=v(oH=>{"use strict";var jf=__();function Yn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var iH=new Set("0123456789ABCDEFabcdef"),kge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),b_=new Set(",[]{}"),Ege=new Set(` ,[]{} -\r `),vO=t=>!t||Ege.has(t),SO=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}jr.createScalarToken=_O.createScalarToken;jr.resolveAsScalar=_O.resolveAsScalar;jr.setScalarValue=_O.setScalarValue;jr.stringify=vge.stringify;jr.visit=Sge.visit;jr.BOM=bO;jr.DOCUMENT=vO;jr.FLOW_END=SO;jr.SCALAR=wO;jr.isCollection=wge;jr.isScalar=xge;jr.prettyToken=$ge;jr.tokenType=kge});var kO=v(aH=>{"use strict";var Mf=S_();function Xn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var sH=new Set("0123456789ABCDEFabcdef"),Ege=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),w_=new Set(",[]{}"),Age=new Set(` ,[]{} +\r `),xO=t=>!t||Age.has(t),$O=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` -`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Yn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Yn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Yn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(vO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Xn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Xn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Xn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(xO),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Yn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` +`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Xn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case` `:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===` `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===` `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===` -`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield jf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Yn(o)||e&&b_.has(o))break;r=n}else if(Yn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Mf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Xn(o)||e&&w_.has(o))break;r=n}else if(Xn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&b_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&b_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield jf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(vO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Yn(n)||r&&b_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Yn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(kge.has(r))r=this.buffer[++e];else if(r==="%"&&iH.has(this.buffer[e+1])&&iH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&w_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&w_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Mf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(xO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Xn(n)||r&&w_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Xn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Ege.has(r))r=this.buffer[++e];else if(r==="%"&&sH.has(this.buffer[e+1])&&sH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};oH.Lexer=SO});var $O=v(sH=>{"use strict";var xO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Age=Ge("process"),aH=__(),Tge=wO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function S_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&lH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&cH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};aH.Lexer=$O});var AO=v(cH=>{"use strict";var EO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Tge=Ge("process"),lH=S_(),Oge=kO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function $_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&dH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&uH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ts(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(uH(r.key)&&!ts(r.sep,"newline")){let s=ll(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ll(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ts(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!ts(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){S_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||ts(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=v_(n),o=ll(i);lH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){$_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ts(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(fH(r.key)&&!ts(r.sep,"newline")){let s=ul(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ul(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ts(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!ts(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){$_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||ts(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=x_(n),o=ul(i);dH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=v_(e),n=ll(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};dH.Parser=kO});var gH=v(Ff=>{"use strict";var fH=fO(),Oge=Of(),Mf=Pf(),Rge=uT(),Ige=De(),Pge=$O(),pH=EO();function mH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Pge.LineCounter||null,prettyErrors:e}}function Cge(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Mf.prettifyError(t,r)),a.warnings.forEach(Mf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hH(t,e={}){let{lineCounter:r,prettyErrors:n}=mH(e),i=new pH.Parser(r?.addNewLine),o=new fH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Mf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Mf.prettifyError(t,r)),s.warnings.forEach(Mf.prettifyError(t,r))),s}function Dge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Rge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Nge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Ige.isDocument(t)&&!n?t.toString(r):new Oge.Document(t,n,r).toString(r)}Ff.parse=Dge;Ff.parseAllDocuments=Cge;Ff.parseDocument=hH;Ff.stringify=Nge});var er=v(Ze=>{"use strict";var jge=fO(),Mge=Of(),Fge=ZT(),AO=Pf(),Lge=pf(),rs=De(),zge=Yo(),Uge=Dt(),qge=Qo(),Bge=es(),Hge=__(),Gge=wO(),Zge=$O(),Vge=EO(),w_=gH(),yH=lf();Ze.Composer=jge.Composer;Ze.Document=Mge.Document;Ze.Schema=Fge.Schema;Ze.YAMLError=AO.YAMLError;Ze.YAMLParseError=AO.YAMLParseError;Ze.YAMLWarning=AO.YAMLWarning;Ze.Alias=Lge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=zge.Pair;Ze.Scalar=Uge.Scalar;Ze.YAMLMap=qge.YAMLMap;Ze.YAMLSeq=Bge.YAMLSeq;Ze.CST=Hge;Ze.Lexer=Gge.Lexer;Ze.LineCounter=Zge.LineCounter;Ze.Parser=Vge.Parser;Ze.parse=w_.parse;Ze.parseAllDocuments=w_.parseAllDocuments;Ze.parseDocument=w_.parseDocument;Ze.stringify=w_.stringify;Ze.visit=yH.visit;Ze.visitAsync=yH.visitAsync});import{execFileSync as TO}from"node:child_process";import{existsSync as x_}from"node:fs";import{join as $_,resolve as Wge}from"node:path";function Kge(t){try{let e=TO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Wge(t,e):null}catch{return null}}function OO(t){let e=Kge(t);if(!e)return null;try{if(x_($_(e,"MERGE_HEAD")))return"merge";if(x_($_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(x_($_(e,"rebase-merge"))||x_($_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return OO(t)!==null}function RO(t,e){try{let r=TO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function k_(t,e){return RO(t,e)!==null}function _H(t,e){try{let r=TO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Jge}from"node:child_process";import{existsSync as Yge,readFileSync as Xge}from"node:fs";import{join as vH}from"node:path";function fl(t,e){return Jge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=fl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){SH(t,e);let r=fl(t,["rev-parse","HEAD"]).trim(),n=Qge(t,e);return{groups:eye(t,n),head:r,inventory:{after:bH(Lf(t,"spec.yaml")),before:bH(A_(t,e,"spec.yaml"))},since:e,unsharded_commits:iye(t,e)}}function IO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function SH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!k_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function Qge(t,e){let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!E_(c)&&!E_(a)))if(s.startsWith("A")){let l=dl(Lf(t,c));if(!l)continue;l.status==="done"?n.push(ul(l,"added-as-done")):l.status==="archived"&&n.push(ul(l,"archived"))}else if(s.startsWith("D")){let l=dl(A_(t,e,a));l&&n.push(ul(l,"archived"))}else{let l=dl(Lf(t,c));if(!l)continue;let d=dl(A_(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(ul(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(ul(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(ul(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function E_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function wH(t,e){SH(t,e);let r=fl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!E_(c)&&!E_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?dl(Lf(t,c)):null,f=l?null:dl(A_(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function ul(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>IO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function dl(t){if(t===null)return null;let e;try{e=(0,T_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Lf(t,e){let r=vH(t,e);if(!Yge(r))return null;try{return Xge(r,"utf8")}catch{return null}}function A_(t,e,r){try{return fl(t,["show",`${e}:${r}`])}catch{return null}}function eye(t,e){let r=tye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function tye(t){let e=Lf(t,vH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,T_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function bH(t){let e={};if(t!==null)try{let n=(0,T_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function iye(t,e){let r=fl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);rye.test(a)&&(nye.test(a)||n.push({hash:s,subject:a}))}return n}var T_,rye,nye,pl=y(()=>{"use strict";T_=St(er(),1);ba();rye=/^(feat|fix)(\([^)]*\))?!?:/,nye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as xH}from"node:child_process";import{appendFileSync as oye,existsSync as PO,mkdirSync as sye,readFileSync as aye,renameSync as cye,statSync as lye}from"node:fs";import{userInfo as uye}from"node:os";import{dirname as dye,join as DO}from"node:path";function NO(t){return DO(t,$H,fye)}function en(t,e){let r=NO(t),n=dye(r);PO(n)||sye(n,{recursive:!0});try{PO(r)&&lye(r).size>pye&&cye(r,DO(n,kH))}catch{}oye(r,`${JSON.stringify(e)} -`,"utf8")}function CO(t){if(!PO(t))return[];let e=aye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return CO(NO(t))}function O_(t){return[...CO(DO(t,$H,kH)),...CO(NO(t))]}function tn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function mye(t){let e;try{e=xH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=uye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function hye(t){try{return xH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function zf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=hye(t),i=mye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=zf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}en(t,tn(e,o))}catch{}}var $H,fye,kH,pye,jr=y(()=>{"use strict";$H=".cladding",fye="events.log.jsonl",kH="events.log.1.jsonl",pye=5*1024*1024});import{execFileSync as gye}from"node:child_process";import{existsSync as EH,readdirSync as yye,readFileSync as _ye,statSync as AH}from"node:fs";import{createHash as bye}from"node:crypto";import{join as jO}from"node:path";function Sa(t){try{return gye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function MO(t){let e=[],r=jO(t,"spec.yaml");EH(r)&&AH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=jO(t,"spec",i);if(!(!EH(o)||!AH(o).isDirectory()))for(let s of yye(o))s.endsWith(".yaml")&&e.push(jO(o,s))}e.sort();let n=bye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(_ye(i)),n.update("\0")}return n.digest("hex")}function R_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:MO(t),timestamp:new Date().toISOString()};return en(t,tn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function I_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function P_(t,e,r,n){let i=tn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return en(t,i),i}var Uf=y(()=>{"use strict";jr()});import{readFileSync as vye,statSync as Sye}from"node:fs";import{extname as wye,resolve as FO,sep as xye}from"node:path";function rn(t){return Math.ceil(t.length/4)}function Eye(t,e){let r=FO(e),n=FO(r,t);return n===r||n.startsWith(r+xye)}function OH(t,e,r,n){if(!Eye(t,e))return{path:t,omitted:"unsafe-path"};if(!$ye.has(wye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>TH)return{path:t,omitted:"too-large",bytes:o}}else{let l=FO(e,t);try{o=Sye(l).size}catch{return{path:t,omitted:"missing"}}if(o>TH)return{path:t,omitted:"too-large",bytes:o};try{i=vye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(kye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};pH.Parser=TO});var _H=v(Lf=>{"use strict";var mH=hO(),Rge=Rf(),Ff=Cf(),Ige=pT(),Pge=De(),Cge=AO(),hH=OO();function gH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Cge.LineCounter||null,prettyErrors:e}}function Dge(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ff.prettifyError(t,r)),a.warnings.forEach(Ff.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yH(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ff.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ff.prettifyError(t,r)),s.warnings.forEach(Ff.prettifyError(t,r))),s}function Nge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=yH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Ige.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function jge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Pge.isDocument(t)&&!n?t.toString(r):new Rge.Document(t,n,r).toString(r)}Lf.parse=Nge;Lf.parseAllDocuments=Dge;Lf.parseDocument=yH;Lf.stringify=jge});var er=v(Ze=>{"use strict";var Mge=hO(),Fge=Rf(),Lge=KT(),RO=Cf(),zge=mf(),rs=De(),Uge=Yo(),qge=Dt(),Bge=Qo(),Hge=es(),Gge=S_(),Zge=kO(),Vge=AO(),Wge=OO(),k_=_H(),bH=uf();Ze.Composer=Mge.Composer;Ze.Document=Fge.Document;Ze.Schema=Lge.Schema;Ze.YAMLError=RO.YAMLError;Ze.YAMLParseError=RO.YAMLParseError;Ze.YAMLWarning=RO.YAMLWarning;Ze.Alias=zge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=Uge.Pair;Ze.Scalar=qge.Scalar;Ze.YAMLMap=Bge.YAMLMap;Ze.YAMLSeq=Hge.YAMLSeq;Ze.CST=Gge;Ze.Lexer=Zge.Lexer;Ze.LineCounter=Vge.LineCounter;Ze.Parser=Wge.Parser;Ze.parse=k_.parse;Ze.parseAllDocuments=k_.parseAllDocuments;Ze.parseDocument=k_.parseDocument;Ze.stringify=k_.stringify;Ze.visit=bH.visit;Ze.visitAsync=bH.visitAsync});import{execFileSync as IO}from"node:child_process";import{existsSync as E_}from"node:fs";import{join as A_,resolve as Kge}from"node:path";function Jge(t){try{let e=IO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Kge(t,e):null}catch{return null}}function PO(t){let e=Jge(t);if(!e)return null;try{if(E_(A_(e,"MERGE_HEAD")))return"merge";if(E_(A_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(E_(A_(e,"rebase-merge"))||E_(A_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return PO(t)!==null}function zf(t,e){try{let r=IO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function T_(t,e){return zf(t,e)!==null}function vH(t,e){try{let r=IO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Yge}from"node:child_process";import{existsSync as Xge,readFileSync as Qge}from"node:fs";import{join as wH}from"node:path";function pl(t,e){return Yge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=pl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){xH(t,e);let r=pl(t,["rev-parse","HEAD"]).trim(),n=eye(t,e);return{groups:tye(t,n),head:r,inventory:{after:SH(Uf(t,"spec.yaml")),before:SH(R_(t,e,"spec.yaml"))},since:e,unsharded_commits:oye(t,e)}}function CO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function xH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!T_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function eye(t,e){let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!O_(c)&&!O_(a)))if(s.startsWith("A")){let l=fl(Uf(t,c));if(!l)continue;l.status==="done"?n.push(dl(l,"added-as-done")):l.status==="archived"&&n.push(dl(l,"archived"))}else if(s.startsWith("D")){let l=fl(R_(t,e,a));l&&n.push(dl(l,"archived"))}else{let l=fl(Uf(t,c));if(!l)continue;let d=fl(R_(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(dl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(dl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(dl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function O_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function $H(t,e){xH(t,e);let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!O_(c)&&!O_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?fl(Uf(t,c)):null,f=l?null:fl(R_(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function dl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>CO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function fl(t){if(t===null)return null;let e;try{e=(0,I_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Uf(t,e){let r=wH(t,e);if(!Xge(r))return null;try{return Qge(r,"utf8")}catch{return null}}function R_(t,e,r){try{return pl(t,["show",`${e}:${r}`])}catch{return null}}function tye(t,e){let r=rye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function rye(t){let e=Uf(t,wH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,I_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function SH(t){let e={};if(t!==null)try{let n=(0,I_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function oye(t,e){let r=pl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);nye.test(a)&&(iye.test(a)||n.push({hash:s,subject:a}))}return n}var I_,nye,iye,ml=y(()=>{"use strict";I_=St(er(),1);ba();nye=/^(feat|fix)(\([^)]*\))?!?:/,iye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as kH}from"node:child_process";import{appendFileSync as sye,existsSync as DO,mkdirSync as aye,readFileSync as cye,renameSync as lye,statSync as uye}from"node:fs";import{userInfo as dye}from"node:os";import{dirname as fye,join as jO}from"node:path";function MO(t){return jO(t,EH,pye)}function tn(t,e){let r=MO(t),n=fye(r);DO(n)||aye(n,{recursive:!0});try{DO(r)&&uye(r).size>mye&&lye(r,jO(n,AH))}catch{}sye(r,`${JSON.stringify(e)} +`,"utf8")}function NO(t){if(!DO(t))return[];let e=cye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return NO(MO(t))}function P_(t){return[...NO(jO(t,EH,AH)),...NO(MO(t))]}function rn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function hye(t){let e;try{e=kH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=dye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function gye(t){try{return kH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function qf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=gye(t),i=hye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=qf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}tn(t,rn(e,o))}catch{}}var EH,pye,AH,mye,Mr=y(()=>{"use strict";EH=".cladding",pye="events.log.jsonl",AH="events.log.1.jsonl",mye=5*1024*1024});import{execFileSync as yye}from"node:child_process";import{existsSync as TH,readdirSync as _ye,readFileSync as bye,statSync as OH}from"node:fs";import{createHash as vye}from"node:crypto";import{join as FO}from"node:path";function Sa(t){try{return yye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function LO(t){let e=[],r=FO(t,"spec.yaml");TH(r)&&OH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=FO(t,"spec",i);if(!(!TH(o)||!OH(o).isDirectory()))for(let s of _ye(o))s.endsWith(".yaml")&&e.push(FO(o,s))}e.sort();let n=vye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(bye(i)),n.update("\0")}return n.digest("hex")}function C_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:LO(t),timestamp:new Date().toISOString()};return tn(t,rn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function D_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function N_(t,e,r,n){let i=rn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return tn(t,i),i}var Bf=y(()=>{"use strict";Mr()});import{readFileSync as Sye,statSync as wye}from"node:fs";import{extname as xye,resolve as zO,sep as $ye}from"node:path";function nn(t){return Math.ceil(t.length/4)}function Aye(t,e){let r=zO(e),n=zO(r,t);return n===r||n.startsWith(r+$ye)}function IH(t,e,r,n){if(!Aye(t,e))return{path:t,omitted:"unsafe-path"};if(!kye.has(xye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>RH)return{path:t,omitted:"too-large",bytes:o}}else{let l=zO(e,t);try{o=wye(l).size}catch{return{path:t,omitted:"missing"}}if(o>RH)return{path:t,omitted:"too-large",bytes:o};try{i=Sye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Eye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var $ye,TH,kye,C_=y(()=>{"use strict";$ye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),TH=2e6,kye="\0"});function zO(t){for(let i of Aye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function LO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Tye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])LO(e,s,o);for(let s of i.modules??[])LO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=zO(a);c&&LO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function On(t){let e=RH.get(t);return e||(e=Tye(t),RH.set(t,e)),e}var Aye,RH,os=y(()=>{"use strict";Aye=["derived:","fixture:","script:","self-dogfood:"];RH=new WeakMap});function UO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=On(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Oye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=UO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:qO(i)}}var wa=y(()=>{"use strict";os()});function IH(t){return t.impacted.length}function N_(t,e,r={}){let n=r.initialDepth??D_.initialDepth,i=r.maxDepth??D_.maxDepth,o=r.coverageThreshold??D_.coverageThreshold,s=r.marginYieldThreshold??D_.marginYieldThreshold,a=On(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=UO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=IH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var D_,BO=y(()=>{"use strict";wa();os();D_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Rye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function PH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Rye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var CH=y(()=>{"use strict"});function Iye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function ml(t,e){let r=Iye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=PH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var j_=y(()=>{"use strict";CH()});import{existsSync as NH,readdirSync as Pye,readFileSync as Cye}from"node:fs";import{join as GO}from"node:path";function ZO(t,e=Nye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function jye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:ZO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:ZO(`done reverted \u2014 pre-push strict gate red${r}`)}}function DH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Mye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return ZO(n)}function Fye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>DH(m)-DH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Dye).map(jye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Mye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function HO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Lye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function zye(t,e,r){let n=HO(t,/_Rolled back at_\s*`([^`]+)`/),i=HO(t,/Last failed gate:\s*`([^`]+)`/),o=HO(t,/Retry attempts:\s*(\d+)/),s=Lye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Uye(t,e){let r=GO(t,".cladding","post-mortems");if(!NH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Pye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(zye(Cye(GO(r,o),"utf8"),e,o))}catch{}return i}function jH(t,e){try{let r=O_(t),n=Uye(t,e),i=NH(GO(t,".cladding","events.log.1.jsonl"));return Fye(r,n,e,{truncated:i})}catch{return}}var Dye,Nye,MH=y(()=>{"use strict";jr();Dye=5,Nye=120});function M_(t,e,r){return rn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:qye,o=e,s,a=On(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ml(t,o);if("not_found"in c)return c;let l=c.focus,u=jH(n,l.id),d=a&&a.size>0?e:l.id,f=N_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Bye&&M_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],lo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return rn(JSON.stringify(lo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],lo=0;for(;Xt.length>Ce.size&&$(Xt,K,lo,0);)Xt=Xt.slice(0,-1),lo++;let $i=[...h],Qr=0;for(;$(Xt,$i,lo,Qr);){let de=-1;for(let uo=$i.length-1;uo>=0;uo--)if(!Kt.has($i[uo])){de=uo;break}if(de<0)break;$i.splice(de,1),Qr++}re=Xt,K=$i,lo+Qr>0&&x.push(`breaks: omitted ${lo} feature(s) / ${Qr} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};rn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Pr=rn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var qye,Bye,F_=y(()=>{"use strict";C_();j_();BO();MH();wa();os();qye=3e3,Bye=3});function Xn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Hye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function FH(t,e,r="."){let n=On(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=N_(t,f.id),g=!("not_found"in h),b=rn(JSON.stringify(p)),_="not_found"in m?b:rn(JSON.stringify(m)),S=rn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=rn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Xn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Xn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Xn(a(c))*10)/10,medianShrinkTruncated:Math.round(Xn(a(l))*10)/10,medianStructuralRatio:Math.round(Xn(u)*100)/100,medianSliceTokens:Math.round(Xn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Xn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Xn(o.map(f=>f.searchDepth)),p95Depth:Hye(o.map(f=>f.searchDepth),95),medianEdges:Xn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Xn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Xn(o.map(f=>f.regressionTests))},features:o}}var hl,L_=y(()=>{"use strict";C_();BO();F_();os();hl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Gye,existsSync as VO,mkdirSync as Zye,readFileSync as LH}from"node:fs";import{dirname as Vye,join as Wye}from"node:path";function WO(t){return Wye(t,Kye,Jye)}function Yye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:MO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function zH(t,e){try{let r=Yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=KO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=WO(t),s=Vye(o);return VO(s)||Zye(s,{recursive:!0}),Gye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function UH(t){let e=[];for(let r of t.split(` -`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function KO(t,e){let r=WO(t);if(!VO(r))return[];let n;try{n=LH(r,"utf8")}catch{return[]}let i=UH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function qH(t){let e=WO(t);if(!VO(e))return{snapshots:[],unreadable:!1};let r;try{r=LH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=UH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function qf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function BH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${qf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${hl}`),i.join(` -`)}var Kye,Jye,Bf=y(()=>{"use strict";Uf();L_();Kye=".cladding",Jye="measure.jsonl"});import{existsSync as Xye}from"node:fs";import{join as Qye}from"node:path";function gl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${e_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` -`)}function GH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` -`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${qf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${qf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${qf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",hl),r.join(` -`)}function yl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${r_e(l,r)} |`)}return n.join(` -`)}function r_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of t_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Xye(Qye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function _l(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),HH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)HH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function HH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=IO(r);n&&t.push(`- ${n}`)}t.push("")}var e_e,t_e,z_=y(()=>{"use strict";Bf();L_();pl();e_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};t_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as n_e}from"node:fs";function Oi(t="./spec.yaml"){let e=n_e(t,"utf8");return(0,ZH.parse)(e)}var ZH,U_=y(()=>{"use strict";ZH=St(er(),1)});var ss=v((Mr,QO)=>{"use strict";var JO=Mr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+WH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};JO.prototype.toString=function(){return this.property+" "+this.message};var q_=Mr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};q_.prototype.addError=function(e){var r;if(typeof e=="string")r=new JO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new JO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};q_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function i_e(t,e){return e+": "+t.toString()+` -`}q_.prototype.toString=function(e){return this.errors.map(i_e).join("")};Object.defineProperty(q_.prototype,"valid",{get:function(){return!this.errors.length}});QO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var VH=Mr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};VH.prototype=Object.create(Error.prototype,{constructor:{value:VH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var YO=Mr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+WH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};YO.prototype.resolve=function(e){return KH(this.base,e)};YO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=KH(this.base,i||"");var s=new YO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Qn=Mr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};Qn.regexp=Qn.regex;Qn.pattern=Qn.regex;Qn.ipv4=Qn["ip-address"];Mr.isFormat=function(e,r,n){if(typeof e=="string"&&Qn[r]!==void 0){if(Qn[r]instanceof RegExp)return Qn[r].test(e);if(typeof Qn[r]=="function")return Qn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var WH=Mr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Mr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function o_e(t,e,r,n){typeof r=="object"?e[n]=XO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function s_e(t,e,r){e[r]=t[r]}function a_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=XO(t[n],e[n]):r[n]=e[n]}function XO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(o_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(s_e.bind(null,t,n)),Object.keys(e).forEach(a_e.bind(null,t,e,n))),n}QO.exports.deepMerge=XO;Mr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function c_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Mr.encodePath=function(e){return e.map(c_e).join("")};Mr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Mr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var KH=Mr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var QH=v((P7e,XH)=>{"use strict";var nn=ss(),Le=nn.ValidatorResult,as=nn.SchemaError,eR={};eR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=eR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function tR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(tR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(tR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!nn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=tR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!nn.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!nn.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function rR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!nn.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(rR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=rR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function JH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&JH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)JH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!nn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function l_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var nR=ss();iR.exports.SchemaScanResult=eG;function eG(t,e){this.id=t,this.ref=e}iR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=nR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=nR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!nR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var tG=QH(),cs=ss(),rG=B_().scan,nG=cs.ValidatorResult,u_e=cs.ValidatorResultError,Hf=cs.SchemaError,iG=cs.SchemaContext,d_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ri),this.attributes=Object.create(tG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=rG(r||d_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Hf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Hf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ri=Jt.prototype.types={};Ri.string=function(e){return typeof e=="string"};Ri.number=function(e){return typeof e=="number"&&isFinite(e)};Ri.integer=function(e){return typeof e=="number"&&e%1===0};Ri.boolean=function(e){return typeof e=="boolean"};Ri.array=function(e){return Array.isArray(e)};Ri.null=function(e){return e===null};Ri.date=function(e){return e instanceof Date};Ri.any=function(e){return!0};Ri.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};sG.exports=Jt});var cG=v((N7e,ho)=>{"use strict";var f_e=ho.exports.Validator=aG();ho.exports.ValidatorResult=ss().ValidatorResult;ho.exports.ValidatorResultError=ss().ValidatorResultError;ho.exports.ValidationError=ss().ValidationError;ho.exports.SchemaError=ss().SchemaError;ho.exports.SchemaScanResult=B_().SchemaScanResult;ho.exports.scan=B_().scan;ho.exports.validate=function(t,e,r){var n=new f_e;return n.validate(t,e,r)}});import{readFileSync as p_e}from"node:fs";import{dirname as m_e,join as h_e}from"node:path";import{fileURLToPath as g_e}from"node:url";function S_e(t){let e=v_e.validate(t,b_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function uG(t){let e=S_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var kye,RH,Eye,j_=y(()=>{"use strict";kye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),RH=2e6,Eye="\0"});function Hf(t){for(let i of Tye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function UO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Oye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])UO(e,s,o);for(let s of i.modules??[])UO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Hf(a);c&&UO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Rn(t){let e=PH.get(t);return e||(e=Oye(t),PH.set(t,e)),e}var Tye,PH,os=y(()=>{"use strict";Tye=["derived:","fixture:","script:","self-dogfood:"];PH=new WeakMap});function qO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=Rn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Rye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=qO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:BO(i)}}var wa=y(()=>{"use strict";os()});function CH(t){return t.impacted.length}function F_(t,e,r={}){let n=r.initialDepth??M_.initialDepth,i=r.maxDepth??M_.maxDepth,o=r.coverageThreshold??M_.coverageThreshold,s=r.marginYieldThreshold??M_.marginYieldThreshold,a=Rn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=qO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=CH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var M_,HO=y(()=>{"use strict";wa();os();M_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Iye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function DH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Iye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var NH=y(()=>{"use strict"});function Pye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function hl(t,e){let r=Pye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=DH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var L_=y(()=>{"use strict";NH()});import{existsSync as MH,readdirSync as Cye,readFileSync as Dye}from"node:fs";import{join as ZO}from"node:path";function VO(t,e=jye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Mye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:VO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:VO(`done reverted \u2014 pre-push strict gate red${r}`)}}function jH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Fye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return VO(n)}function Lye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>jH(m)-jH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Nye).map(Mye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Fye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function GO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function zye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function Uye(t,e,r){let n=GO(t,/_Rolled back at_\s*`([^`]+)`/),i=GO(t,/Last failed gate:\s*`([^`]+)`/),o=GO(t,/Retry attempts:\s*(\d+)/),s=zye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function qye(t,e){let r=ZO(t,".cladding","post-mortems");if(!MH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Cye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Uye(Dye(ZO(r,o),"utf8"),e,o))}catch{}return i}function FH(t,e){try{let r=P_(t),n=qye(t,e),i=MH(ZO(t,".cladding","events.log.1.jsonl"));return Lye(r,n,e,{truncated:i})}catch{return}}var Nye,jye,LH=y(()=>{"use strict";Mr();Nye=5,jye=120});function z_(t,e,r){return nn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Bye,o=e,s,a=Rn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=hl(t,o);if("not_found"in c)return c;let l=c.focus,u=FH(n,l.id),d=a&&a.size>0?e:l.id,f=F_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Hye&&z_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],uo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return nn(JSON.stringify(uo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],uo=0;for(;Xt.length>Ce.size&&$(Xt,K,uo,0);)Xt=Xt.slice(0,-1),uo++;let ki=[...h],en=0;for(;$(Xt,ki,uo,en);){let de=-1;for(let fo=ki.length-1;fo>=0;fo--)if(!Kt.has(ki[fo])){de=fo;break}if(de<0)break;ki.splice(de,1),en++}re=Xt,K=ki,uo+en>0&&x.push(`breaks: omitted ${uo} feature(s) / ${en} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};nn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Cr=nn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Cr,truncated:x}}}var Bye,Hye,U_=y(()=>{"use strict";j_();L_();HO();LH();wa();os();Bye=3e3,Hye=3});function Qn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Gye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function zH(t,e,r="."){let n=Rn(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=F_(t,f.id),g=!("not_found"in h),b=nn(JSON.stringify(p)),_="not_found"in m?b:nn(JSON.stringify(m)),S=nn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=nn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Qn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Qn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Qn(a(c))*10)/10,medianShrinkTruncated:Math.round(Qn(a(l))*10)/10,medianStructuralRatio:Math.round(Qn(u)*100)/100,medianSliceTokens:Math.round(Qn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Qn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Qn(o.map(f=>f.searchDepth)),p95Depth:Gye(o.map(f=>f.searchDepth),95),medianEdges:Qn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Qn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Qn(o.map(f=>f.regressionTests))},features:o}}var gl,q_=y(()=>{"use strict";j_();HO();U_();os();gl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Zye,existsSync as WO,mkdirSync as Vye,readFileSync as UH}from"node:fs";import{dirname as Wye,join as Kye}from"node:path";function KO(t){return Kye(t,Jye,Yye)}function Xye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:LO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function qH(t,e){try{let r=Xye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=JO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=KO(t),s=Wye(o);return WO(s)||Vye(s,{recursive:!0}),Zye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function BH(t){let e=[];for(let r of t.split(` +`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function JO(t,e){let r=KO(t);if(!WO(r))return[];let n;try{n=UH(r,"utf8")}catch{return[]}let i=BH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function HH(t){let e=KO(t);if(!WO(e))return{snapshots:[],unreadable:!1};let r;try{r=UH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=BH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Gf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function GH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Gf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${gl}`),i.join(` +`)}var Jye,Yye,Zf=y(()=>{"use strict";Bf();q_();Jye=".cladding",Yye="measure.jsonl"});import{existsSync as Qye}from"node:fs";import{join as e_e}from"node:path";function yl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${t_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function VH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` +`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Gf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Gf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Gf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",gl),r.join(` +`)}function _l(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${n_e(l,r)} |`)}return n.join(` +`)}function n_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of r_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Qye(e_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function bl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),ZH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)ZH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function ZH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=CO(r);n&&t.push(`- ${n}`)}t.push("")}var t_e,r_e,B_=y(()=>{"use strict";Zf();q_();ml();t_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};r_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as i_e}from"node:fs";function Ri(t="./spec.yaml"){let e=i_e(t,"utf8");return(0,WH.parse)(e)}var WH,H_=y(()=>{"use strict";WH=St(er(),1)});var ss=v((Fr,eR)=>{"use strict";var YO=Fr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+JH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};YO.prototype.toString=function(){return this.property+" "+this.message};var G_=Fr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};G_.prototype.addError=function(e){var r;if(typeof e=="string")r=new YO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new YO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};G_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function o_e(t,e){return e+": "+t.toString()+` +`}G_.prototype.toString=function(e){return this.errors.map(o_e).join("")};Object.defineProperty(G_.prototype,"valid",{get:function(){return!this.errors.length}});eR.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var KH=Fr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};KH.prototype=Object.create(Error.prototype,{constructor:{value:KH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XO=Fr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+JH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XO.prototype.resolve=function(e){return YH(this.base,e)};XO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=YH(this.base,i||"");var s=new XO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ei=Fr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ei.regexp=ei.regex;ei.pattern=ei.regex;ei.ipv4=ei["ip-address"];Fr.isFormat=function(e,r,n){if(typeof e=="string"&&ei[r]!==void 0){if(ei[r]instanceof RegExp)return ei[r].test(e);if(typeof ei[r]=="function")return ei[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var JH=Fr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Fr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function s_e(t,e,r,n){typeof r=="object"?e[n]=QO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function a_e(t,e,r){e[r]=t[r]}function c_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QO(t[n],e[n]):r[n]=e[n]}function QO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(s_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(a_e.bind(null,t,n)),Object.keys(e).forEach(c_e.bind(null,t,e,n))),n}eR.exports.deepMerge=QO;Fr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function l_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Fr.encodePath=function(e){return e.map(l_e).join("")};Fr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Fr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var YH=Fr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var tG=v((z7e,eG)=>{"use strict";var on=ss(),Le=on.ValidatorResult,as=on.SchemaError,tR={};tR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=tR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function rR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(rR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(rR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!on.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!on.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!on.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function nR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!on.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function XH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&XH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)XH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!on.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function u_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iR=ss();oR.exports.SchemaScanResult=rG;function rG(t,e){this.id=t,this.ref=e}oR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var nG=tG(),cs=ss(),iG=Z_().scan,oG=cs.ValidatorResult,d_e=cs.ValidatorResultError,Vf=cs.SchemaError,sG=cs.SchemaContext,f_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(nG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=iG(r||f_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Vf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Vf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Jt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};cG.exports=Jt});var uG=v((B7e,go)=>{"use strict";var p_e=go.exports.Validator=lG();go.exports.ValidatorResult=ss().ValidatorResult;go.exports.ValidatorResultError=ss().ValidatorResultError;go.exports.ValidationError=ss().ValidationError;go.exports.SchemaError=ss().SchemaError;go.exports.SchemaScanResult=Z_().SchemaScanResult;go.exports.scan=Z_().scan;go.exports.validate=function(t,e,r){var n=new p_e;return n.validate(t,e,r)}});import{readFileSync as m_e}from"node:fs";import{dirname as h_e,join as g_e}from"node:path";import{fileURLToPath as y_e}from"node:url";function w_e(t){let e=S_e.validate(t,v_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function fG(t){let e=w_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var lG,y_e,__e,b_e,v_e,dG=y(()=>{"use strict";lG=St(cG(),1),y_e=m_e(g_e(import.meta.url)),__e=h_e(y_e,"schema.json"),b_e=JSON.parse(p_e(__e,"utf8")),v_e=new lG.Validator});import{existsSync as oR,readdirSync as w_e}from"node:fs";import{dirname as x_e,join as ka,resolve as pG}from"node:path";function fG(t){return oR(t)?w_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Oi(ka(t,r))):[]}function Ea(t,e){H_=e?{cwd:pG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return H_&&e==="spec.yaml"&&pG(t)===H_.cwd?H_.spec:$_e(t,e)}function $_e(t,e){let r=ka(t,e),n=Oi(r),i=ka(t,x_e(e),"spec");if(!n.features||n.features.length===0){let o=fG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=fG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");oR(o)&&(n.architecture=Oi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(oR(o)){let s=Oi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return uG(n),n}var H_,Ue=y(()=>{"use strict";U_();dG();H_=null});import bl from"node:process";function cR(){return!!bl.stdout.isTTY}function L(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${sR[t]}${n}${aR} ${e}${i} -`):bl.stdout.write(`${n} ${e}${i} -`)}function Gf(t,e,r=""){if(!cR())return;let n=r?` ${r}`:"";bl.stdout.write(`${hG}${sR.start}\xB7${aR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=mG[t],i=r?` ${r}`:"";cR()?bl.stdout.write(`${hG}${sR[t]}${n}${aR} ${e}${i} -`):bl.stdout.write(`${n} ${e}${i} -`)}var mG,sR,aR,hG,Ii=y(()=>{"use strict";mG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},sR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},aR="\x1B[0m",hG="\r\x1B[K"});import{createHash as zG}from"node:crypto";import{existsSync as cbe,readFileSync as dR,writeFileSync as lbe}from"node:fs";import{join as G_}from"node:path";function ube(t,e){let r=zG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(dR(G_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function qG(t,e){let r=zG("sha256");try{r.update(dR(G_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=G_(t,...UG);if(!cbe(e))return null;let r;try{r=dR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function Z_(t){return t.features?.size??t.v1?.size??0}function V_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==qG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===ube(e,n)?{state:"fresh"}:{state:"stale"}}function BG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${qG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=dbe+`attested_modules: + `)}`)}var dG,__e,b_e,v_e,S_e,pG=y(()=>{"use strict";dG=St(uG(),1),__e=h_e(y_e(import.meta.url)),b_e=g_e(__e,"schema.json"),v_e=JSON.parse(m_e(b_e,"utf8")),S_e=new dG.Validator});import{existsSync as sR,readdirSync as x_e}from"node:fs";import{dirname as $_e,join as ka,resolve as hG}from"node:path";function mG(t){return sR(t)?x_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(ka(t,r))):[]}function Ea(t,e){V_=e?{cwd:hG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return V_&&e==="spec.yaml"&&hG(t)===V_.cwd?V_.spec:k_e(t,e)}function k_e(t,e){let r=ka(t,e),n=Ri(r),i=ka(t,$_e(e),"spec");if(!n.features||n.features.length===0){let o=mG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=mG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");sR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(sR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return fG(n),n}var V_,Ue=y(()=>{"use strict";H_();pG();V_=null});import vl from"node:process";function lR(){return!!vl.stdout.isTTY}function L(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${aR[t]}${n}${cR} ${e}${i} +`):vl.stdout.write(`${n} ${e}${i} +`)}function Wf(t,e,r=""){if(!lR())return;let n=r?` ${r}`:"";vl.stdout.write(`${yG}${aR.start}\xB7${cR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${yG}${aR[t]}${n}${cR} ${e}${i} +`):vl.stdout.write(`${n} ${e}${i} +`)}var gG,aR,cR,yG,Pi=y(()=>{"use strict";gG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cR="\x1B[0m",yG="\r\x1B[K"});import{createHash as qG}from"node:crypto";import{existsSync as lbe,readFileSync as fR,writeFileSync as ube}from"node:fs";import{join as W_}from"node:path";function dbe(t,e){let r=qG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(fR(W_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function HG(t,e){let r=qG("sha256");try{r.update(fR(W_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=W_(t,...BG);if(!lbe(e))return null;let r;try{r=fR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function K_(t){return t.features?.size??t.v1?.size??0}function J_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==HG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===dbe(e,n)?{state:"fresh"}:{state:"stale"}}function GG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${HG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=fbe+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return lbe(G_(t,...UG),s,"utf8"),!0}var UG,dbe,wl=y(()=>{"use strict";UG=["spec","attestation.yaml"];dbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return ube(W_(t,...BG),s,"utf8"),!0}var BG,fbe,xl=y(()=>{"use strict";BG=["spec","attestation.yaml"];fbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN # \`clad check --tier=pre-push --strict\` gate \u2014 the file's one honest author. # Do not edit by hand. # @@ -212,53 +212,53 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as fR}from"node:path";function W_(t){us={cwd:fR(t),results:new Map}}function HG(t,e,r){!us||us.cwd!==fR(e)||us.results.set(t,r)}function K_(t,e){return!us||us.cwd!==fR(e)?null:us.results.get(t)??null}function J_(){us=null}var us,xl=y(()=>{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var yo=y(()=>{});import{fileURLToPath as fbe}from"node:url";var $l,pbe,pR,mR,kl=y(()=>{$l=(t,e)=>{let r=mR(pbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},pbe=t=>pR(t)?t.toString():t,pR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,mR=t=>t instanceof URL?fbe(t):t});var Y_,hR=y(()=>{yo();kl();Y_=(t,e=[],r={})=>{let n=$l(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as mbe}from"node:string_decoder";var GG,ZG,qt,_o,hbe,VG,gbe,X_,WG,ybe,Wf,_be,gR,bbe,on=y(()=>{({toString:GG}=Object.prototype),ZG=t=>GG.call(t)==="[object ArrayBuffer]",qt=t=>GG.call(t)==="[object Uint8Array]",_o=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hbe=new TextEncoder,VG=t=>hbe.encode(t),gbe=new TextDecoder,X_=t=>gbe.decode(t),WG=(t,e)=>ybe(t,e).join(""),ybe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new mbe(e),n=t.map(o=>typeof o=="string"?VG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Wf=t=>t.length===1&&qt(t[0])?t[0]:gR(_be(t)),_be=t=>t.map(e=>typeof e=="string"?VG(e):e),gR=t=>{let e=new Uint8Array(bbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},bbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as vbe}from"node:child_process";var XG,QG,Sbe,wbe,KG,xbe,JG,YG,$be,eZ=y(()=>{yo();on();XG=t=>Array.isArray(t)&&Array.isArray(t.raw),QG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Sbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},Sbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=wbe(i,t.raw[n]),c=JG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>YG(d)):[YG(l)];return JG(c,u,a)},wbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=KG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],YG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return $be(t);throw t instanceof vbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},$be=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return X_(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import yR from"node:process";var ei,Q_,Rn,eb,bo=y(()=>{ei=t=>Q_.includes(t),Q_=[yR.stdin,yR.stdout,yR.stderr],Rn=["stdin","stdout","stderr"],eb=t=>Rn[t]??`stdio[${t}]`});import{debuglog as kbe}from"node:util";var rZ,_R,Ebe,Abe,Tbe,Obe,tZ,Rbe,bR,Ibe,Pbe,Cbe,Dbe,vR,vo,So=y(()=>{yo();bo();rZ=t=>{let e={...t};for(let r of vR)e[r]=_R(t,r);return e},_R=(t,e)=>{let r=Array.from({length:Ebe(t)+1}),n=Abe(t[e],r,e);return Pbe(n,e)},Ebe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Rn.length):Rn.length,Abe=(t,e,r)=>Ot(t)?Tbe(t,e,r):e.fill(t),Tbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Obe))for(let i of Rbe(n,r,e))e[i]=t[n];return e},Obe=(t,e)=>tZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Rbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=bR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as pR}from"node:path";function Y_(t){us={cwd:pR(t),results:new Map}}function ZG(t,e,r){!us||us.cwd!==pR(e)||us.results.set(t,r)}function X_(t,e){return!us||us.cwd!==pR(e)?null:us.results.get(t)??null}function Q_(){us=null}var us,$l=y(()=>{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var _o=y(()=>{});import{fileURLToPath as pbe}from"node:url";var kl,mbe,mR,hR,El=y(()=>{kl=(t,e)=>{let r=hR(mbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},mbe=t=>mR(t)?t.toString():t,mR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,hR=t=>t instanceof URL?pbe(t):t});var eb,gR=y(()=>{_o();El();eb=(t,e=[],r={})=>{let n=kl(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as hbe}from"node:string_decoder";var VG,WG,qt,bo,gbe,KG,ybe,tb,JG,_be,Jf,bbe,yR,vbe,sn=y(()=>{({toString:VG}=Object.prototype),WG=t=>VG.call(t)==="[object ArrayBuffer]",qt=t=>VG.call(t)==="[object Uint8Array]",bo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),gbe=new TextEncoder,KG=t=>gbe.encode(t),ybe=new TextDecoder,tb=t=>ybe.decode(t),JG=(t,e)=>_be(t,e).join(""),_be=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new hbe(e),n=t.map(o=>typeof o=="string"?KG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Jf=t=>t.length===1&&qt(t[0])?t[0]:yR(bbe(t)),bbe=t=>t.map(e=>typeof e=="string"?KG(e):e),yR=t=>{let e=new Uint8Array(vbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},vbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Sbe}from"node:child_process";var eZ,tZ,wbe,xbe,YG,$be,XG,QG,kbe,rZ=y(()=>{_o();sn();eZ=t=>Array.isArray(t)&&Array.isArray(t.raw),tZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=wbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},wbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=xbe(i,t.raw[n]),c=XG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>QG(d)):[QG(l)];return XG(c,u,a)},xbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=YG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],QG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return kbe(t);throw t instanceof Sbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},kbe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return tb(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import _R from"node:process";var ti,rb,In,nb,vo=y(()=>{ti=t=>rb.includes(t),rb=[_R.stdin,_R.stdout,_R.stderr],In=["stdin","stdout","stderr"],nb=t=>In[t]??`stdio[${t}]`});import{debuglog as Ebe}from"node:util";var iZ,bR,Abe,Tbe,Obe,Rbe,nZ,Ibe,vR,Pbe,Cbe,Dbe,Nbe,SR,So,wo=y(()=>{_o();vo();iZ=t=>{let e={...t};for(let r of SR)e[r]=bR(t,r);return e},bR=(t,e)=>{let r=Array.from({length:Abe(t)+1}),n=Tbe(t[e],r,e);return Cbe(n,e)},Abe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,In.length):In.length,Tbe=(t,e,r)=>Ot(t)?Obe(t,e,r):e.fill(t),Obe=(t,e,r)=>{for(let n of Object.keys(t).sort(Rbe))for(let i of Ibe(n,r,e))e[i]=t[n];return e},Rbe=(t,e)=>nZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Ibe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=vR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},bR=t=>{if(t==="all")return t;if(Rn.includes(t))return Rn.indexOf(t);let e=Ibe.exec(t);if(e!==null)return Number(e[1])},Ibe=/^fd(\d+)$/,Pbe=(t,e)=>t.map(r=>r===void 0?Dbe[e]:r),Cbe=kbe("execa").enabled?"full":"none",Dbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Cbe,stripFinalNewline:!0},vR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],vo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var El,Al,nZ,SR,Nbe,tb,rb,ds=y(()=>{So();El=({verbose:t},e)=>SR(t,e)!=="none",Al=({verbose:t},e)=>!["none","short"].includes(SR(t,e)),nZ=({verbose:t},e)=>{let r=SR(t,e);return tb(r)?r:void 0},SR=(t,e)=>e===void 0?Nbe(t):vo(t,e),Nbe=t=>t.find(e=>tb(e))??rb.findLast(e=>t.includes(e)),tb=t=>typeof t=="function",rb=["none","short","full"]});import{platform as jbe}from"node:process";import{stripVTControlCharacters as Mbe}from"node:util";var iZ,Kf,oZ,Fbe,Lbe,zbe,Ube,qbe,Bbe,Hbe,nb=y(()=>{iZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Bbe(oZ(o))).join(" ");return{command:n,escapedCommand:i}},Kf=t=>Mbe(t).split(` -`).map(e=>oZ(e)).join(` -`),oZ=t=>t.replaceAll(zbe,e=>Fbe(e)),Fbe=t=>{let e=Ube[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=qbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Lbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},zbe=Lbe(),Ube={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},qbe=65535,Bbe=t=>Hbe.test(t)?t:jbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Hbe=/^[\w./-]+$/});import sZ from"node:process";function wR(){let{env:t}=sZ,{TERM:e,TERM_PROGRAM:r}=t;return sZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var aZ=y(()=>{});var cZ,lZ,Gbe,Zbe,Vbe,Wbe,Kbe,ib,qQe,uZ=y(()=>{aZ();cZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},lZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Gbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Zbe={...cZ,...lZ},Vbe={...cZ,...Gbe},Wbe=wR(),Kbe=Wbe?Zbe:Vbe,ib=Kbe,qQe=Object.entries(lZ)});import Jbe from"node:tty";var Ybe,be,GQe,dZ,ZQe,VQe,WQe,KQe,JQe,YQe,XQe,QQe,eet,tet,ret,net,iet,oet,set,ob,aet,cet,uet,det,fet,pet,met,het,get,fZ,yet,pZ,_et,bet,vet,wet,xet,$et,ket,Eet,Aet,Tet,Oet,xR=y(()=>{Ybe=Jbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Ybe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},GQe=be(0,0),dZ=be(1,22),ZQe=be(2,22),VQe=be(3,23),WQe=be(4,24),KQe=be(53,55),JQe=be(7,27),YQe=be(8,28),XQe=be(9,29),QQe=be(30,39),eet=be(31,39),tet=be(32,39),ret=be(33,39),net=be(34,39),iet=be(35,39),oet=be(36,39),set=be(37,39),ob=be(90,39),aet=be(40,49),cet=be(41,49),uet=be(42,49),det=be(43,49),fet=be(44,49),pet=be(45,49),met=be(46,49),het=be(47,49),get=be(100,49),fZ=be(91,39),yet=be(92,39),pZ=be(93,39),_et=be(94,39),bet=be(95,39),vet=be(96,39),wet=be(97,39),xet=be(101,49),$et=be(102,49),ket=be(103,49),Eet=be(104,49),Aet=be(105,49),Tet=be(106,49),Oet=be(107,49)});var mZ=y(()=>{xR();xR()});var yZ,Qbe,sb,hZ,eve,gZ,tve,_Z=y(()=>{uZ();mZ();yZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Qbe(r),c=eve[t]({failed:o,reject:s,piped:n}),l=tve[t]({reject:s});return`${ob(`[${a}]`)} ${ob(`[${i}]`)} ${l(c)} ${l(e)}`},Qbe=t=>`${sb(t.getHours(),2)}:${sb(t.getMinutes(),2)}:${sb(t.getSeconds(),2)}.${sb(t.getMilliseconds(),3)}`,sb=(t,e)=>String(t).padStart(e,"0"),hZ=({failed:t,reject:e})=>t?e?ib.cross:ib.warning:ib.tick,eve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:hZ,duration:hZ},gZ=t=>t,tve={command:()=>dZ,output:()=>gZ,ipc:()=>gZ,error:({reject:t})=>t?fZ:pZ,duration:()=>ob}});var bZ,rve,nve,vZ=y(()=>{ds();bZ=(t,e,r)=>{let n=nZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>rve(i,o,n)).filter(i=>i!==void 0).map(i=>nve(i)).join("")},rve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},nve=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},vR=t=>{if(t==="all")return t;if(In.includes(t))return In.indexOf(t);let e=Pbe.exec(t);if(e!==null)return Number(e[1])},Pbe=/^fd(\d+)$/,Cbe=(t,e)=>t.map(r=>r===void 0?Nbe[e]:r),Dbe=Ebe("execa").enabled?"full":"none",Nbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Dbe,stripFinalNewline:!0},SR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],So=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Al,Tl,oZ,wR,jbe,ib,ob,ds=y(()=>{wo();Al=({verbose:t},e)=>wR(t,e)!=="none",Tl=({verbose:t},e)=>!["none","short"].includes(wR(t,e)),oZ=({verbose:t},e)=>{let r=wR(t,e);return ib(r)?r:void 0},wR=(t,e)=>e===void 0?jbe(t):So(t,e),jbe=t=>t.find(e=>ib(e))??ob.findLast(e=>t.includes(e)),ib=t=>typeof t=="function",ob=["none","short","full"]});import{platform as Mbe}from"node:process";import{stripVTControlCharacters as Fbe}from"node:util";var sZ,Yf,aZ,Lbe,zbe,Ube,qbe,Bbe,Hbe,Gbe,sb=y(()=>{sZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Hbe(aZ(o))).join(" ");return{command:n,escapedCommand:i}},Yf=t=>Fbe(t).split(` +`).map(e=>aZ(e)).join(` +`),aZ=t=>t.replaceAll(Ube,e=>Lbe(e)),Lbe=t=>{let e=qbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Bbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},zbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ube=zbe(),qbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Bbe=65535,Hbe=t=>Gbe.test(t)?t:Mbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Gbe=/^[\w./-]+$/});import cZ from"node:process";function xR(){let{env:t}=cZ,{TERM:e,TERM_PROGRAM:r}=t;return cZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var lZ=y(()=>{});var uZ,dZ,Zbe,Vbe,Wbe,Kbe,Jbe,ab,JQe,fZ=y(()=>{lZ();uZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},dZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Zbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Vbe={...uZ,...dZ},Wbe={...uZ,...Zbe},Kbe=xR(),Jbe=Kbe?Vbe:Wbe,ab=Jbe,JQe=Object.entries(dZ)});import Ybe from"node:tty";var Xbe,be,QQe,pZ,eet,tet,ret,net,iet,oet,set,aet,cet,uet,det,fet,pet,met,het,cb,get,yet,_et,bet,vet,wet,xet,$et,ket,mZ,Eet,hZ,Aet,Tet,Oet,Ret,Iet,Pet,Cet,Det,Net,jet,Met,$R=y(()=>{Xbe=Ybe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Xbe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},QQe=be(0,0),pZ=be(1,22),eet=be(2,22),tet=be(3,23),ret=be(4,24),net=be(53,55),iet=be(7,27),oet=be(8,28),set=be(9,29),aet=be(30,39),cet=be(31,39),uet=be(32,39),det=be(33,39),fet=be(34,39),pet=be(35,39),met=be(36,39),het=be(37,39),cb=be(90,39),get=be(40,49),yet=be(41,49),_et=be(42,49),bet=be(43,49),vet=be(44,49),wet=be(45,49),xet=be(46,49),$et=be(47,49),ket=be(100,49),mZ=be(91,39),Eet=be(92,39),hZ=be(93,39),Aet=be(94,39),Tet=be(95,39),Oet=be(96,39),Ret=be(97,39),Iet=be(101,49),Pet=be(102,49),Cet=be(103,49),Det=be(104,49),Net=be(105,49),jet=be(106,49),Met=be(107,49)});var gZ=y(()=>{$R();$R()});var bZ,eve,lb,yZ,tve,_Z,rve,vZ=y(()=>{fZ();gZ();bZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=eve(r),c=tve[t]({failed:o,reject:s,piped:n}),l=rve[t]({reject:s});return`${cb(`[${a}]`)} ${cb(`[${i}]`)} ${l(c)} ${l(e)}`},eve=t=>`${lb(t.getHours(),2)}:${lb(t.getMinutes(),2)}:${lb(t.getSeconds(),2)}.${lb(t.getMilliseconds(),3)}`,lb=(t,e)=>String(t).padStart(e,"0"),yZ=({failed:t,reject:e})=>t?e?ab.cross:ab.warning:ab.tick,tve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:yZ,duration:yZ},_Z=t=>t,rve={command:()=>pZ,output:()=>_Z,ipc:()=>_Z,error:({reject:t})=>t?mZ:hZ,duration:()=>cb}});var SZ,nve,ive,wZ=y(()=>{ds();SZ=(t,e,r)=>{let n=oZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>nve(i,o,n)).filter(i=>i!==void 0).map(i=>ive(i)).join("")},nve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ive=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as ive}from"node:util";var Pi,ove,sve,ave,ab,cve,Tl=y(()=>{nb();_Z();vZ();Pi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ove({type:t,result:i,verboseInfo:n}),s=sve(e,o),a=bZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ove=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),sve=(t,e)=>t.split(` -`).map(r=>ave({...e,message:r})),ave=t=>({verboseLine:yZ(t),verboseObject:t}),ab=t=>{let e=typeof t=="string"?t:ive(t);return Kf(e).replaceAll(" "," ".repeat(cve))},cve=2});var SZ,wZ=y(()=>{ds();Tl();SZ=(t,e)=>{El(e)&&Pi({type:"command",verboseMessage:t,verboseInfo:e})}});var xZ,lve,uve,dve,$Z=y(()=>{ds();xZ=(t,e,r)=>{dve(t);let n=lve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},lve=t=>El({verbose:t})?uve++:void 0,uve=0n,dve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!rb.includes(e)&&!tb(e)){let r=rb.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as kZ}from"node:process";var cb,$R,lb=y(()=>{cb=()=>kZ.bigint(),$R=t=>Number(kZ.bigint()-t)/1e6});var ub,kR=y(()=>{wZ();$Z();lb();nb();So();ub=(t,e,r)=>{let n=cb(),{command:i,escapedCommand:o}=iZ(t,e),s=_R(r,"verbose"),a=xZ(s,o,{...r});return SZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var RZ=v((ttt,OZ)=>{OZ.exports=TZ;TZ.sync=pve;var EZ=Ge("fs");function fve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{DZ.exports=PZ;PZ.sync=mve;var IZ=Ge("fs");function PZ(t,e,r){IZ.stat(t,function(n,i){r(n,n?!1:CZ(i,e))})}function mve(t,e){return CZ(IZ.statSync(t),e)}function CZ(t,e){return t.isFile()&&hve(t,e)}function hve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var MZ=v((itt,jZ)=>{var ntt=Ge("fs"),db;process.platform==="win32"||global.TESTING_WINDOWS?db=RZ():db=NZ();jZ.exports=ER;ER.sync=gve;function ER(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){ER(t,e||{},function(o,s){o?i(o):n(s)})})}db(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function gve(t,e){try{return db.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var HZ=v((ott,BZ)=>{var Ol=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",FZ=Ge("path"),yve=Ol?";":":",LZ=MZ(),zZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),UZ=(t,e)=>{let r=e.colon||yve,n=t.match(/\//)||Ol&&t.match(/\\/)?[""]:[...Ol?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ol?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Ol?i.split(r):[""];return Ol&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},qZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=UZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(zZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=FZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];LZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},_ve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=UZ(t,e),o=[];for(let s=0;s{"use strict";var GZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};AR.exports=GZ;AR.exports.default=GZ});var JZ=v((att,KZ)=>{"use strict";var VZ=Ge("path"),bve=HZ(),vve=ZZ();function WZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=bve.sync(t.command,{path:r[vve({env:r})],pathExt:e?VZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=VZ.resolve(i?t.options.cwd:"",s)),s}function Sve(t){return WZ(t)||WZ(t,!0)}KZ.exports=Sve});var YZ=v((ctt,OR)=>{"use strict";var TR=/([()\][%!^"`<>&|;, *?])/g;function wve(t){return t=t.replace(TR,"^$1"),t}function xve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(TR,"^$1"),e&&(t=t.replace(TR,"^$1")),t}OR.exports.command=wve;OR.exports.argument=xve});var QZ=v((ltt,XZ)=>{"use strict";XZ.exports=/^#!(.*)/});var t9=v((utt,e9)=>{"use strict";var $ve=QZ();e9.exports=(t="")=>{let e=t.match($ve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var n9=v((dtt,r9)=>{"use strict";var RR=Ge("fs"),kve=t9();function Eve(t){let r=Buffer.alloc(150),n;try{n=RR.openSync(t,"r"),RR.readSync(n,r,0,150,0),RR.closeSync(n)}catch{}return kve(r.toString())}r9.exports=Eve});var a9=v((ftt,s9)=>{"use strict";var Ave=Ge("path"),i9=JZ(),o9=YZ(),Tve=n9(),Ove=process.platform==="win32",Rve=/\.(?:com|exe)$/i,Ive=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Pve(t){t.file=i9(t);let e=t.file&&Tve(t.file);return e?(t.args.unshift(t.file),t.command=e,i9(t)):t.file}function Cve(t){if(!Ove)return t;let e=Pve(t),r=!Rve.test(e);if(t.options.forceShell||r){let n=Ive.test(e);t.command=Ave.normalize(t.command),t.command=o9.command(t.command),t.args=t.args.map(o=>o9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Dve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Cve(n)}s9.exports=Dve});var u9=v((ptt,l9)=>{"use strict";var IR=process.platform==="win32";function PR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Nve(t,e){if(!IR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=c9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function c9(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawn"):null}function jve(t,e){return IR&&t===1&&!e.file?PR(e.original,"spawnSync"):null}l9.exports={hookChildProcess:Nve,verifyENOENT:c9,verifyENOENTSync:jve,notFoundError:PR}});var p9=v((mtt,Rl)=>{"use strict";var d9=Ge("child_process"),CR=a9(),DR=u9();function f9(t,e,r){let n=CR(t,e,r),i=d9.spawn(n.command,n.args,n.options);return DR.hookChildProcess(i,n),i}function Mve(t,e,r){let n=CR(t,e,r),i=d9.spawnSync(n.command,n.args,n.options);return i.error=i.error||DR.verifyENOENTSync(i.status,n),i}Rl.exports=f9;Rl.exports.spawn=f9;Rl.exports.sync=Mve;Rl.exports._parse=CR;Rl.exports._enoent=DR});function fb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var m9=y(()=>{});var h9=y(()=>{});import{promisify as Fve}from"node:util";import{execFile as Lve,execFileSync as btt}from"node:child_process";import g9 from"node:path";import{fileURLToPath as zve}from"node:url";function pb(t){return t instanceof URL?zve(t):t}function y9(t){return{*[Symbol.iterator](){let e=g9.resolve(pb(t)),r;for(;r!==e;)yield e,r=e,e=g9.resolve(e,"..")}}}var wtt,xtt,_9=y(()=>{h9();wtt=Fve(Lve);xtt=10*1024*1024});import mb from"node:process";import Oa from"node:path";var Uve,qve,Bve,b9,v9=y(()=>{m9();_9();Uve=({cwd:t=mb.cwd(),path:e=mb.env[fb()],preferLocal:r=!0,execPath:n=mb.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(pb(t)),s=[],a=e.split(Oa.delimiter);return r&&qve(s,a,o),i&&Bve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},qve=(t,e,r)=>{for(let n of y9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Bve=(t,e,r,n)=>{let i=Oa.resolve(n,pb(r),"..");e.includes(i)||t.push(i)},b9=({env:t=mb.env,...e}={})=>{t={...t};let r=fb({env:t});return e.path=t[r],t[r]=Uve(e),t}});var S9,ti,w9,x9,$9,hb,Jf,Yf,Ra=y(()=>{S9=(t,e,r)=>{let n=r?Yf:Jf,i=t instanceof ti?{}:{cause:t};return new n(e,i)},ti=class extends Error{},w9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,$9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},x9=t=>hb(t)&&$9 in t,$9=Symbol("isExecaError"),hb=t=>Object.prototype.toString.call(t)==="[object Error]",Jf=class extends Error{};w9(Jf,Jf.name);Yf=class extends Error{};w9(Yf,Yf.name)});var k9,Hve,E9,A9,T9=y(()=>{k9=()=>{let t=A9-E9+1;return Array.from({length:t},Hve)},Hve=(t,e)=>({name:`SIGRT${e+1}`,number:E9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),E9=34,A9=64});var O9,R9=y(()=>{O9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Gve}from"node:os";var NR,Zve,I9=y(()=>{R9();T9();NR=()=>{let t=k9();return[...O9,...t].map(Zve)},Zve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Gve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Vve}from"node:os";var Wve,Kve,P9,Jve,Yve,Xve,ztt,C9=y(()=>{I9();Wve=()=>{let t=NR();return Object.fromEntries(t.map(Kve))},Kve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],P9=Wve(),Jve=()=>{let t=NR(),e=65,r=Array.from({length:e},(n,i)=>Yve(i,t));return Object.assign({},...r)},Yve=(t,e)=>{let r=Xve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Xve=(t,e)=>{let r=e.find(({name:n})=>Vve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},ztt=Jve()});import{constants as Xf}from"node:os";var N9,j9,M9,Qve,eSe,D9,tSe,jR,rSe,nSe,gb,Qf=y(()=>{C9();N9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return M9(t,e)},j9=t=>t===0?t:M9(t,"`subprocess.kill()`'s argument"),M9=(t,e)=>{if(Number.isInteger(t))return Qve(t,e);if(typeof t=="string")return tSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${jR()}`)},Qve=(t,e)=>{if(D9.has(t))return D9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${jR()}`)},eSe=()=>new Map(Object.entries(Xf.signals).reverse().map(([t,e])=>[e,t])),D9=eSe(),tSe=(t,e)=>{if(t in Xf.signals)return t;throw t.toUpperCase()in Xf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${jR()}`)},jR=()=>`Available signal names: ${rSe()}. -Available signal numbers: ${nSe()}.`,rSe=()=>Object.keys(Xf.signals).sort().map(t=>`'${t}'`).join(", "),nSe=()=>[...new Set(Object.values(Xf.signals).sort((t,e)=>t-e))].join(", "),gb=t=>P9[t].description});import{setTimeout as iSe}from"node:timers/promises";var F9,oSe,L9,sSe,aSe,cSe,MR,yb=y(()=>{Ra();Qf();F9=t=>{if(t===!1)return t;if(t===!0)return oSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},oSe=1e3*5,L9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=sSe(s,a,r);aSe(l,n);let u=t(c);return cSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},sSe=(t,e,r)=>{let[n=r,i]=hb(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!hb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:j9(n),error:i}},aSe=(t,e)=>{t!==void 0&&e.reject(t)},cSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&MR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},MR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await iSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as lSe}from"node:events";var _b,FR=y(()=>{_b=async(t,e)=>{t.aborted||await lSe(t,"abort",{signal:e})}});var z9,U9,uSe,LR=y(()=>{FR();z9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},U9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[uSe(t,e,n,i)],uSe=async(t,e,r,{signal:n})=>{throw await _b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Il,dSe,zR,q9,B9,bb,H9,G9,Z9,V9,W9,K9,fSe,pSe,mSe,ri,hSe,fs,Pl,Cl=y(()=>{Il=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{dSe(t,e,r),zR(t,e,n)},dSe=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},zR=(t,e,r)=>{if(!r)throw new Error(`${ri(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},q9=t=>{throw new Error(`${ri("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},B9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as ove}from"node:util";var Ci,sve,ave,cve,ub,lve,Ol=y(()=>{sb();vZ();wZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=sve({type:t,result:i,verboseInfo:n}),s=ave(e,o),a=SZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},sve=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),ave=(t,e)=>t.split(` +`).map(r=>cve({...e,message:r})),cve=t=>({verboseLine:bZ(t),verboseObject:t}),ub=t=>{let e=typeof t=="string"?t:ove(t);return Yf(e).replaceAll(" "," ".repeat(lve))},lve=2});var xZ,$Z=y(()=>{ds();Ol();xZ=(t,e)=>{Al(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var kZ,uve,dve,fve,EZ=y(()=>{ds();kZ=(t,e,r)=>{fve(t);let n=uve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},uve=t=>Al({verbose:t})?dve++:void 0,dve=0n,fve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ob.includes(e)&&!ib(e)){let r=ob.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as AZ}from"node:process";var db,kR,fb=y(()=>{db=()=>AZ.bigint(),kR=t=>Number(AZ.bigint()-t)/1e6});var pb,ER=y(()=>{$Z();EZ();fb();sb();wo();pb=(t,e,r)=>{let n=db(),{command:i,escapedCommand:o}=sZ(t,e),s=bR(r,"verbose"),a=kZ(s,o,{...r});return xZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var PZ=v((ltt,IZ)=>{IZ.exports=RZ;RZ.sync=mve;var TZ=Ge("fs");function pve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{jZ.exports=DZ;DZ.sync=hve;var CZ=Ge("fs");function DZ(t,e,r){CZ.stat(t,function(n,i){r(n,n?!1:NZ(i,e))})}function hve(t,e){return NZ(CZ.statSync(t),e)}function NZ(t,e){return t.isFile()&&gve(t,e)}function gve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var LZ=v((ftt,FZ)=>{var dtt=Ge("fs"),mb;process.platform==="win32"||global.TESTING_WINDOWS?mb=PZ():mb=MZ();FZ.exports=AR;AR.sync=yve;function AR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){AR(t,e||{},function(o,s){o?i(o):n(s)})})}mb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function yve(t,e){try{return mb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var ZZ=v((ptt,GZ)=>{var Rl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zZ=Ge("path"),_ve=Rl?";":":",UZ=LZ(),qZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),BZ=(t,e)=>{let r=e.colon||_ve,n=t.match(/\//)||Rl&&t.match(/\\/)?[""]:[...Rl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Rl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Rl?i.split(r):[""];return Rl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},HZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=BZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(qZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=zZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];UZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},bve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=BZ(t,e),o=[];for(let s=0;s{"use strict";var VZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TR.exports=VZ;TR.exports.default=VZ});var XZ=v((htt,YZ)=>{"use strict";var KZ=Ge("path"),vve=ZZ(),Sve=WZ();function JZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=vve.sync(t.command,{path:r[Sve({env:r})],pathExt:e?KZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=KZ.resolve(i?t.options.cwd:"",s)),s}function wve(t){return JZ(t)||JZ(t,!0)}YZ.exports=wve});var QZ=v((gtt,RR)=>{"use strict";var OR=/([()\][%!^"`<>&|;, *?])/g;function xve(t){return t=t.replace(OR,"^$1"),t}function $ve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OR,"^$1"),e&&(t=t.replace(OR,"^$1")),t}RR.exports.command=xve;RR.exports.argument=$ve});var t9=v((ytt,e9)=>{"use strict";e9.exports=/^#!(.*)/});var n9=v((_tt,r9)=>{"use strict";var kve=t9();r9.exports=(t="")=>{let e=t.match(kve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var o9=v((btt,i9)=>{"use strict";var IR=Ge("fs"),Eve=n9();function Ave(t){let r=Buffer.alloc(150),n;try{n=IR.openSync(t,"r"),IR.readSync(n,r,0,150,0),IR.closeSync(n)}catch{}return Eve(r.toString())}i9.exports=Ave});var l9=v((vtt,c9)=>{"use strict";var Tve=Ge("path"),s9=XZ(),a9=QZ(),Ove=o9(),Rve=process.platform==="win32",Ive=/\.(?:com|exe)$/i,Pve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Cve(t){t.file=s9(t);let e=t.file&&Ove(t.file);return e?(t.args.unshift(t.file),t.command=e,s9(t)):t.file}function Dve(t){if(!Rve)return t;let e=Cve(t),r=!Ive.test(e);if(t.options.forceShell||r){let n=Pve.test(e);t.command=Tve.normalize(t.command),t.command=a9.command(t.command),t.args=t.args.map(o=>a9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Nve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Dve(n)}c9.exports=Nve});var f9=v((Stt,d9)=>{"use strict";var PR=process.platform==="win32";function CR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function jve(t,e){if(!PR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=u9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function u9(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawn"):null}function Mve(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawnSync"):null}d9.exports={hookChildProcess:jve,verifyENOENT:u9,verifyENOENTSync:Mve,notFoundError:CR}});var h9=v((wtt,Il)=>{"use strict";var p9=Ge("child_process"),DR=l9(),NR=f9();function m9(t,e,r){let n=DR(t,e,r),i=p9.spawn(n.command,n.args,n.options);return NR.hookChildProcess(i,n),i}function Fve(t,e,r){let n=DR(t,e,r),i=p9.spawnSync(n.command,n.args,n.options);return i.error=i.error||NR.verifyENOENTSync(i.status,n),i}Il.exports=m9;Il.exports.spawn=m9;Il.exports.sync=Fve;Il.exports._parse=DR;Il.exports._enoent=NR});function hb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var g9=y(()=>{});var y9=y(()=>{});import{promisify as Lve}from"node:util";import{execFile as zve,execFileSync as Att}from"node:child_process";import _9 from"node:path";import{fileURLToPath as Uve}from"node:url";function gb(t){return t instanceof URL?Uve(t):t}function b9(t){return{*[Symbol.iterator](){let e=_9.resolve(gb(t)),r;for(;r!==e;)yield e,r=e,e=_9.resolve(e,"..")}}}var Rtt,Itt,v9=y(()=>{y9();Rtt=Lve(zve);Itt=10*1024*1024});import yb from"node:process";import Ra from"node:path";var qve,Bve,Hve,S9,w9=y(()=>{g9();v9();qve=({cwd:t=yb.cwd(),path:e=yb.env[hb()],preferLocal:r=!0,execPath:n=yb.execPath,addExecPath:i=!0}={})=>{let o=Ra.resolve(gb(t)),s=[],a=e.split(Ra.delimiter);return r&&Bve(s,a,o),i&&Hve(s,a,n,o),e===""||e===Ra.delimiter?`${s.join(Ra.delimiter)}${e}`:[...s,e].join(Ra.delimiter)},Bve=(t,e,r)=>{for(let n of b9(r)){let i=Ra.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Hve=(t,e,r,n)=>{let i=Ra.resolve(n,gb(r),"..");e.includes(i)||t.push(i)},S9=({env:t=yb.env,...e}={})=>{t={...t};let r=hb({env:t});return e.path=t[r],t[r]=qve(e),t}});var x9,ri,$9,k9,E9,_b,Xf,Qf,Ia=y(()=>{x9=(t,e,r)=>{let n=r?Qf:Xf,i=t instanceof ri?{}:{cause:t};return new n(e,i)},ri=class extends Error{},$9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,E9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},k9=t=>_b(t)&&E9 in t,E9=Symbol("isExecaError"),_b=t=>Object.prototype.toString.call(t)==="[object Error]",Xf=class extends Error{};$9(Xf,Xf.name);Qf=class extends Error{};$9(Qf,Qf.name)});var A9,Gve,T9,O9,R9=y(()=>{A9=()=>{let t=O9-T9+1;return Array.from({length:t},Gve)},Gve=(t,e)=>({name:`SIGRT${e+1}`,number:T9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),T9=34,O9=64});var I9,P9=y(()=>{I9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Zve}from"node:os";var jR,Vve,C9=y(()=>{P9();R9();jR=()=>{let t=A9();return[...I9,...t].map(Vve)},Vve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Zve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Wve}from"node:os";var Kve,Jve,D9,Yve,Xve,Qve,Wtt,N9=y(()=>{C9();Kve=()=>{let t=jR();return Object.fromEntries(t.map(Jve))},Jve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],D9=Kve(),Yve=()=>{let t=jR(),e=65,r=Array.from({length:e},(n,i)=>Xve(i,t));return Object.assign({},...r)},Xve=(t,e)=>{let r=Qve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Qve=(t,e)=>{let r=e.find(({name:n})=>Wve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Wtt=Yve()});import{constants as ep}from"node:os";var M9,F9,L9,eSe,tSe,j9,rSe,MR,nSe,iSe,bb,tp=y(()=>{N9();M9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return L9(t,e)},F9=t=>t===0?t:L9(t,"`subprocess.kill()`'s argument"),L9=(t,e)=>{if(Number.isInteger(t))return eSe(t,e);if(typeof t=="string")return rSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${MR()}`)},eSe=(t,e)=>{if(j9.has(t))return j9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${MR()}`)},tSe=()=>new Map(Object.entries(ep.signals).reverse().map(([t,e])=>[e,t])),j9=tSe(),rSe=(t,e)=>{if(t in ep.signals)return t;throw t.toUpperCase()in ep.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${MR()}`)},MR=()=>`Available signal names: ${nSe()}. +Available signal numbers: ${iSe()}.`,nSe=()=>Object.keys(ep.signals).sort().map(t=>`'${t}'`).join(", "),iSe=()=>[...new Set(Object.values(ep.signals).sort((t,e)=>t-e))].join(", "),bb=t=>D9[t].description});import{setTimeout as oSe}from"node:timers/promises";var z9,sSe,U9,aSe,cSe,lSe,FR,vb=y(()=>{Ia();tp();z9=t=>{if(t===!1)return t;if(t===!0)return sSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},sSe=1e3*5,U9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=aSe(s,a,r);cSe(l,n);let u=t(c);return lSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},aSe=(t,e,r)=>{let[n=r,i]=_b(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!_b(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:F9(n),error:i}},cSe=(t,e)=>{t!==void 0&&e.reject(t)},lSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await oSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as uSe}from"node:events";var Sb,LR=y(()=>{Sb=async(t,e)=>{t.aborted||await uSe(t,"abort",{signal:e})}});var q9,B9,dSe,zR=y(()=>{LR();q9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},B9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[dSe(t,e,n,i)],dSe=async(t,e,r,{signal:n})=>{throw await Sb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Pl,fSe,UR,H9,G9,wb,Z9,V9,W9,K9,J9,Y9,pSe,mSe,hSe,ni,gSe,fs,Cl,Dl=y(()=>{Pl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{fSe(t,e,r),UR(t,e,n)},fSe=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},UR=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},H9=t=>{throw new Error(`${ni("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},G9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ - ${ri("getOneMessage",t)}, - ${ri("sendMessage",t,"message, {strict: true}")}, -]);`)},bb=(t,e)=>new Error(`${ri("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),H9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},G9=t=>{throw new Error(`${ri("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},Z9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),V9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},W9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ri(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},K9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(fSe(t))throw new Error(`${ri(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},fSe=({code:t,message:e})=>pSe.has(t)||mSe.some(r=>e.includes(r)),pSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),mSe=["could not be cloned","circular structure","call stack size exceeded"],ri=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${hSe(e)}${t}(${r})`,hSe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Pl=t=>{t.connected&&t.disconnect()}});var Ci,Dl=y(()=>{Ci=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Sb,Nl,Di,J9,gSe,ySe,Y9,_Se,X9,ep,vb,ps=y(()=>{So();Sb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Y9(o,e,n,!0));return s},Nl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Di.get(t),o=J9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Y9(o,e,n,!1));return s},Di=new WeakMap,J9=(t,e,r)=>{let n=gSe(e,r);return ySe(n,e,r,t),n},gSe=(t,e)=>{let r=bR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${ep(e)}" must not be "${t}". + ${ni("getOneMessage",t)}, + ${ni("sendMessage",t,"message, {strict: true}")}, +]);`)},wb=(t,e)=>new Error(`${ni("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),Z9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},V9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},W9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),K9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},J9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ni(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},Y9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(pSe(t))throw new Error(`${ni(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},pSe=({code:t,message:e})=>mSe.has(t)||hSe.some(r=>e.includes(r)),mSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),hSe=["could not be cloned","circular structure","call stack size exceeded"],ni=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${gSe(e)}${t}(${r})`,gSe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Cl=t=>{t.connected&&t.disconnect()}});var Di,Nl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var $b,jl,Ni,X9,ySe,_Se,Q9,bSe,eV,rp,xb,ps=y(()=>{wo();$b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Q9(o,e,n,!0));return s},jl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Q9(o,e,n,!1));return s},Ni=new WeakMap,X9=(t,e,r)=>{let n=ySe(e,r);return _Se(n,e,r,t),n},ySe=(t,e)=>{let r=vR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${rp(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},ySe=(t,e,r,n)=>{let i=n[X9(t)];if(i===void 0)throw new TypeError(`"${ep(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${ep(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${ep(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Y9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=_Se(t,r);return`The "${i}: ${vb(o)}" option is incompatible with using "${ep(n)}: ${vb(e)}". -Please set this option with "pipe" instead.`},_Se=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=X9(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},X9=t=>t==="all"?1:t,ep=t=>t?"to":"from",vb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as bSe}from"node:events";var Ia,wb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),bSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var xb,UR,$b,qR,Q9,eV,tp=y(()=>{xb=(t,e)=>{e&&UR(t)},UR=t=>{t.refCounted()},$b=(t,e)=>{e&&qR(t)},qR=t=>{t.unrefCounted()},Q9=(t,e)=>{e&&(qR(t),qR(t))},eV=(t,e)=>{e&&(UR(t),UR(t))}});import{once as vSe}from"node:events";import{scheduler as SSe}from"node:timers/promises";var tV,rV,kb,nV=y(()=>{Ab();tp();Eb();Tb();tV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(oV(i)||aV(i))return;kb.has(t)||kb.set(t,[]);let o=kb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await sV(t,n,i),await SSe.yield();let s=await iV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},rV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{BR();let o=kb.get(t);for(;o?.length>0;)await vSe(n,"message:done");t.removeListener("message",i),eV(e,r),n.connected=!1,n.emit("disconnect")},kb=new WeakMap});import{EventEmitter as wSe}from"node:events";var ms,Ob,xSe,Rb,rp=y(()=>{nV();tp();ms=(t,e,r)=>{if(Ob.has(t))return Ob.get(t);let n=new wSe;return n.connected=!0,Ob.set(t,n),xSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Ob=new WeakMap,xSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=tV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",rV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),Q9(r,n)},Rb=t=>{let e=Ob.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as $Se}from"node:events";var cV,kSe,lV,iV,oV,uV,Ib,ESe,Pb,dV,Eb=y(()=>{Dl();wb();Nb();Cl();rp();Ab();cV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=Cb(t,o);return{id:kSe++,type:Pb,message:n,hasListeners:s}},kSe=0n,lV=(t,e)=>{if(!(e?.type!==Pb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Ib[r].resolve({isDeadlock:!0,hasListeners:!1})},iV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Pb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:dV,message:Cb(e,i)};try{await Db({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},oV=t=>{if(t?.type!==dV)return!1;let{id:e,message:r}=t;return Ib[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},uV=async(t,e,r)=>{if(t?.type!==Pb)return;let n=Ci();Ib[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ESe(e,r,i)]);o&&B9(r),s||H9(r)}finally{i.abort(),delete Ib[t.id]}},Ib={},ESe=async(t,e,{signal:r})=>{Ia(t,1,r),await $Se(t,"disconnect",{signal:r}),G9(e)},Pb="execa:ipc:request",dV="execa:ipc:response"});var fV,pV,sV,np,Cb,ASe,Ab=y(()=>{Dl();So();ps();Eb();fV=(t,e,r)=>{np.has(t)||np.set(t,new Set);let n=np.get(t),i=Ci(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},pV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},sV=async(t,e,r)=>{for(;!Cb(t,e)&&np.get(t)?.size>0;){let n=[...np.get(t)];lV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},np=new WeakMap,Cb=(t,e)=>e.listenerCount("message")>ASe(t),ASe=t=>Di.has(t)&&!vo(Di.get(t).options.buffer,"ipc")?1:0});import{promisify as TSe}from"node:util";var Db,OSe,GR,RSe,HR,Nb=y(()=>{Cl();Ab();Eb();Db=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Il({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),OSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},OSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=cV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=fV(t,s,o);try{await GR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Pl(t),c}finally{pV(a)}},GR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=RSe(t);try{await Promise.all([uV(n,t,r),o(n)])}catch(s){throw W9({error:s,methodName:e,isSubprocess:r}),K9({error:s,methodName:e,isSubprocess:r,message:i}),s}},RSe=t=>{if(HR.has(t))return HR.get(t);let e=TSe(t.send.bind(t));return HR.set(t,e),e},HR=new WeakMap});import{scheduler as ISe}from"node:timers/promises";var hV,gV,PSe,mV,aV,yV,BR,ZR,Tb=y(()=>{Nb();rp();Cl();hV=(t,e)=>{let r="cancelSignal";return zR(r,!1,t.connected),GR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:yV,message:e},message:e})},gV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await PSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),ZR.signal),PSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!mV){if(mV=!0,!n){V9();return}if(e===null){BR();return}ms(t,e,r),await ISe.yield()}},mV=!1,aV=t=>t?.type!==yV?!1:(ZR.abort(t.message),!0),yV="execa:ipc:cancel",BR=()=>{ZR.abort(Z9())},ZR=new AbortController});var _V,bV,CSe,DSe,VR=y(()=>{FR();Tb();yb();_V=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},bV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[CSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],CSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await _b(e,i);let o=DSe(e);throw await hV(t,o),MR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},DSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as NSe}from"node:timers/promises";var vV,SV,jSe,WR=y(()=>{Ra();vV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},SV=(t,e,r,n)=>e===0||e===void 0?[]:[jSe(t,e,r,n)],jSe=async(t,e,r,{signal:n})=>{throw await NSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ti}});import{execPath as MSe,execArgv as FSe}from"node:process";import wV from"node:path";var xV,$V,KR=y(()=>{kl();xV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},$V=(t,e,{node:r=!1,nodePath:n=MSe,nodeOptions:i=FSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=$l(n,'The "nodePath" option'),l=wV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(wV.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as LSe}from"node:v8";var kV,zSe,USe,qSe,EV,JR=y(()=>{kV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");qSe[r](t)}},zSe=t=>{try{LSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},USe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},qSe={advanced:zSe,json:USe},EV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var TV,BSe,sn,YR,HSe,AV,jb,Pa=y(()=>{TV=({encoding:t})=>{if(YR.has(t))return;let e=HSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. -Please rename it to ${jb(e)}.`);let r=[...YR].map(n=>jb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${jb(t)}\`. -Please rename it to one of: ${r}.`)},BSe=new Set(["utf8","utf16le"]),sn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),YR=new Set([...BSe,...sn]),HSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in AV)return AV[e];if(YR.has(e))return e},AV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},jb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as GSe}from"node:fs";import ZSe from"node:path";import VSe from"node:process";var OV,RV,IV,XR=y(()=>{kl();OV=(t=RV())=>{let e=$l(t,'The "cwd" option');return ZSe.resolve(e)},RV=()=>{try{return VSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},IV=(t,e)=>{if(e===RV())return t;let r;try{r=GSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},_Se=(t,e,r,n)=>{let i=n[eV(t)];if(i===void 0)throw new TypeError(`"${rp(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Q9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=bSe(t,r);return`The "${i}: ${xb(o)}" option is incompatible with using "${rp(n)}: ${xb(e)}". +Please set this option with "pipe" instead.`},bSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=eV(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},eV=t=>t==="all"?1:t,rp=t=>t?"to":"from",xb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as vSe}from"node:events";var Pa,kb=y(()=>{Pa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),vSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Eb,qR,Ab,BR,tV,rV,np=y(()=>{Eb=(t,e)=>{e&&qR(t)},qR=t=>{t.refCounted()},Ab=(t,e)=>{e&&BR(t)},BR=t=>{t.unrefCounted()},tV=(t,e)=>{e&&(BR(t),BR(t))},rV=(t,e)=>{e&&(qR(t),qR(t))}});import{once as SSe}from"node:events";import{scheduler as wSe}from"node:timers/promises";var nV,iV,Tb,oV=y(()=>{Rb();np();Ob();Ib();nV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(aV(i)||lV(i))return;Tb.has(t)||Tb.set(t,[]);let o=Tb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await cV(t,n,i),await wSe.yield();let s=await sV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},iV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HR();let o=Tb.get(t);for(;o?.length>0;)await SSe(n,"message:done");t.removeListener("message",i),rV(e,r),n.connected=!1,n.emit("disconnect")},Tb=new WeakMap});import{EventEmitter as xSe}from"node:events";var ms,Pb,$Se,Cb,ip=y(()=>{oV();np();ms=(t,e,r)=>{if(Pb.has(t))return Pb.get(t);let n=new xSe;return n.connected=!0,Pb.set(t,n),$Se({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Pb=new WeakMap,$Se=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=nV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",iV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),tV(r,n)},Cb=t=>{let e=Pb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as kSe}from"node:events";var uV,ESe,dV,sV,aV,fV,Db,ASe,Nb,pV,Ob=y(()=>{Nl();kb();Fb();Dl();ip();Rb();uV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=jb(t,o);return{id:ESe++,type:Nb,message:n,hasListeners:s}},ESe=0n,dV=(t,e)=>{if(!(e?.type!==Nb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Db[r].resolve({isDeadlock:!0,hasListeners:!1})},sV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Nb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:pV,message:jb(e,i)};try{await Mb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},aV=t=>{if(t?.type!==pV)return!1;let{id:e,message:r}=t;return Db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},fV=async(t,e,r)=>{if(t?.type!==Nb)return;let n=Di();Db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ASe(e,r,i)]);o&&G9(r),s||Z9(r)}finally{i.abort(),delete Db[t.id]}},Db={},ASe=async(t,e,{signal:r})=>{Pa(t,1,r),await kSe(t,"disconnect",{signal:r}),V9(e)},Nb="execa:ipc:request",pV="execa:ipc:response"});var mV,hV,cV,op,jb,TSe,Rb=y(()=>{Nl();wo();ps();Ob();mV=(t,e,r)=>{op.has(t)||op.set(t,new Set);let n=op.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},hV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},cV=async(t,e,r)=>{for(;!jb(t,e)&&op.get(t)?.size>0;){let n=[...op.get(t)];dV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},op=new WeakMap,jb=(t,e)=>e.listenerCount("message")>TSe(t),TSe=t=>Ni.has(t)&&!So(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as OSe}from"node:util";var Mb,RSe,ZR,ISe,GR,Fb=y(()=>{Dl();Rb();Ob();Mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Pl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),RSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},RSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=uV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=mV(t,s,o);try{await ZR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Cl(t),c}finally{hV(a)}},ZR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ISe(t);try{await Promise.all([fV(n,t,r),o(n)])}catch(s){throw J9({error:s,methodName:e,isSubprocess:r}),Y9({error:s,methodName:e,isSubprocess:r,message:i}),s}},ISe=t=>{if(GR.has(t))return GR.get(t);let e=OSe(t.send.bind(t));return GR.set(t,e),e},GR=new WeakMap});import{scheduler as PSe}from"node:timers/promises";var yV,_V,CSe,gV,lV,bV,HR,VR,Ib=y(()=>{Fb();ip();Dl();yV=(t,e)=>{let r="cancelSignal";return UR(r,!1,t.connected),ZR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:bV,message:e},message:e})},_V=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await CSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),VR.signal),CSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!gV){if(gV=!0,!n){K9();return}if(e===null){HR();return}ms(t,e,r),await PSe.yield()}},gV=!1,lV=t=>t?.type!==bV?!1:(VR.abort(t.message),!0),bV="execa:ipc:cancel",HR=()=>{VR.abort(W9())},VR=new AbortController});var vV,SV,DSe,NSe,WR=y(()=>{LR();Ib();vb();vV=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},SV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[DSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],DSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Sb(e,i);let o=NSe(e);throw await yV(t,o),FR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},NSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as jSe}from"node:timers/promises";var wV,xV,MSe,KR=y(()=>{Ia();wV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},xV=(t,e,r,n)=>e===0||e===void 0?[]:[MSe(t,e,r,n)],MSe=async(t,e,r,{signal:n})=>{throw await jSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ri}});import{execPath as FSe,execArgv as LSe}from"node:process";import $V from"node:path";var kV,EV,JR=y(()=>{El();kV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},EV=(t,e,{node:r=!1,nodePath:n=FSe,nodeOptions:i=LSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=kl(n,'The "nodePath" option'),l=$V.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if($V.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as zSe}from"node:v8";var AV,USe,qSe,BSe,TV,YR=y(()=>{AV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");BSe[r](t)}},USe=t=>{try{zSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},qSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},BSe={advanced:USe,json:qSe},TV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var RV,HSe,an,XR,GSe,OV,Lb,Ca=y(()=>{RV=({encoding:t})=>{if(XR.has(t))return;let e=GSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. +Please rename it to ${Lb(e)}.`);let r=[...XR].map(n=>Lb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. +Please rename it to one of: ${r}.`)},HSe=new Set(["utf8","utf16le"]),an=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),XR=new Set([...HSe,...an]),GSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in OV)return OV[e];if(XR.has(e))return e},OV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Lb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as ZSe}from"node:fs";import VSe from"node:path";import WSe from"node:process";var IV,PV,CV,QR=y(()=>{El();IV=(t=PV())=>{let e=kl(t,'The "cwd" option');return VSe.resolve(e)},PV=()=>{try{return WSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},CV=(t,e)=>{if(e===PV())return t;let r;try{r=ZSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import WSe from"node:path";import PV from"node:process";var CV,Mb,KSe,JSe,QR=y(()=>{CV=St(p9(),1);v9();yb();Qf();LR();VR();WR();KR();JR();Pa();XR();kl();So();Mb=(t,e,r)=>{r.cwd=OV(r.cwd);let[n,i,o]=$V(t,e,r),{command:s,args:a,options:c}=CV.default._parse(n,i,o),l=rZ(c),u=KSe(l);return vV(u),TV(u),kV(u),z9(u),_V(u),u.shell=mR(u.shell),u.env=JSe(u),u.killSignal=N9(u.killSignal),u.forceKillAfterDelay=F9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!sn.has(u.encoding)&&u.buffer[f]),PV.platform==="win32"&&WSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},KSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),JSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...PV.env,...t}:t;return r||n?b9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Fb,eI=y(()=>{Fb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function jl(t){if(typeof t=="string")return YSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return XSe(t)}var YSe,XSe,DV,QSe,NV,ewe,tI=y(()=>{YSe=t=>t.at(-1)===DV?t.slice(0,t.at(-2)===NV?-2:-1):t,XSe=t=>t.at(-1)===QSe?t.subarray(0,t.at(-2)===ewe?-2:-1):t,DV=` -`,QSe=DV.codePointAt(0),NV="\r",ewe=NV.codePointAt(0)});function ni(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function rI(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Ca(t,{checkOpen:e=!0}={}){return ni(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function nI(t,e){return rI(t,e)&&Ca(t,e)}var Da=y(()=>{});function jV(){return this[oI].next()}function MV(t){return this[oI].return(t)}function sI({preventCancel:t=!1}={}){let e=this.getReader(),r=new iI(e,t),n=Object.create(rwe);return n[oI]=r,n}var twe,iI,oI,rwe,FV=y(()=>{twe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),iI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},oI=Symbol();Object.defineProperty(jV,"name",{value:"next"});Object.defineProperty(MV,"name",{value:"return"});rwe=Object.create(twe,{next:{enumerable:!0,configurable:!0,writable:!0,value:jV},return:{enumerable:!0,configurable:!0,writable:!0,value:MV}})});var LV=y(()=>{});var zV=y(()=>{FV();LV()});var UV,nwe,iwe,owe,ip,aI=y(()=>{Da();zV();UV=t=>{if(Ca(t,{checkOpen:!1})&&ip.on!==void 0)return iwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(nwe.call(t)==="[object ReadableStream]")return sI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:nwe}=Object.prototype,iwe=async function*(t){let e=new AbortController,r={};owe(t,e,r);try{for await(let[n]of ip.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},owe=async(t,e,r)=>{try{await ip.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},ip={}});var Ml,swe,HV,qV,awe,BV,Ni,op=y(()=>{aI();Ml=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=UV(t),u=e();u.length=0;try{for await(let d of l){let f=awe(d),p=r[f](d,u);HV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return swe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},swe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&HV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},HV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){qV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&qV(c,e,i,o),new Ni},qV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},awe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=BV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&BV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:BV}=Object.prototype,Ni=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var wo,sp,Lb,zb,Ub,qb=y(()=>{wo=t=>t,sp=()=>{},Lb=({contents:t})=>t,zb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ub=t=>t.length});async function Bb(t,e){return Ml(t,dwe,e)}var cwe,lwe,uwe,dwe,GV=y(()=>{op();qb();cwe=()=>({contents:[]}),lwe=()=>1,uwe=(t,{contents:e})=>(e.push(t),e),dwe={init:cwe,convertChunk:{string:wo,buffer:wo,arrayBuffer:wo,dataView:wo,typedArray:wo,others:wo},getSize:lwe,truncateChunk:sp,addChunk:uwe,getFinalChunk:sp,finalize:Lb}});async function Hb(t,e){return Ml(t,vwe,e)}var fwe,pwe,mwe,ZV,VV,hwe,gwe,ywe,_we,KV,WV,bwe,JV,vwe,YV=y(()=>{op();qb();fwe=()=>({contents:new ArrayBuffer(0)}),pwe=t=>mwe.encode(t),mwe=new TextEncoder,ZV=t=>new Uint8Array(t),VV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),hwe=(t,e)=>t.slice(0,e),gwe=(t,{contents:e,length:r},n)=>{let i=JV()?_we(e,n):ywe(e,n);return new Uint8Array(i).set(t,r),i},ywe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(KV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},_we=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:KV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},KV=t=>WV**Math.ceil(Math.log(t)/Math.log(WV)),WV=2,bwe=({contents:t,length:e})=>JV()?t:t.slice(0,e),JV=()=>"resize"in ArrayBuffer.prototype,vwe={init:fwe,convertChunk:{string:pwe,buffer:ZV,arrayBuffer:ZV,dataView:VV,typedArray:VV,others:zb},getSize:Ub,truncateChunk:hwe,addChunk:gwe,getFinalChunk:sp,finalize:bwe}});async function Zb(t,e){return Ml(t,kwe,e)}var Swe,Gb,wwe,xwe,$we,kwe,XV=y(()=>{op();qb();Swe=()=>({contents:"",textDecoder:new TextDecoder}),Gb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),wwe=(t,{contents:e})=>e+t,xwe=(t,e)=>t.slice(0,e),$we=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},kwe={init:Swe,convertChunk:{string:wo,buffer:Gb,arrayBuffer:Gb,dataView:Gb,typedArray:Gb,others:zb},getSize:Ub,truncateChunk:xwe,addChunk:wwe,getFinalChunk:$we,finalize:Lb}});var QV=y(()=>{GV();YV();XV();op()});import{on as Ewe}from"node:events";import{finished as Awe}from"node:stream/promises";var Vb=y(()=>{aI();QV();Object.assign(ip,{on:Ewe,finished:Awe})});var eW,Twe,tW,rW,Owe,nW,iW,Wb,Na=y(()=>{Vb();bo();So();eW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ni))throw t;if(o==="all")return t;let s=Twe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Twe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",tW=(t,e,r)=>{if(e.length!==r)return;let n=new Ni;throw n.maxBufferInfo={fdNumber:"ipc"},n},rW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Owe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=vo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:eb(r),threshold:i,unit:n}},nW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Wb(r)),iW=(t,e,r)=>{if(!e)return t;let n=Wb(r);return t.length>n?t.slice(0,n):t},Wb=([,t])=>t});import{inspect as Rwe}from"node:util";var sW,Iwe,Pwe,Cwe,Dwe,Nwe,oW,aW=y(()=>{tI();on();XR();nb();Na();Qf();Ra();sW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Iwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Cwe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>Dwe(D)).join(` -`)].map(D=>Kf(jl(Nwe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},Iwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Pwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${rW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${gb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Pwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Cwe=(t,e)=>{if(t instanceof ti)return;let r=x9(t)?t.originalMessage:String(t?.message??t),n=Kf(IV(r,e));return n===""?void 0:n},Dwe=t=>typeof t=="string"?t:Rwe(t),Nwe=t=>Array.isArray(t)?t.map(e=>jl(oW(e))).filter(Boolean).join(` -`):oW(t),oW=t=>typeof t=="string"?t:qt(t)?X_(t):""});var Kb,Fl,ap,jwe,cW,Mwe,cp=y(()=>{Qf();lb();Ra();aW();Kb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>cW({command:t,escapedCommand:e,cwd:o,durationMs:$R(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Fl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>ap({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),ap=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Mwe(l,u),{originalMessage:A,shortMessage:D,message:$}=sW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=S9(t,$,x);return Object.assign(re,jwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},jwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>cW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:$R(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),cW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Mwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:gb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Fwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(lW(t*1e3)%1e3),nanoseconds:Math.trunc(lW(t*1e6)%1e3)}}function Lwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function cI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Fwe(t);break}case"bigint":return Lwe(t)}throw new TypeError("Expected a finite number or bigint")}var lW,uW=y(()=>{lW=t=>Number.isFinite(t)?t:0});function lI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+qwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&zwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Uwe(d,u):f;i.push(p)}},a=cI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Bwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var zwe,Uwe,qwe,Bwe,dW=y(()=>{uW();zwe=t=>t===0||t===0n,Uwe=(t,e)=>e===1||e===1n?t:`${t}s`,qwe=1e-7,Bwe=24n*60n*60n*1000n});var fW,pW=y(()=>{Tl();fW=(t,e)=>{t.failed&&Pi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var mW,Hwe,hW=y(()=>{dW();ds();Tl();pW();mW=(t,e)=>{El(e)&&(fW(t,e),Hwe(t,e))},Hwe=(t,e)=>{let r=`(done in ${lI(t.durationMs)})`;Pi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ll,Jb=y(()=>{hW();Ll=(t,e,{reject:r})=>{if(mW(t,e),t.failed&&r)throw t;return t}});var _W,Gwe,Zwe,bW,vW,gW,Vwe,uI,yW,ja,SW,Wwe,Yb,wW,Kwe,Jwe,dI,xW,Ywe,$W,Xb,Xwe,fI,Qwe,exe,kW,In,Qb,pI,EW,AW,hs,wr=y(()=>{Da();yo();on();_W=(t,e)=>ja(t)?"asyncGenerator":SW(t)?"generator":Yb(t)?"fileUrl":Kwe(t)?"filePath":Xwe(t)?"webStream":ni(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Qwe(t)?"asyncIterable":exe(t)?"iterable":fI(t)?bW({transform:t},e):Wwe(t)?Gwe(t,e):"native",Gwe=(t,e)=>nI(t.transform,{checkOpen:!1})?Zwe(t,e):fI(t.transform)?bW(t,e):Vwe(t,e),Zwe=(t,e)=>(vW(t,e,"Duplex stream"),"duplex"),bW=(t,e)=>(vW(t,e,"web TransformStream"),"webTransform"),vW=({final:t,binary:e,objectMode:r},n,i)=>{gW(t,`${n}.final`,i),gW(e,`${n}.binary`,i),uI(r,`${n}.objectMode`)},gW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Vwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!yW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(nI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(fI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!yW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return uI(r,`${i}.binary`),uI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},uI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},yW=t=>ja(t)||SW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",SW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Wwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Yb=t=>Object.prototype.toString.call(t)==="[object URL]",wW=t=>Yb(t)&&t.protocol!=="file:",Kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Jwe.has(e))&&dI(t.file),Jwe=new Set(["file","append"]),dI=t=>typeof t=="string",xW=(t,e)=>t==="native"&&typeof e=="string"&&!Ywe.has(e),Ywe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),$W=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Xb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Xwe=t=>$W(t)||Xb(t),fI=t=>$W(t?.readable)&&Xb(t?.writable),Qwe=t=>kW(t)&&typeof t[Symbol.asyncIterator]=="function",exe=t=>kW(t)&&typeof t[Symbol.iterator]=="function",kW=t=>typeof t=="object"&&t!==null,In=new Set(["generator","asyncGenerator","duplex","webTransform"]),Qb=new Set(["fileUrl","filePath","fileNumber"]),pI=new Set(["fileUrl","filePath"]),EW=new Set([...pI,"webStream","nodeStream"]),AW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var mI,txe,rxe,TW,hI=y(()=>{wr();mI=(t,e,r,n)=>n==="output"?txe(t,e,r):rxe(t,e,r),txe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},rxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},TW=(t,e)=>{let r=t.findLast(({type:n})=>In.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var OW,nxe,ixe,oxe,sxe,axe,cxe,RW=y(()=>{yo();Pa();wr();hI();OW=(t,e,r,n)=>[...t.filter(({type:i})=>!In.has(i)),...nxe(t,e,r,n)],nxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>In.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=ixe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return cxe(o,r)},ixe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?oxe({stdioItem:t,optionName:i}):e==="webTransform"?sxe({stdioItem:t,index:r,newTransforms:n,direction:o}):axe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),oxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},sxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=mI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},axe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||sn.has(o),{writableObjectMode:f,readableObjectMode:p}=mI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},cxe=(t,e)=>e==="input"?t.reverse():t});import gI from"node:process";var IW,lxe,uxe,zl,yI,PW,dxe,fxe,CW=y(()=>{Da();wr();IW=(t,e,r)=>{let n=t.map(i=>lxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??fxe},lxe=({type:t,value:e},r)=>uxe[r]??PW[t](e),uxe=["input","output","output"],zl=()=>{},yI=()=>"input",PW={generator:zl,asyncGenerator:zl,fileUrl:zl,filePath:zl,iterable:yI,asyncIterable:yI,uint8Array:yI,webStream:t=>Xb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?rI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:zl,duplex:zl,native(t){let e=dxe(t);if(e!==void 0)return e;if(ni(t,{checkOpen:!1}))return PW.nodeStream(t)}},dxe=t=>{if([0,gI.stdin].includes(t))return"input";if([1,2,gI.stdout,gI.stderr].includes(t))return"output"},fxe="output"});var DW,NW=y(()=>{DW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var jW,pxe,mxe,MW,hxe,gxe,FW=y(()=>{bo();NW();ds();jW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=pxe(t,n).map((a,c)=>MW(a,c));return o?hxe(s,r,i):DW(s,e)},pxe=(t,e)=>{if(t===void 0)return Rn.map(n=>e[n]);if(mxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Rn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Rn.length);return Array.from({length:r},(n,i)=>t[i])},mxe=t=>Rn.some(e=>t[e]!==void 0),MW=(t,e)=>Array.isArray(t)?t.map(r=>MW(r,e)):t??(e>=Rn.length?"ignore":"pipe"),hxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Al(r,i)&&gxe(n)?"ignore":n),gxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as yxe}from"node:fs";import _xe from"node:tty";var zW,bxe,vxe,Sxe,wxe,LW,UW=y(()=>{Da();bo();on();ps();zW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?bxe({stdioItem:t,fdNumber:n,direction:i}):wxe({stdioItem:t,fdNumber:n}),bxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=vxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ni(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},vxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Sxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(_xe.isatty(i))throw new TypeError(`The \`${e}: ${vb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:_o(yxe(i)),optionName:e}}},Sxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=Q_.indexOf(t);if(r!==-1)return r},wxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:LW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:LW(e,e,r),optionName:r}:ni(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,LW=(t,e,r)=>{let n=Q_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var qW,xxe,$xe,kxe,Exe,BW=y(()=>{Da();on();wr();qW=({input:t,inputFile:e},r)=>r===0?[...xxe(t),...kxe(e)]:[],xxe=t=>t===void 0?[]:[{type:$xe(t),value:t,optionName:"input"}],$xe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},kxe=t=>t===void 0?[]:[{...Exe(t),optionName:"inputFile"}],Exe=t=>{if(Yb(t))return{type:"fileUrl",value:t};if(dI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var HW,GW,Axe,Txe,ZW,Oxe,Rxe,VW,WW=y(()=>{wr();HW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),GW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Axe(i,t);if(s.length!==0){if(o){Txe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(EW.has(t))return ZW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});AW.has(t)&&Rxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Axe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Txe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{pI.has(e)&&ZW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},ZW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return VW(s,n,e),i==="output"?o[0].stream:void 0},Oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Rxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);VW(i,n,e)},VW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var ev,Ixe,Pxe,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,_I,qxe,tv=y(()=>{bo();RW();hI();wr();CW();FW();UW();BW();WW();ev=(t,e,r,n)=>{let o=jW(e,r,n).map((a,c)=>Ixe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Lxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>qxe(a)),s},Ixe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=eb(e),{stdioItems:o,isStdioArray:s}=Pxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=IW(o,e,i),c=o.map(d=>zW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=OW(c,i,a,r),u=TW(l,a);return Fxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Pxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Cxe(c,n)),...qW(r,e)],s=HW(o),a=s.length>1;return Dxe(s,a,n),jxe(s),{stdioItems:s,isStdioArray:a}},Cxe=(t,e)=>({type:_W(t,e),value:t,optionName:e}),Dxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Nxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Nxe=new Set(["ignore","ipc"]),jxe=t=>{for(let e of t)Mxe(e)},Mxe=({type:t,value:e,optionName:r})=>{if(wW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(xW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Fxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Qb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Lxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(zxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw _I(i),o}},zxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Uxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Uxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=GW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},_I=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ei(r)&&r.destroy()},qxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as KW}from"node:fs";var YW,ji,Bxe,XW,JW,Hxe,QW=y(()=>{on();tv();wr();YW=(t,e)=>ev(Hxe,t,e,!0),ji=({type:t,optionName:e})=>{XW(e,hs[t])},Bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&XW(t,`"${e}"`),{}),XW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},JW={generator(){},asyncGenerator:ji,webStream:ji,nodeStream:ji,webTransform:ji,duplex:ji,asyncIterable:ji,native:Bxe},Hxe={input:{...JW,fileUrl:({value:t})=>({contents:[_o(KW(t))]}),filePath:({value:{file:t}})=>({contents:[_o(KW(t))]}),fileNumber:ji,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...JW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:ji,string:ji,uint8Array:ji}}});var xo,bI,lp=y(()=>{tI();xo=(t,{stripFinalNewline:e},r)=>bI(e,r)&&t!==void 0&&!Array.isArray(t)?jl(t):t,bI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var rv,SI,eK,tK,Gxe,Zxe,Vxe,rK,Wxe,vI,Kxe,Jxe,Yxe,nv=y(()=>{rv=(t,e,r,n)=>t||r?void 0:tK(e,n),SI=(t,e,r)=>r?t.flatMap(n=>eK(n,e)):eK(t,e),eK=(t,e)=>{let{transform:r,final:n}=tK(e,{});return[...r(t),...n()]},tK=(t,e)=>(e.previousChunks="",{transform:Gxe.bind(void 0,e,t),final:Vxe.bind(void 0,e)}),Gxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=vI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=vI(n,r.slice(i+1))),t.previousChunks=n},Zxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Vxe=function*({previousChunks:t}){t.length>0&&(yield t)},rK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Wxe.bind(void 0,n)},Wxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Kxe:Yxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},vI=(t,e)=>`${t}${e}`,Kxe={windowsNewline:`\r +${t}`}});import KSe from"node:path";import DV from"node:process";var NV,zb,JSe,YSe,eI=y(()=>{NV=St(h9(),1);w9();vb();tp();zR();WR();KR();JR();YR();Ca();QR();El();wo();zb=(t,e,r)=>{r.cwd=IV(r.cwd);let[n,i,o]=EV(t,e,r),{command:s,args:a,options:c}=NV.default._parse(n,i,o),l=iZ(c),u=JSe(l);return wV(u),RV(u),AV(u),q9(u),vV(u),u.shell=hR(u.shell),u.env=YSe(u),u.killSignal=M9(u.killSignal),u.forceKillAfterDelay=z9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!an.has(u.encoding)&&u.buffer[f]),DV.platform==="win32"&&KSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},JSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),YSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...DV.env,...t}:t;return r||n?S9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ub,tI=y(()=>{Ub=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ml(t){if(typeof t=="string")return XSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return QSe(t)}var XSe,QSe,jV,ewe,MV,twe,rI=y(()=>{XSe=t=>t.at(-1)===jV?t.slice(0,t.at(-2)===MV?-2:-1):t,QSe=t=>t.at(-1)===ewe?t.subarray(0,t.at(-2)===twe?-2:-1):t,jV=` +`,ewe=jV.codePointAt(0),MV="\r",twe=MV.codePointAt(0)});function ii(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function nI(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Da(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function iI(t,e){return nI(t,e)&&Da(t,e)}var Na=y(()=>{});function FV(){return this[sI].next()}function LV(t){return this[sI].return(t)}function aI({preventCancel:t=!1}={}){let e=this.getReader(),r=new oI(e,t),n=Object.create(nwe);return n[sI]=r,n}var rwe,oI,sI,nwe,zV=y(()=>{rwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),oI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},sI=Symbol();Object.defineProperty(FV,"name",{value:"next"});Object.defineProperty(LV,"name",{value:"return"});nwe=Object.create(rwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:FV},return:{enumerable:!0,configurable:!0,writable:!0,value:LV}})});var UV=y(()=>{});var qV=y(()=>{zV();UV()});var BV,iwe,owe,swe,sp,cI=y(()=>{Na();qV();BV=t=>{if(Da(t,{checkOpen:!1})&&sp.on!==void 0)return owe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(iwe.call(t)==="[object ReadableStream]")return aI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:iwe}=Object.prototype,owe=async function*(t){let e=new AbortController,r={};swe(t,e,r);try{for await(let[n]of sp.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},swe=async(t,e,r)=>{try{await sp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},sp={}});var Fl,awe,ZV,HV,cwe,GV,ji,ap=y(()=>{cI();Fl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=BV(t),u=e();u.length=0;try{for await(let d of l){let f=cwe(d),p=r[f](d,u);ZV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return awe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},awe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&ZV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},ZV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){HV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&HV(c,e,i,o),new ji},HV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},cwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=GV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&GV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:GV}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var xo,cp,qb,Bb,Hb,Gb=y(()=>{xo=t=>t,cp=()=>{},qb=({contents:t})=>t,Bb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Hb=t=>t.length});async function Zb(t,e){return Fl(t,fwe,e)}var lwe,uwe,dwe,fwe,VV=y(()=>{ap();Gb();lwe=()=>({contents:[]}),uwe=()=>1,dwe=(t,{contents:e})=>(e.push(t),e),fwe={init:lwe,convertChunk:{string:xo,buffer:xo,arrayBuffer:xo,dataView:xo,typedArray:xo,others:xo},getSize:uwe,truncateChunk:cp,addChunk:dwe,getFinalChunk:cp,finalize:qb}});async function Vb(t,e){return Fl(t,Swe,e)}var pwe,mwe,hwe,WV,KV,gwe,ywe,_we,bwe,YV,JV,vwe,XV,Swe,QV=y(()=>{ap();Gb();pwe=()=>({contents:new ArrayBuffer(0)}),mwe=t=>hwe.encode(t),hwe=new TextEncoder,WV=t=>new Uint8Array(t),KV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),gwe=(t,e)=>t.slice(0,e),ywe=(t,{contents:e,length:r},n)=>{let i=XV()?bwe(e,n):_we(e,n);return new Uint8Array(i).set(t,r),i},_we=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(YV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},bwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:YV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},YV=t=>JV**Math.ceil(Math.log(t)/Math.log(JV)),JV=2,vwe=({contents:t,length:e})=>XV()?t:t.slice(0,e),XV=()=>"resize"in ArrayBuffer.prototype,Swe={init:pwe,convertChunk:{string:mwe,buffer:WV,arrayBuffer:WV,dataView:KV,typedArray:KV,others:Bb},getSize:Hb,truncateChunk:gwe,addChunk:ywe,getFinalChunk:cp,finalize:vwe}});async function Kb(t,e){return Fl(t,Ewe,e)}var wwe,Wb,xwe,$we,kwe,Ewe,eW=y(()=>{ap();Gb();wwe=()=>({contents:"",textDecoder:new TextDecoder}),Wb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),xwe=(t,{contents:e})=>e+t,$we=(t,e)=>t.slice(0,e),kwe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Ewe={init:wwe,convertChunk:{string:xo,buffer:Wb,arrayBuffer:Wb,dataView:Wb,typedArray:Wb,others:Bb},getSize:Hb,truncateChunk:$we,addChunk:xwe,getFinalChunk:kwe,finalize:qb}});var tW=y(()=>{VV();QV();eW();ap()});import{on as Awe}from"node:events";import{finished as Twe}from"node:stream/promises";var Jb=y(()=>{cI();tW();Object.assign(sp,{on:Awe,finished:Twe})});var rW,Owe,nW,iW,Rwe,oW,sW,Yb,ja=y(()=>{Jb();vo();wo();rW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=Owe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Owe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",nW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},iW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Rwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Rwe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=So(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:nb(r),threshold:i,unit:n}},oW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Yb(r)),sW=(t,e,r)=>{if(!e)return t;let n=Yb(r);return t.length>n?t.slice(0,n):t},Yb=([,t])=>t});import{inspect as Iwe}from"node:util";var cW,Pwe,Cwe,Dwe,Nwe,jwe,aW,lW=y(()=>{rI();sn();QR();sb();ja();tp();Ia();cW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Pwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Dwe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>Nwe(D)).join(` +`)].map(D=>Yf(Ml(jwe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},Pwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Cwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${iW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${bb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Cwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Dwe=(t,e)=>{if(t instanceof ri)return;let r=k9(t)?t.originalMessage:String(t?.message??t),n=Yf(CV(r,e));return n===""?void 0:n},Nwe=t=>typeof t=="string"?t:Iwe(t),jwe=t=>Array.isArray(t)?t.map(e=>Ml(aW(e))).filter(Boolean).join(` +`):aW(t),aW=t=>typeof t=="string"?t:qt(t)?tb(t):""});var Xb,Ll,lp,Mwe,uW,Fwe,up=y(()=>{tp();fb();Ia();lW();Xb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>uW({command:t,escapedCommand:e,cwd:o,durationMs:kR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ll=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>lp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),lp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Fwe(l,u),{originalMessage:A,shortMessage:D,message:$}=cW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=x9(t,$,x);return Object.assign(re,Mwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},Mwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>uW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:kR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),uW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Fwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:bb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Lwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(dW(t*1e3)%1e3),nanoseconds:Math.trunc(dW(t*1e6)%1e3)}}function zwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function lI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Lwe(t);break}case"bigint":return zwe(t)}throw new TypeError("Expected a finite number or bigint")}var dW,fW=y(()=>{dW=t=>Number.isFinite(t)?t:0});function uI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Bwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Uwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+qwe(d,u):f;i.push(p)}},a=lI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Hwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var Uwe,qwe,Bwe,Hwe,pW=y(()=>{fW();Uwe=t=>t===0||t===0n,qwe=(t,e)=>e===1||e===1n?t:`${t}s`,Bwe=1e-7,Hwe=24n*60n*60n*1000n});var mW,hW=y(()=>{Ol();mW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var gW,Gwe,yW=y(()=>{pW();ds();Ol();hW();gW=(t,e)=>{Al(e)&&(mW(t,e),Gwe(t,e))},Gwe=(t,e)=>{let r=`(done in ${uI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var zl,Qb=y(()=>{yW();zl=(t,e,{reject:r})=>{if(gW(t,e),t.failed&&r)throw t;return t}});var vW,Zwe,Vwe,SW,wW,_W,Wwe,dI,bW,Ma,xW,Kwe,ev,$W,Jwe,Ywe,fI,kW,Xwe,EW,tv,Qwe,pI,exe,txe,AW,Pn,rv,mI,TW,OW,hs,wr=y(()=>{Na();_o();sn();vW=(t,e)=>Ma(t)?"asyncGenerator":xW(t)?"generator":ev(t)?"fileUrl":Jwe(t)?"filePath":Qwe(t)?"webStream":ii(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":exe(t)?"asyncIterable":txe(t)?"iterable":pI(t)?SW({transform:t},e):Kwe(t)?Zwe(t,e):"native",Zwe=(t,e)=>iI(t.transform,{checkOpen:!1})?Vwe(t,e):pI(t.transform)?SW(t,e):Wwe(t,e),Vwe=(t,e)=>(wW(t,e,"Duplex stream"),"duplex"),SW=(t,e)=>(wW(t,e,"web TransformStream"),"webTransform"),wW=({final:t,binary:e,objectMode:r},n,i)=>{_W(t,`${n}.final`,i),_W(e,`${n}.binary`,i),dI(r,`${n}.objectMode`)},_W=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Wwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!bW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(iI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(pI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!bW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return dI(r,`${i}.binary`),dI(n,`${i}.objectMode`),Ma(t)||Ma(e)?"asyncGenerator":"generator"},dI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},bW=t=>Ma(t)||xW(t),Ma=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",xW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Kwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),ev=t=>Object.prototype.toString.call(t)==="[object URL]",$W=t=>ev(t)&&t.protocol!=="file:",Jwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Ywe.has(e))&&fI(t.file),Ywe=new Set(["file","append"]),fI=t=>typeof t=="string",kW=(t,e)=>t==="native"&&typeof e=="string"&&!Xwe.has(e),Xwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),EW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",tv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Qwe=t=>EW(t)||tv(t),pI=t=>EW(t?.readable)&&tv(t?.writable),exe=t=>AW(t)&&typeof t[Symbol.asyncIterator]=="function",txe=t=>AW(t)&&typeof t[Symbol.iterator]=="function",AW=t=>typeof t=="object"&&t!==null,Pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),rv=new Set(["fileUrl","filePath","fileNumber"]),mI=new Set(["fileUrl","filePath"]),TW=new Set([...mI,"webStream","nodeStream"]),OW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var hI,rxe,nxe,RW,gI=y(()=>{wr();hI=(t,e,r,n)=>n==="output"?rxe(t,e,r):nxe(t,e,r),rxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},nxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},RW=(t,e)=>{let r=t.findLast(({type:n})=>Pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var IW,ixe,oxe,sxe,axe,cxe,lxe,PW=y(()=>{_o();Ca();wr();gI();IW=(t,e,r,n)=>[...t.filter(({type:i})=>!Pn.has(i)),...ixe(t,e,r,n)],ixe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=oxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return lxe(o,r)},oxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?sxe({stdioItem:t,optionName:i}):e==="webTransform"?axe({stdioItem:t,index:r,newTransforms:n,direction:o}):cxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),sxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},axe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=hI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||an.has(o),{writableObjectMode:f,readableObjectMode:p}=hI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},lxe=(t,e)=>e==="input"?t.reverse():t});import yI from"node:process";var CW,uxe,dxe,Ul,_I,DW,fxe,pxe,NW=y(()=>{Na();wr();CW=(t,e,r)=>{let n=t.map(i=>uxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??pxe},uxe=({type:t,value:e},r)=>dxe[r]??DW[t](e),dxe=["input","output","output"],Ul=()=>{},_I=()=>"input",DW={generator:Ul,asyncGenerator:Ul,fileUrl:Ul,filePath:Ul,iterable:_I,asyncIterable:_I,uint8Array:_I,webStream:t=>tv(t)?"output":"input",nodeStream(t){return Da(t,{checkOpen:!1})?nI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ul,duplex:Ul,native(t){let e=fxe(t);if(e!==void 0)return e;if(ii(t,{checkOpen:!1}))return DW.nodeStream(t)}},fxe=t=>{if([0,yI.stdin].includes(t))return"input";if([1,2,yI.stdout,yI.stderr].includes(t))return"output"},pxe="output"});var jW,MW=y(()=>{jW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var FW,mxe,hxe,LW,gxe,yxe,zW=y(()=>{vo();MW();ds();FW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=mxe(t,n).map((a,c)=>LW(a,c));return o?gxe(s,r,i):jW(s,e)},mxe=(t,e)=>{if(t===void 0)return In.map(n=>e[n]);if(hxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${In.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,In.length);return Array.from({length:r},(n,i)=>t[i])},hxe=t=>In.some(e=>t[e]!==void 0),LW=(t,e)=>Array.isArray(t)?t.map(r=>LW(r,e)):t??(e>=In.length?"ignore":"pipe"),gxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Tl(r,i)&&yxe(n)?"ignore":n),yxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as _xe}from"node:fs";import bxe from"node:tty";var qW,vxe,Sxe,wxe,xxe,UW,BW=y(()=>{Na();vo();sn();ps();qW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?vxe({stdioItem:t,fdNumber:n,direction:i}):xxe({stdioItem:t,fdNumber:n}),vxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Sxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ii(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Sxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=wxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(bxe.isatty(i))throw new TypeError(`The \`${e}: ${xb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:bo(_xe(i)),optionName:e}}},wxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=rb.indexOf(t);if(r!==-1)return r},xxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:UW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:UW(e,e,r),optionName:r}:ii(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,UW=(t,e,r)=>{let n=rb[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var HW,$xe,kxe,Exe,Axe,GW=y(()=>{Na();sn();wr();HW=({input:t,inputFile:e},r)=>r===0?[...$xe(t),...Exe(e)]:[],$xe=t=>t===void 0?[]:[{type:kxe(t),value:t,optionName:"input"}],kxe=t=>{if(Da(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Exe=t=>t===void 0?[]:[{...Axe(t),optionName:"inputFile"}],Axe=t=>{if(ev(t))return{type:"fileUrl",value:t};if(fI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var ZW,VW,Txe,Oxe,WW,Rxe,Ixe,KW,JW=y(()=>{wr();ZW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),VW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Txe(i,t);if(s.length!==0){if(o){Oxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(TW.has(t))return WW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});OW.has(t)&&Ixe({otherStdioItems:s,type:t,value:e,optionName:r})}},Txe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Oxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{mI.has(e)&&WW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},WW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Rxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return KW(s,n,e),i==="output"?o[0].stream:void 0},Rxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Ixe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);KW(i,n,e)},KW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var nv,Pxe,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,qxe,bI,Bxe,iv=y(()=>{vo();PW();gI();wr();NW();zW();BW();GW();JW();nv=(t,e,r,n)=>{let o=FW(e,r,n).map((a,c)=>Pxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=zxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Bxe(a)),s},Pxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=nb(e),{stdioItems:o,isStdioArray:s}=Cxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=CW(o,e,i),c=o.map(d=>qW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=IW(c,i,a,r),u=RW(l,a);return Lxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Cxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Dxe(c,n)),...HW(r,e)],s=ZW(o),a=s.length>1;return Nxe(s,a,n),Mxe(s),{stdioItems:s,isStdioArray:a}},Dxe=(t,e)=>({type:vW(t,e),value:t,optionName:e}),Nxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(jxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},jxe=new Set(["ignore","ipc"]),Mxe=t=>{for(let e of t)Fxe(e)},Fxe=({type:t,value:e,optionName:r})=>{if($W(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(kW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Lxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>rv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},zxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Uxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bI(i),o}},Uxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>qxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},qxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=VW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ti(r)&&r.destroy()},Bxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as YW}from"node:fs";var QW,Mi,Hxe,e3,XW,Gxe,t3=y(()=>{sn();iv();wr();QW=(t,e)=>nv(Gxe,t,e,!0),Mi=({type:t,optionName:e})=>{e3(e,hs[t])},Hxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&e3(t,`"${e}"`),{}),e3=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},XW={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:Hxe},Gxe={input:{...XW,fileUrl:({value:t})=>({contents:[bo(YW(t))]}),filePath:({value:{file:t}})=>({contents:[bo(YW(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...XW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var $o,vI,dp=y(()=>{rI();$o=(t,{stripFinalNewline:e},r)=>vI(e,r)&&t!==void 0&&!Array.isArray(t)?Ml(t):t,vI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var ov,wI,r3,n3,Zxe,Vxe,Wxe,i3,Kxe,SI,Jxe,Yxe,Xxe,sv=y(()=>{ov=(t,e,r,n)=>t||r?void 0:n3(e,n),wI=(t,e,r)=>r?t.flatMap(n=>r3(n,e)):r3(t,e),r3=(t,e)=>{let{transform:r,final:n}=n3(e,{});return[...r(t),...n()]},n3=(t,e)=>(e.previousChunks="",{transform:Zxe.bind(void 0,e,t),final:Wxe.bind(void 0,e)}),Zxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=SI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=SI(n,r.slice(i+1))),t.previousChunks=n},Vxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Wxe=function*({previousChunks:t}){t.length>0&&(yield t)},i3=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Kxe.bind(void 0,n)},Kxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Jxe:Xxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},SI=(t,e)=>`${t}${e}`,Jxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:vI},Jxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Yxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Jxe}});import{Buffer as Xxe}from"node:buffer";var nK,Qxe,iK,e0e,t0e,oK,sK=y(()=>{on();nK=(t,e)=>t?void 0:Qxe.bind(void 0,e),Qxe=function*(t,e){if(typeof e!="string"&&!qt(e)&&!Xxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},iK=(t,e)=>t?e0e.bind(void 0,e):t0e.bind(void 0,e),e0e=function*(t,e){oK(t,e),yield e},t0e=function*(t,e){if(oK(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},oK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:SI},Yxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Xxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Yxe}});import{Buffer as Qxe}from"node:buffer";var o3,e0e,s3,t0e,r0e,a3,c3=y(()=>{sn();o3=(t,e)=>t?void 0:e0e.bind(void 0,e),e0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!Qxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},s3=(t,e)=>t?t0e.bind(void 0,e):r0e.bind(void 0,e),t0e=function*(t,e){a3(t,e),yield e},r0e=function*(t,e){if(a3(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},a3=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as r0e}from"node:buffer";import{StringDecoder as n0e}from"node:string_decoder";var iv,i0e,o0e,s0e,wI=y(()=>{on();iv=(t,e,r)=>{if(r)return;if(t)return{transform:i0e.bind(void 0,new TextEncoder)};let n=new n0e(e);return{transform:o0e.bind(void 0,n),final:s0e.bind(void 0,n)}},i0e=function*(t,e){r0e.isBuffer(e)?yield _o(e):typeof e=="string"?yield t.encode(e):yield e},o0e=function*(t,e){yield qt(e)?t.write(e):e},s0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as aK}from"node:util";var xI,ov,cK,a0e,lK,c0e,uK=y(()=>{xI=aK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),ov=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=c0e}=e[r];for await(let i of n(t))yield*ov(i,e,r+1)},cK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*a0e(r,Number(e),t)},a0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*ov(n,r,e+1)},lK=aK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),c0e=function*(t){yield t}});var $I,dK,Ma,up,l0e,u0e,kI=y(()=>{$I=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},dK=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...up(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},up=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},u0e=function*(t){yield t}});import{Transform as d0e,getDefaultHighWaterMark as fK}from"node:stream";var EI,sv,pK,av=y(()=>{wr();nv();sK();wI();uK();kI();EI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=pK(t,s,o),l=ja(e),u=ja(r),d=l?xI.bind(void 0,ov,a):$I.bind(void 0,Ma),f=l||u?xI.bind(void 0,cK,a):$I.bind(void 0,up),p=l||u?lK.bind(void 0,a):void 0;return{stream:new d0e({writableObjectMode:n,writableHighWaterMark:fK(n),readableObjectMode:i,readableHighWaterMark:fK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},sv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=pK(s,r,a);t=dK(c,t)}return t},pK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:nK(n,a)},iv(r,s,n),rv(r,o,n,c),{transform:t,final:e},{transform:iK(i,a)},rK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var mK,f0e,p0e,m0e,h0e,hK=y(()=>{av();on();wr();mK=(t,e)=>{for(let r of f0e(t))p0e(t,r,e)},f0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),p0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>m0e(a,n));r.input=Wf(s)},m0e=(t,e)=>{let r=sv(t,e,"utf8",!0);return h0e(r),Wf(r)},h0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var cv,g0e,y0e,gK,yK,_0e,_K,AI=y(()=>{Pa();wr();Tl();ds();cv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Al(r,n)&&!sn.has(e)&&g0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&y0e.has(o))||t.every(({type:i})=>In.has(i))),g0e=t=>t===1||t===2,y0e=new Set(["pipe","overlapped"]),gK=async(t,e,r,n)=>{for await(let i of t)_0e(e)||_K(i,r,n)},yK=(t,e,r)=>{for(let n of t)_K(n,e,r)},_0e=t=>t._readableState.pipes.length>0,_K=(t,e,r)=>{let n=ab(t);Pi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as b0e,appendFileSync as v0e}from"node:fs";var bK,S0e,w0e,x0e,$0e,k0e,vK=y(()=>{AI();av();nv();on();wr();Na();bK=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>S0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},S0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=iW(t,o,d),p=_o(f),{stdioItems:m,objectMode:h}=e[r],g=w0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=x0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});$0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&k0e(b,m,i),S}catch(x){return n.error=x,S}},w0e=(t,e,r,n)=>{try{return sv(t,e,r,!1)}catch(i){return n.error=i,t}},x0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Wf(t)};let s=WG(t,r);return n[o]?{serializedResult:s,finalResult:SI(s,!i[o],e)}:{serializedResult:s}},$0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!cv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=SI(t,!1,s);try{yK(a,e,n)}catch(c){r.error??=c}},k0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Qb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?v0e(n,t):(r.add(o),b0e(n,t))}}});var SK,wK=y(()=>{on();lp();SK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xo(e,r,"all")]:Array.isArray(e)?[xo(t,r,"all"),...e]:qt(t)&&qt(e)?gR([t,e]):`${t}${e}`}});import{once as TI}from"node:events";var xK,E0e,$K,kK,A0e,OI,RI=y(()=>{Ra();xK=async(t,e)=>{let[r,n]=await E0e(t);return e.isForcefullyTerminated??=!1,[r,n]},E0e=async t=>{let[e,r]=await Promise.allSettled([TI(t,"spawn"),TI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?$K(t):r.value},$K=async t=>{try{return await TI(t,"exit")}catch{return $K(t)}},kK=async t=>{let[e,r]=await t;if(!A0e(e,r)&&OI(e,r))throw new ti;return[e,r]},A0e=(t,e)=>t===void 0&&e===void 0,OI=(t,e)=>t!==0||e!==null});var EK,T0e,AK=y(()=>{Ra();Na();RI();EK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=T0e(t,e,r),s=o?.code==="ETIMEDOUT",a=nW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},T0e=(t,e,r)=>t!==void 0?t:OI(e,r)?new ti:void 0});import{spawnSync as O0e}from"node:child_process";var TK,R0e,I0e,P0e,lv,C0e,D0e,N0e,j0e,OK=y(()=>{kR();QR();eI();cp();Jb();QW();lp();hK();vK();Na();wK();AK();TK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=R0e(t,e,r),d=C0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ll(d,c,l)},R0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),a=I0e(r),{file:c,commandArguments:l,options:u}=Mb(t,e,a);P0e(u);let d=YW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},I0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,P0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&lv("ipcInput"),t&&lv("ipc: true"),r&&lv("detached: true"),n&&lv("cancelSignal")},lv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},C0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=D0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=EK(c,r),{output:m,error:h=l}=bK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>xo(_,r,S)),b=xo(SK(m,r),r,"all");return j0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},D0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{mK(o,r);let a=N0e(r);return O0e(...Fb(t,e,a))}catch(a){return Fl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},N0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Wb(e)}),j0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Kb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):ap({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as II,on as M0e}from"node:events";var RK,F0e,L0e,z0e,U0e,IK=y(()=>{Cl();rp();tp();RK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Il({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),F0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),F0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{xb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([L0e(o,n,s),z0e(o,r,s),U0e(o,r,s)])}catch(a){throw Pl(t),a}finally{s.abort(),$b(e,i)}},L0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await II(t,"message",{signal:r});return n}for await(let[n]of M0e(t,"message",{signal:r}))if(e(n))return n},z0e=async(t,e,{signal:r})=>{await II(t,"disconnect",{signal:r}),q9(e)},U0e=async(t,e,{signal:r})=>{let[n]=await II(t,"strict:error",{signal:r});throw bb(n,e)}});import{once as CK,on as q0e}from"node:events";var DK,PI,B0e,H0e,G0e,PK,CI=y(()=>{Cl();rp();tp();DK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>PI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),PI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Il({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Rb(t)}),xb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return B0e(t,s,a),H0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),G0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},B0e=async(t,e,r)=>{try{await CK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},H0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await CK(t,"strict:error",{signal:r.signal});n.error=bb(i,e),r.abort()}catch{}},G0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of q0e(r,"message",{signal:o.signal}))PK(s),yield c}catch{PK(s)}finally{o.abort(),$b(e,a),n||Pl(t),i&&await t}},PK=({error:t})=>{if(t)throw t}});import NK from"node:process";var jK,MK,FK,DI=y(()=>{Nb();IK();CI();Tb();jK=(t,{ipc:e})=>{Object.assign(t,FK(t,!1,e))},MK=()=>{let t=NK,e=!0,r=NK.channel!==void 0;return{...FK(t,e,r),getCancelSignal:gV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},FK=(t,e,r)=>({sendMessage:Db.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:RK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:DK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Z0e}from"node:child_process";import{PassThrough as V0e,Readable as W0e,Writable as K0e,Duplex as J0e}from"node:stream";var LK,Y0e,dp,X0e,Q0e,e$e,t$e,zK=y(()=>{tv();cp();Jb();LK=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{_I(n);let a=new Z0e;Y0e(a,n),Object.assign(a,{readable:X0e,writable:Q0e,duplex:e$e});let c=Fl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=t$e(c,s,i);return{subprocess:a,promise:l}},Y0e=(t,e)=>{let r=dp(),n=dp(),i=dp(),o=Array.from({length:e.length-3},dp),s=dp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},dp=()=>{let t=new V0e;return t.end(),t},X0e=()=>new W0e({read(){}}),Q0e=()=>new K0e({write(){}}),e$e=()=>new J0e({read(){},write(){}}),t$e=async(t,e,r)=>Ll(t,e,r)});import{createReadStream as UK,createWriteStream as qK}from"node:fs";import{Buffer as r$e}from"node:buffer";import{Readable as fp,Writable as n$e,Duplex as i$e}from"node:stream";var HK,pp,BK,o$e,GK=y(()=>{av();tv();wr();HK=(t,e)=>ev(o$e,t,e,!1),pp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},BK={fileNumber:pp,generator:EI,asyncGenerator:EI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:i$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},o$e={input:{...BK,fileUrl:({value:t})=>({stream:UK(t)}),filePath:({value:{file:t}})=>({stream:UK(t)}),webStream:({value:t})=>({stream:fp.fromWeb(t)}),iterable:({value:t})=>({stream:fp.from(t)}),asyncIterable:({value:t})=>({stream:fp.from(t)}),string:({value:t})=>({stream:fp.from(t)}),uint8Array:({value:t})=>({stream:fp.from(r$e.from(t))})},output:{...BK,fileUrl:({value:t})=>({stream:qK(t)}),filePath:({value:{file:t,append:e}})=>({stream:qK(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:n$e.fromWeb(t)}),iterable:pp,asyncIterable:pp,string:pp,uint8Array:pp}}});import{on as s$e,once as ZK}from"node:events";import{PassThrough as a$e,getDefaultHighWaterMark as c$e}from"node:stream";import{finished as KK}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)jI(i);let e=t.some(({readableObjectMode:i})=>i),r=l$e(t,e),n=new NI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var l$e,NI,u$e,d$e,f$e,jI,p$e,m$e,h$e,g$e,y$e,JK,YK,MI,XK,_$e,uv,VK,WK,dv=y(()=>{l$e=(t,e)=>{if(t.length===0)return c$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},NI=class extends a$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(jI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=u$e(this,this.#t,this.#o);let r=p$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(jI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},u$e=async(t,e,r)=>{uv(t,VK);let n=new AbortController;try{await Promise.race([d$e(t,n),f$e(t,e,r,n)])}finally{n.abort(),uv(t,-VK)}},d$e=async(t,{signal:e})=>{try{await KK(t,{signal:e,cleanup:!0})}catch(r){throw JK(t,r),r}},f$e=async(t,e,r,{signal:n})=>{for await(let[i]of s$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},jI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},p$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{uv(t,WK);let a=new AbortController;try{await Promise.race([m$e(o,e,a),h$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),g$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),uv(t,-WK)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?MI(t):y$e(t))},m$e=async(t,e,{signal:r})=>{try{await t,r.aborted||MI(e)}catch(n){r.aborted||JK(e,n)}},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await KK(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;YK(s)?i.add(e):XK(t,s)}},g$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await ZK(t,i,{signal:o}),!t.readable)return ZK(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},y$e=t=>{t.writable&&t.end()},JK=(t,e)=>{YK(e)?MI(t):XK(t,e)},YK=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",MI=t=>{(t.readable||t.writable)&&t.destroy()},XK=(t,e)=>{t.destroyed||(t.once("error",_$e),t.destroy(e))},_$e=()=>{},uv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},VK=2,WK=1});import{finished as QK}from"node:stream/promises";var Ul,b$e,FI,v$e,LI,fv=y(()=>{bo();Ul=(t,e)=>{t.pipe(e),b$e(t,e),v$e(t,e)},b$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}FI(e)}},FI=t=>{t.writable&&t.end()},v$e=async(t,e)=>{if(!(ei(t)||ei(e))){try{await QK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}LI(t)}},LI=t=>{t.readable&&t.destroy()}});var e3,S$e,w$e,x$e,$$e,k$e,t3=y(()=>{dv();bo();wb();wr();fv();e3=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>In.has(c)))S$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!In.has(c)))x$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fa(o);Ul(s,i)}},S$e=(t,e,r,n)=>{r==="output"?Ul(t.stdio[n],e):Ul(e,t.stdio[n]);let i=w$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},w$e=["stdin","stdout","stderr"],x$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;$$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},$$e=(t,{signal:e})=>{ei(t)&&Ia(t,k$e,e)},k$e=2});var La,r3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var pv,zI,UI,E$e,qI,mv,A$e,BI,HI,GI,n3,xat,$at,i3=y(()=>{r3();pv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",zI=Symbol.for("signal-exit emitter"),UI=globalThis,E$e=Object.defineProperty.bind(Object),qI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(UI[zI])return UI[zI];E$e(UI,zI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},mv=class{},A$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),BI=class extends mv{onExit(){return()=>{}}load(){}unload(){}},HI=class extends mv{#t=GI.platform==="win32"?"SIGINT":"SIGHUP";#r=new qI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of La)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!pv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of La)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,La.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return pv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&pv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},GI=globalThis.process,{onExit:n3,load:xat,unload:$at}=A$e(pv(GI)?new HI(GI):new BI)});import{addAbortListener as T$e}from"node:events";var o3,s3=y(()=>{i3();o3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=n3(()=>{t.kill()});T$e(n,()=>{i()})}});var c3,O$e,R$e,a3,I$e,l3=y(()=>{hR();lb();ps();kl();c3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=cb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=O$e(r,n,i),{sourceStream:d,sourceError:f}=I$e(t,l),{options:p,fileDescriptors:m}=Di.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},O$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=R$e(t,e,...r),a=Sb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},R$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(a3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||pR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=Y_(r,...n);return{destination:e(a3)(i,o,s),pipeOptions:s}}if(Di.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},a3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),I$e=(t,e)=>{try{return{sourceStream:Nl(t,e)}}catch(r){return{sourceError:r}}}});var d3,P$e,ZI,u3,VI=y(()=>{cp();fv();d3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=P$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw ZI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},P$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return LI(t),n;if(e!==void 0)return FI(r),e},ZI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Fl({error:t,command:u3,escapedCommand:u3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),u3="source.pipe(destination)"});var f3,p3=y(()=>{f3=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as C$e}from"node:stream/promises";var m3,D$e,N$e,j$e,hv,M$e,F$e,h3=y(()=>{dv();wb();fv();m3=(t,e,r)=>{let n=hv.has(e)?N$e(t,e):D$e(t,e);return Ia(t,M$e,r.signal),Ia(e,F$e,r.signal),j$e(e),n},D$e=(t,e)=>{let r=Fa([t]);return Ul(r,e),hv.set(e,r),r},N$e=(t,e)=>{let r=hv.get(e);return r.add(t),r},j$e=async t=>{try{await C$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}hv.delete(t)},hv=new WeakMap,M$e=2,F$e=1});import{aborted as L$e}from"node:util";var g3,z$e,y3=y(()=>{VI();g3=(t,e)=>t===void 0?[]:[z$e(t,e)],z$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await L$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw ZI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var gv,U$e,q$e,_3=y(()=>{yo();l3();VI();p3();h3();y3();gv=(t,...e)=>{if(Ot(e[0]))return gv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=c3(t,...e),i=U$e({...n,destination:r});return i.pipe=gv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},U$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=q$e(t,i);d3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=m3(e,o,d);return await Promise.race([f3(u),...g3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},q$e=(t,e)=>Promise.allSettled([t,e])});import{on as B$e}from"node:events";import{getDefaultHighWaterMark as H$e}from"node:stream";var yv,G$e,WI,Z$e,v3,KI,b3,V$e,W$e,_v=y(()=>{wI();nv();kI();yv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return G$e(e,s),v3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},G$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},WI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Z$e(e,s,t);let a=t.readableObjectMode&&!o;return v3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Z$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},v3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=B$e(t,"data",{signal:e.signal,highWaterMark:b3,highWatermark:b3});return V$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},KI=H$e(!0),b3=KI,V$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=W$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*up(a)}},W$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[iv(t,r,!e),rv(t,i,!n,{})].filter(Boolean)});import{setImmediate as K$e}from"node:timers/promises";var S3,J$e,Y$e,X$e,JI,w3,YI=y(()=>{Vb();on();AI();_v();Na();lp();S3=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=J$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Y$e(t),d]);return}let f=bI(c,r),p=WI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([X$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},J$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!cv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=WI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await gK(a,t,r,o)},Y$e=async t=>{await K$e(),t.readableFlowing===null&&t.resume()},X$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Bb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Hb(r,{maxBuffer:o})):await Zb(r,{maxBuffer:o})}catch(a){return w3(eW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},JI=async t=>{try{return await t}catch(e){return w3(e)}},w3=({bufferedData:t})=>ZG(t)?new Uint8Array(t):t});import{finished as Q$e}from"node:stream/promises";var mp,eke,tke,rke,nke,ike,XI,bv,x3,vv=y(()=>{mp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=eke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Q$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||nke(a,e,r,n)}finally{s.abort()}},eke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&tke(t,r,n),n},tke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{rke(e,r),n.call(t,...i)}},rke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},nke=(t,e,r,n)=>{if(!ike(t,e,r,n))throw t},ike=(t,e,r,n=!0)=>r.propagating?x3(t)||bv(t):(r.propagating=!0,XI(r,e)===n?x3(t):bv(t)),XI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",bv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",x3=t=>t?.code==="EPIPE"});var $3,QI,eP=y(()=>{YI();vv();$3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>QI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),QI=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=mp(t,e,l);if(XI(l,e)){await u;return}let[d]=await Promise.all([S3({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var k3,E3,oke,ske,tP=y(()=>{dv();eP();k3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,E3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>QI({...oke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:ske(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),oke=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},ske=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var A3,T3,O3=y(()=>{Tl();ds();A3=t=>Al(t,"ipc"),T3=(t,e)=>{let r=ab(t);Pi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var R3,I3,P3=y(()=>{Na();O3();So();CI();R3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=A3(o),a=vo(e,"ipc"),c=vo(r,"ipc");for await(let l of PI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(tW(t,i,c),i.push(l)),s&&T3(l,o);return i},I3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as ake}from"node:events";var C3,cke,lke,uke,D3=y(()=>{Da();WR();LR();VR();bo();wr();YI();P3();JR();tP();eP();RI();vv();C3=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=xK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=$3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=E3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=R3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=cke(h,t,S),D=lke(m,S);try{return await Promise.race([Promise.all([{},kK(_),Promise.all(x),w,T,EV(t,d),...A,...D]),g,uke(t,b),...SV(t,o,f,b),...U9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...bV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>JI(re))),JI(w),I3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},cke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:mp(n,i,r)),lke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ni(o,{checkOpen:!1})&&!ei(o)).map(({type:i,value:o,stream:s=o})=>mp(s,n,e,{isSameDirection:In.has(i),stopOnExit:i==="native"}))),uke=async(t,{signal:e})=>{let[r]=await ake(t,"error",{signal:e});throw r}});var N3,hp,ql,Sv=y(()=>{Dl();N3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),hp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ci();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},ql=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as j3}from"node:stream/promises";var rP,M3,nP,iP,wv,xv,oP=y(()=>{vv();rP=async t=>{if(t!==void 0)try{await nP(t)}catch{}},M3=async t=>{if(t!==void 0)try{await iP(t)}catch{}},nP=async t=>{await j3(t,{cleanup:!0,readable:!1,writable:!0})},iP=async t=>{await j3(t,{cleanup:!0,readable:!0,writable:!1})},wv=async(t,e)=>{if(await t,e)throw e},xv=(t,e,r)=>{r&&!bv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as dke}from"node:stream";import{callbackify as fke}from"node:util";var F3,sP,aP,cP,pke,lP,uP,L3,dP=y(()=>{Pa();ps();_v();Dl();Sv();oP();F3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||sn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=aP(a,s),{read:f,onStdoutDataDone:p}=cP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new dke({read:f,destroy:fke(uP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return lP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},sP=(t,e,r)=>{let n=Nl(t,e),i=hp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},aP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:KI},cP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ci(),s=yv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){pke(this,s,o)},onStdoutDataDone:o}},pke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},lP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await iP(t),await n,await rP(i),await e,r.readable&&r.push(null)}catch(o){await rP(i),L3(r,o)}},uP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await ql(r,e)&&(L3(t,n),await wv(e,n))},L3=(t,e)=>{xv(t,t.readable,e)}});import{Writable as mke}from"node:stream";import{callbackify as z3}from"node:util";var U3,fP,pP,hke,gke,mP,hP,q3,gP=y(()=>{ps();Sv();oP();U3=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=fP(t,r,e),s=new mke({...pP(n,t,i),destroy:z3(hP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return mP(n,s),s},fP=(t,e,r)=>{let n=Sb(t,e),i=hp(r,n,"writableFinal"),o=hp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},pP=(t,e,r)=>({write:hke.bind(void 0,t),final:z3(gke.bind(void 0,t,e,r))}),hke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},gke=async(t,e,r)=>{await ql(r,e)&&(t.writable&&t.end(),await e)},mP=async(t,e,r)=>{try{await nP(t),e.writable&&e.end()}catch(n){await M3(r),q3(e,n)}},hP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await ql(r,e),await ql(n,e)&&(q3(t,i),await wv(e,i))},q3=(t,e)=>{xv(t,t.writable,e)}});import{Duplex as yke}from"node:stream";import{callbackify as _ke}from"node:util";var B3,bke,H3=y(()=>{Pa();dP();gP();B3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||sn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=fP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=aP(c,a),{read:g,onStdoutDataDone:b}=cP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new yke({read:g,...pP(u,t,d),destroy:_ke(bke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return lP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),mP(u,_,c),_},bke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([uP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),hP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var yP,vke,G3=y(()=>{Pa();ps();_v();yP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||sn.has(e),s=Nl(t,r),a=yv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return vke(a,s,t)},vke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var Z3,V3=y(()=>{Sv();dP();gP();H3();G3();Z3=(t,{encoding:e})=>{let r=N3();t.readable=F3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=U3.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=B3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=yP.bind(void 0,t,e),t[Symbol.asyncIterator]=yP.bind(void 0,t,e,{})}});var W3,Ske,wke,K3=y(()=>{W3=(t,e)=>{for(let[r,n]of wke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Ske=(async()=>{})().constructor.prototype,wke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Ske,t)])});import{setMaxListeners as xke}from"node:events";import{spawn as $ke}from"node:child_process";var J3,kke,Eke,Ake,Tke,Oke,Y3=y(()=>{Vb();kR();QR();ps();eI();DI();cp();Jb();zK();GK();lp();t3();yb();s3();_3();tP();D3();V3();Dl();K3();J3=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=kke(t,e,r),{subprocess:f,promise:p}=Ake({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=gv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),W3(f,p),Di.set(f,{options:u,fileDescriptors:d}),f},kke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ub(t,e,r),{file:a,commandArguments:c,options:l}=Mb(t,e,r),u=Eke(l),d=HK(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Eke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Ake=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=$ke(...Fb(t,e,r))}catch(m){return LK({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;xke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];e3(c,a,l),o3(c,r,l);let d={},f=Ci();c.kill=L9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=k3(c,r),Z3(c,r),jK(c,r);let p=Tke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Tke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await C3({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>xo(x,e,w)),_=xo(h,e,"all"),S=Oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ll(S,n,e)},Oke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?ap({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof Ni,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Kb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var $v,Rke,Ike,X3=y(()=>{yo();So();$v=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Rke(n,t[n],i)]));return{...t,...r}},Rke=(t,e,r)=>Ike.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Ike=new Set(["env",...vR])});var gs,Pke,Cke,Q3=y(()=>{yo();hR();eZ();OK();Y3();X3();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Pke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Pke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,$v(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Cke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?TK(a,c,l):J3(a,c,l,i)},Cke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=XG(e)?QG(e,r):[e,...r],[s,a,c]=Y_(...o),l=$v($v(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var eJ,tJ,rJ,Dke,Nke,nJ=y(()=>{eJ=({file:t,commandArguments:e})=>rJ(t,e),tJ=({file:t,commandArguments:e})=>({...rJ(t,e),isSync:!0}),rJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Dke(t);return{file:r,commandArguments:n}},Dke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Nke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Nke=/ +/g});var iJ,oJ,jke,sJ,Mke,aJ,cJ=y(()=>{iJ=(t,e,r)=>{t.sync=e(jke,r),t.s=t.sync},oJ=({options:t})=>sJ(t),jke=({options:t})=>({...sJ(t),isSync:!0}),sJ=t=>({options:{...Mke(t),...t}}),Mke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},aJ={preferLocal:!0}});var put,We,mut,hut,gut,yut,_ut,but,vut,Sut,Fr=y(()=>{Q3();nJ();KR();cJ();DI();put=gs(()=>({})),We=gs(()=>({isSync:!0})),mut=gs(eJ),hut=gs(tJ),gut=gs(xV),yut=gs(oJ,{},aJ,iJ),{sendMessage:_ut,getOneMessage:but,getEachMessage:vut,getCancelSignal:Sut}=MK()});import{existsSync as kv,statSync as Fke}from"node:fs";import{dirname as _P,extname as Lke,isAbsolute as lJ,join as bP,relative as vP,resolve as Ev,sep as zke}from"node:path";function Av(t){return t==="./gradlew"||t==="gradle"}function Uke(t){return(kv(bP(t,"build.gradle.kts"))||kv(bP(t,"build.gradle")))&&kv(bP(t,"gradle.properties"))}function qke(t,e){let n=vP(t,e).split(zke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Bke(t,e){let r=Ev(t,e),n=r;kv(r)?Fke(r).isFile()&&(n=_P(r)):Lke(r)!==""&&(n=_P(r));let i=vP(t,n);if(i.startsWith("..")||lJ(i))return null;let o=n;for(;;){if(Uke(o))return o;if(Ev(o)===Ev(t))return null;let s=_P(o);if(s===o)return null;let a=vP(t,s);if(a.startsWith("..")||lJ(a))return null;o=s}}function Tv(t,e){let r=Ev(t),n=new Map,i=[];for(let o of e){let s=Bke(r,o);if(!s){i.push(o);continue}let a=qke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Ov=y(()=>{"use strict"});import{existsSync as wP,readFileSync as Hke}from"node:fs";import{join as Bl}from"node:path";function Hl(t="."){let e=Bl(t,".cladding","config.yaml");if(!wP(e))return SP;try{let n=(0,uJ.parse)(Hke(e,"utf8"))?.gate;if(!n)return SP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Gke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return SP}}function dJ(t="."){let e=Hl(t).testReport,r=e?[e,...xP]:xP;return[...new Set(r.map(n=>Bl(t,n)))]}function fJ(t="."){let e=Hl(t).testReport;if(e){let r=Bl(t,e);return wP(r)?r:null}return xP.map(r=>Bl(t,r)).find(r=>wP(r))??null}function pJ(t,e){let r=[],n=!1;for(let i of t){let o=Zke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var uJ,Gke,SP,xP,Zke,gp=y(()=>{"use strict";uJ=St(er(),1);Ov();Gke=["type","lint","test","coverage"],SP={scope:"feature"},xP=["test-report.junit.xml",Bl("coverage","junit.xml"),Bl(".cladding","test-report.junit.xml")];Zke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as kP,readFileSync as mJ,readdirSync as Vke,statSync as Wke}from"node:fs";import{join as Rv}from"node:path";function TP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Rv(t,e);if(kP(r))try{if(hJ.test(mJ(r,"utf8")))return!0}catch{}}return!1}function gJ(t){try{return kP(t)&&hJ.test(mJ(t,"utf8"))}catch{return!1}}function yJ(t,e=0){if(e>4||!kP(t))return!1;let r;try{r=Vke(t)}catch{return!1}for(let n of r){let i=Rv(t,n),o=!1;try{o=Wke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(yJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&gJ(i))return!0}return!1}function Yke(t){if(TP(t))return!0;for(let e of Kke)if(gJ(Rv(t,e)))return!0;for(let e of Jke)if(yJ(Rv(t,e)))return!0;return!1}function _J(t="."){let e=Hl(t).coverage;return e||(Yke(t)?"kover":"jacoco")}function bJ(t="."){return EP[_J(t)]}function vJ(t="."){return $P[_J(t)]}var EP,$P,AP,hJ,Kke,Jke,Iv=y(()=>{"use strict";gp();EP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},$P={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},AP=[$P.kover,$P.jacoco],hJ=/kover/i;Kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Jke=["buildSrc","build-logic"]});import{existsSync as Gl,readFileSync as wJ,readdirSync as xJ}from"node:fs";import{join as $o}from"node:path";function RP(t){return Gl($o(t,"gradlew"))?"./gradlew":"gradle"}function Xke(t){let e=RP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[bJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Qke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(wJ($o(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function tEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function iEe(t,e){for(let r of e)if(Gl($o(t,r)))return r}function oEe(t,e){try{return xJ(t).find(n=>n.endsWith(e))}catch{return}}function uEe(t){try{return JSON.parse(wJ($o(t,"package.json"),"utf8"))}catch{return{}}}function yp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function SJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function dEe(t,e,r){if(r.madge!==void 0||lEe.some(o=>Gl($o(t,o))))return e;let i=[...e.args];return i.splice(i.length-1,0,"--exclude",cEe),{...e,args:i}}function fEe(t,e,r){if(yp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of sEe)if(n.configs.some(i=>Gl($o(t,i))))return n.gate;if(aEe.some(n=>Gl($o(t,n)))||r.eslintConfig!==void 0)return e}function mEe(t,e){return pEe.some(r=>Gl($o(t,r)))?!0:e.jest!==void 0}function hEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function OP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function gEe(t,e){let r=uEe(t),n=e.lint?fEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:dEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:OP(i,"lint"),s=yp(r,"test"),a=s?hEe(s):void 0;return s&&!a?(o=OP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...yp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&mEe(t,r)?{...o,test:{cmd:"npx",args:[...Mi,"jest"]},coverage:{cmd:"npx",args:[...Mi,"jest","--coverage"]}}:(a==="vitest"&&!yp(r,"coverage")&&!SJ(r,"@vitest/coverage-v8")&&!SJ(r,"@vitest/coverage-istanbul")?o=OP(o,"coverage"):a==="vitest"&&yp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of rEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=oEe(t,o):r=iEe(t,[o]),r)break;if(!r||e.requiresSource&&!tEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?gEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return nEe}var Mi,eEe,rEe,nEe,sEe,aEe,cEe,lEe,pEe,an=y(()=>{"use strict";Iv();Mi=["--offline","--no-install"];eEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);rEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Mi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Mi,"eslint","."]},test:{cmd:"npx",args:[...Mi,"vitest","run"]},coverage:{cmd:"npx",args:[...Mi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Mi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Mi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:Xke},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:Qke}],nEe={language:"unknown",manifest:"",gates:{}};sEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Mi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Mi,"oxlint"]}}],aEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],cEe="^(dist|build|out|coverage|target|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/",lEe=[".madgerc",".madgerc.json",".madgerc.js",".madgerc.yaml",".madgerc.yml"];pEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as yEe,readFileSync as _Ee}from"node:fs";import{join as bEe}from"node:path";function za(t){return t.code==="ENOENT"}function Pv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return $J.test(o)||$J.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(za(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} -${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Zl(t,e){let r=bEe(t,"package.json");if(!yEe(r))return!1;try{return!!JSON.parse(_Ee(r,"utf8")).scripts?.[e]}catch{return!1}}var $J,Pn=y(()=>{"use strict";$J=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function vEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Cv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Cv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Pv(i,Cv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Cv,Ua,Dv=y(()=>{"use strict";Fr();an();Pn();Cv="ARCHITECTURE_VIOLATION";Ua={name:Cv,subprocess:!0,run:vEe}});function SEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Pv(i,Nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Nv,qa,jv=y(()=>{"use strict";Fr();an();Pn();Nv="HARDCODED_SECRET";qa={name:Nv,subprocess:!0,run:SEe}});import{existsSync as IP,readdirSync as kJ}from"node:fs";import{join as Mv}from"node:path";function xEe(t,e){let r=Mv(t,e.path);if(!IP(r))return!0;if(e.isDirectory)try{return kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function $Ee(t){let{cwd:e="."}=t,r=[];for(let i of wEe)xEe(e,i)&&r.push({detector:_p,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=Mv(e,"spec.yaml");if(IP(n)){let i=AEe(n),o=i?null:kEe(e);if(i)r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:_p,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=EEe(e);s&&r.push({detector:_p,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function kEe(t){for(let e of["spec/features","spec/scenarios"]){let r=Mv(t,e);if(!IP(r))continue;let n;try{n=kJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Oi(Mv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function EEe(t){try{return q(t),null}catch(e){return e.message}}function AEe(t){let e;try{e=Oi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var _p,wEe,EJ,AJ=y(()=>{"use strict";Ue();U_();_p="ABSENCE_OF_GOVERNANCE",wEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];EJ={name:_p,run:$Ee}});function Fv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function PP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Fv(r)==="while",o=OEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Fv(r)}'`}let n=TEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Fv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Fv(r)}'`:null}function REe(t,e){let r=PP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function TJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...REe(r,n));return e}var TEe,OEe,CP=y(()=>{"use strict";TEe={event:"when",state:"while",optional:"where",unwanted:"if"},OEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function IEe(t){let{cwd:e="."}=t;return ge(e,Lv,PEe)}function PEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:Lv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of TJ(t.features))e.push({detector:Lv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Lv,OJ,RJ=y(()=>{"use strict";CP();wt();Lv="AC_DRIFT";OJ={name:Lv,run:IEe}});function Fi(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return PJ[n]??IJ}var CEe,DEe,NEe,IJ,jEe,MEe,PJ,FEe,CJ,Ba=y(()=>{"use strict";an();CEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,DEe=/^[ \t]*import\s+([\w.]+)/gm,NEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,IJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:CEe,importStyle:"relative"},jEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:DEe,importStyle:"dotted"},MEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:NEe,importStyle:"dotted"},PJ={typescript:IJ,kotlin:jEe,python:MEe},FEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],CJ=new Set([...Object.values(PJ).flatMap(t=>t?.extensions??[]),...FEe].map(t=>t.toLowerCase()))});import{existsSync as LEe,readFileSync as zEe,readdirSync as UEe,statSync as qEe}from"node:fs";import{join as NJ,relative as DJ}from"node:path";function BEe(t,e){if(!LEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=UEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=NJ(i,s),c;try{c=qEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function HEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function ZEe(t){return GEe.test(t)}function VEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Fi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>BEe(NJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=zEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Ba();jJ="AI_HINTS_FORBIDDEN_PATTERN";GEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;MJ={name:jJ,run:VEe}});function WEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:LJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var LJ,zJ,UJ=y(()=>{"use strict";Ue();LJ="AC_DUPLICATE_WITHIN_FEATURE";zJ={name:LJ,run:WEe}});import{createRequire as KEe}from"module";import{basename as JEe,dirname as NP,normalize as YEe,relative as XEe,resolve as QEe,sep as HJ}from"path";import*as eAe from"fs";function tAe(t){let e=YEe(t);return e.length>1&&e[e.length-1]===HJ&&(e=e.substring(0,e.length-1)),e}function GJ(t,e){return t.replace(rAe,e)}function iAe(t){return t==="/"||nAe.test(t)}function DP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=QEe(t)),(n||o)&&(t=tAe(t)),t===".")return"";let s=t[t.length-1]!==i;return GJ(s?t+i:t,i)}function ZJ(t,e){return e+t}function oAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:GJ(XEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function sAe(t){return t}function aAe(t,e,r){return e+t+r}function cAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?oAe(t,e):n?ZJ:sAe}function lAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function uAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function mAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?uAe(t):lAe(t):n&&n.length?fAe:dAe:pAe}function vAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?bAe:r&&r.length?n?hAe:gAe:n?yAe:_Ae}function xAe(t){return t.group?wAe:SAe}function EAe(t){return t.group?$Ae:kAe}function OAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?TAe:AAe}function VJ(t,e,r){if(r.options.useRealPaths)return RAe(e,r);let n=NP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=NP(n)}return r.symlinks.set(t,e),i>1}function RAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function zv(t,e,r,n){e(t&&!n?t:null,r)}function LAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?IAe:NAe:n?e?PAe:FAe:i?e?DAe:MAe:e?CAe:jAe}function qAe(t){return t?UAe:zAe}function ZAe(t,e){return new Promise((r,n)=>{JJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function JJ(t,e,r){new KJ(t,e,r).start()}function VAe(t,e){return new KJ(t,e).start()}var qJ,rAe,nAe,dAe,fAe,pAe,hAe,gAe,yAe,_Ae,bAe,SAe,wAe,$Ae,kAe,AAe,TAe,IAe,PAe,CAe,DAe,NAe,jAe,MAe,FAe,WJ,zAe,UAe,BAe,HAe,GAe,KJ,BJ,YJ,XJ,QJ=y(()=>{qJ=KEe(import.meta.url);rAe=/[\\/]/g;nAe=/^[a-z]:[\\/]$/i;dAe=(t,e)=>{e.push(t||".")},fAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},pAe=()=>{};hAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},gAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},yAe=(t,e,r,n)=>{r.files++},_Ae=(t,e)=>{e.push(t)},bAe=()=>{};SAe=t=>t,wAe=()=>[""].slice(0,0);$Ae=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},kAe=()=>{};AAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&VJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},TAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&VJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};IAe=t=>t.counts,PAe=t=>t.groups,CAe=t=>t.paths,DAe=t=>t.paths.slice(0,t.options.maxFiles),NAe=(t,e,r)=>(zv(e,r,t.counts,t.options.suppressErrors),null),jAe=(t,e,r)=>(zv(e,r,t.paths,t.options.suppressErrors),null),MAe=(t,e,r)=>(zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),FAe=(t,e,r)=>(zv(e,r,t.groups,t.options.suppressErrors),null);WJ={withFileTypes:!0},zAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",WJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},UAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",WJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};BAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},HAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},GAe=class{aborted=!1;abort(){this.aborted=!0}},KJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=LAe(e,this.isSynchronous),this.root=DP(t,e),this.state={root:iAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new HAe,options:e,queue:new BAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new GAe,fs:e.fs||eAe},this.joinPath=cAe(this.root,e),this.pushDirectory=mAe(this.root,e),this.pushFile=vAe(e),this.getArray=xAe(e),this.groupFiles=EAe(e),this.resolveSymlink=OAe(e,this.isSynchronous),this.walkDirectory=qAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=DP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=JEe(_),x=DP(NP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};BJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return ZAe(this.root,this.options)}withCallback(t){JJ(this.root,this.options,t)}sync(){return VAe(this.root,this.options)}},YJ=null;try{qJ.resolve("picomatch"),YJ=qJ("picomatch")}catch{}XJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:HJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new BJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new BJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||YJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var bp=v(($dt,i8)=>{"use strict";var e8="[^\\\\/]",WAe="(?=.)",t8="[^/]",jP="(?:\\/|$)",r8="(?:^|\\/)",MP=`\\.{1,2}${jP}`,KAe="(?!\\.)",JAe=`(?!${r8}${MP})`,YAe=`(?!\\.{0,1}${jP})`,XAe=`(?!${MP})`,QAe="[^.\\/]",eTe=`${t8}*?`,tTe="/",n8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:WAe,QMARK:t8,END_ANCHOR:jP,DOTS_SLASH:MP,NO_DOT:KAe,NO_DOTS:JAe,NO_DOT_SLASH:YAe,NO_DOTS_SLASH:XAe,QMARK_NO_DOT:QAe,STAR:eTe,START_ANCHOR:r8,SEP:tTe},rTe={...n8,SLASH_LITERAL:"[\\\\/]",QMARK:e8,STAR:`${e8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},nTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};i8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:nTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?rTe:n8}}});var vp=v(Lr=>{"use strict";var{REGEX_BACKSLASH:iTe,REGEX_REMOVE_BACKSLASH:oTe,REGEX_SPECIAL_CHARS:sTe,REGEX_SPECIAL_CHARS_GLOBAL:aTe}=bp();Lr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Lr.hasRegexChars=t=>sTe.test(t);Lr.isRegexChar=t=>t.length===1&&Lr.hasRegexChars(t);Lr.escapeRegex=t=>t.replace(aTe,"\\$1");Lr.toPosixSlashes=t=>t.replace(iTe,"/");Lr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Lr.removeBackslashes=t=>t.replace(oTe,e=>e==="\\"?"":e);Lr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Lr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Lr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Lr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Lr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var f8=v((Edt,d8)=>{"use strict";var o8=vp(),{CHAR_ASTERISK:FP,CHAR_AT:cTe,CHAR_BACKWARD_SLASH:Sp,CHAR_COMMA:lTe,CHAR_DOT:LP,CHAR_EXCLAMATION_MARK:zP,CHAR_FORWARD_SLASH:u8,CHAR_LEFT_CURLY_BRACE:UP,CHAR_LEFT_PARENTHESES:qP,CHAR_LEFT_SQUARE_BRACKET:uTe,CHAR_PLUS:dTe,CHAR_QUESTION_MARK:s8,CHAR_RIGHT_CURLY_BRACE:fTe,CHAR_RIGHT_PARENTHESES:a8,CHAR_RIGHT_SQUARE_BRACKET:pTe}=bp(),c8=t=>t===u8||t===Sp,l8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},mTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&c8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=o8.removeBackslashes(P)),xe&&_===!0&&(xe=o8.removeBackslashes(xe)));let Pr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,c8(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var wp=bp(),cn=vp(),{MAX_LENGTH:Uv,POSIX_REGEX_SOURCE:hTe,REGEX_NON_SPECIAL_CHARS:gTe,REGEX_SPECIAL_CHARS_BACKREF:yTe,REPLACEMENTS:p8}=wp,_Te=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>cn.escapeRegex(i)).join("..")}return r},Vl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,m8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},bTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},h8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(bTe(e))return e.replace(/\\(.)/g,"$1")},vTe=t=>{let e=t.map(h8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},STe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=h8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?cn.escapeRegex(r[0]):`[${r.map(i=>cn.escapeRegex(i)).join("")}]`}*`},wTe=t=>{let e=0,r=t.trim(),n=BP(r);for(;n;)e++,r=n.body.trim(),n=BP(r);return e},xTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:wp.DEFAULT_MAX_EXTGLOB_RECURSION,n=m8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||vTe(n)))return{risky:!0};for(let i of n){let o=STe(i);if(o)return{risky:!0,safeOutput:o};if(wTe(i)>r)return{risky:!0}}return{risky:!1}},HP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=p8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=wp.globChars(r.windows),l=wp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=cn.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Pr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},lo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},$i=H=>{$[H]++,xe.push(H)},Qr=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},uo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;$i("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Wde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=xTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,ki=s[H.tokensIndex];ki.type="text",ki.value=ht,ki.output=lt||cn.escapeRegex(ht);for(let Ei=H.tokensIndex+1;Ei1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let ki=HP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${ki})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Qr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(yTe,(B,Oe,ut,zt,lt,ki)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):ki===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=cn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=hTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=cn.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){$i("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Vl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Wde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Qr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Vl("closing","]"));P=`\\${P}`}else $i("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Vl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Qr("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||cn.hasRegexChars(B))continue;let Oe=cn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){$i("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=_Te(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Qr("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){uo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){lo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){uo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=gTe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){uo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),ki=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!ki){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ei=t[$.index+4];if(Ei&&Ei!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Pr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Pr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ei=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ei})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Vl("closing","]"));$.output=cn.escapeLast($.output,"["),Qr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Vl("closing",")"));$.output=cn.escapeLast($.output,"("),Qr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Vl("closing","}"));$.output=cn.escapeLast($.output,"{"),Qr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};HP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Uv,r.maxLength):Uv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=p8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=wp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=cn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};g8.exports=HP});var v8=v((Tdt,b8)=>{"use strict";var $Te=f8(),GP=y8(),_8=vp(),kTe=bp(),ETe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=ETe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?_8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(_8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):GP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>$Te(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=GP.fastpaths(t,e)),i.output||(i=GP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=kTe;b8.exports=Rt});var $8=v((Odt,x8)=>{"use strict";var S8=v8(),ATe=vp();function w8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:ATe.isWindows()}),S8(t,e,r)}Object.assign(w8,S8);x8.exports=w8});import{readdir as TTe,readdirSync as OTe,realpath as RTe,realpathSync as ITe,stat as PTe,statSync as CTe}from"fs";import{isAbsolute as DTe,posix as Ha,resolve as NTe}from"path";import{fileURLToPath as jTe}from"url";function LTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&FTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function qTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function T8(t){var e;let r=Wl.default.scan(t,BTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function KTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Wl.default.scan(t);return r.isGlob||r.negated}function xp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function O8(t){return typeof t=="string"?[t]:t??[]}function ZP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=WTe(o);s=DTe(s.replace(YTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=JTe.exec(s))===null||i===void 0?void 0:i[0],l=T8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ha.join(o,...d):o}return s}function XTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(ZP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(ZP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(ZP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function QTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=XTe(t,e,n);t.debug&&xp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(E8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Wl.default)(i.match,f),m=(0,Wl.default)(i.ignore,f),h=LTe(i.match,f),g=k8(r,d,o),b=o?g:k8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new XJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&xp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return xp(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&xp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&qTe(r,d)]}function eOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function rOe(t){let e={...tOe,...t};return e.cwd=(e.cwd instanceof URL?jTe(e.cwd):NTe(e.cwd)).replace(E8,"/"),e.ignore=O8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||TTe,readdirSync:e.fs.readdirSync||OTe,realpath:e.fs.realpath||RTe,realpathSync:e.fs.realpathSync||ITe,stat:e.fs.stat||PTe,statSync:e.fs.statSync||CTe}),e.debug&&xp("globbing with options:",e),e}function nOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=MTe(t)||typeof t=="string",i=O8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=rOe(n?e:t);return i.length>0?QTe(o,i):[]}function _s(t,e){let[r,n]=nOe(t,e);return r?eOe(r.sync(),n):[]}var Wl,MTe,E8,A8,FTe,zTe,UTe,BTe,HTe,GTe,ZTe,VTe,WTe,JTe,YTe,tOe,$p=y(()=>{QJ();Wl=St($8(),1),MTe=Array.isArray,E8=/\\/g,A8=process.platform==="win32",FTe=/^(\/?\.\.)+$/;zTe=/^[A-Z]:\/$/i,UTe=A8?t=>zTe.test(t):t=>t==="/";BTe={parts:!0};HTe=/(?t.replace(HTe,"\\$&"),VTe=t=>t.replace(GTe,"\\$&"),WTe=A8?VTe:ZTe;JTe=/^(\/?\.\.)+/,YTe=/\\(?=[()[\]{}!*+?@|])/g;tOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as kp,readFileSync as iOe,readdirSync as oOe,statSync as R8}from"node:fs";import{join as Ga}from"node:path";function sOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Fi(e,n),o=[],{layers:s,forbiddenImports:a}=VP(r);return(s.size>0||a.length>0)&&!kp(Ga(e,i.mainRoot))?[{detector:Ep,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(aOe(e,i,s,o),cOe(e,i,s,o)),a.length>0&&lOe(e,i,a,o),o)}function VP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function aOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of oOe(o)){let a=Ga(o,s);R8(a).isDirectory()&&(r.has(s)||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function cOe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(kp(o))for(let s of r){let a=Ga(o,s);kp(a)&&R8(a).isDirectory()||n.push({detector:Ep,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function lOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!kp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=iOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];uOe(p,s.to,e.importStyle)&&n.push({detector:Ep,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function uOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ep,I8,WP=y(()=>{"use strict";$p();Ue();Ba();Ep="ARCHITECTURE_FROM_SPEC";I8={name:Ep,run:sOe}});import{existsSync as dOe,readFileSync as fOe}from"node:fs";import{join as pOe}from"node:path";function hOe(t){let{cwd:e="."}=t,r=pOe(e,"spec/capabilities.yaml");if(!dOe(r))return[];let n;try{let u=fOe(r,"utf8"),d=P8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";P8=St(er(),1);Ue();qv="CAPABILITIES_FEATURE_MAPPING",mOe=8;C8={name:qv,run:hOe}});import{existsSync as gOe,readFileSync as yOe}from"node:fs";import{join as _Oe}from"node:path";function bOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function vOe(t){let{cwd:e="."}=t;return ge(e,KP,r=>SOe(r,e))}function SOe(t,e){let r=Fi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=_Oe(e,o);if(!gOe(s))continue;let a=yOe(s,"utf8");bOe(a)||n.push({detector:KP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var KP,N8,j8=y(()=>{"use strict";Ba();wt();KP="CONVENTION_DRIFT";N8={name:KP,run:vOe}});import{existsSync as JP,readFileSync as M8}from"node:fs";import{join as Bv}from"node:path";function wOe(t){return JSON.parse(t).total?.lines?.pct??0}function F8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function kOe(t,e){if(!Av(dt(t).gates.coverage?.cmd))return null;let r;try{r=Tv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=AP.find(d=>JP(Bv(c.dir,d)));if(!l){s.push(c.path);continue}let u=F8(M8(Bv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=L8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function EOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=kOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Fi(e,r),i=dt(e).language==="kotlin"?AP.find(a=>JP(Bv(e,a)))??vJ(e):n.coverageSummary,o=Bv(e,i);if(!JP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=M8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?xOe(a):n.coverageFormat==="cobertura-xml"?$Oe(a):wOe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Hv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Hv}%`}]}var ko,Hv,z8,U8=y(()=>{"use strict";Ue();Iv();Ba();Ov();an();ko="COVERAGE_DROP",Hv=70;z8={name:ko,run:EOe}});import{existsSync as AOe}from"node:fs";import{join as TOe}from"node:path";function ROe(t){let{cwd:e="."}=t;return ge(e,Gv,r=>IOe(r,e))}function IOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Gv="DELIVERABLE_INTEGRITY",OOe=8;q8={name:Gv,run:ROe}});function POe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Zv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function COe(t){let e=POe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Zv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function DOe(t){let{cwd:e="."}=t;return ge(e,Zv,r=>COe(r))}var Zv,H8,G8=y(()=>{"use strict";wt();Zv="SMOKE_PROBE_DEMAND";H8={name:Zv,run:DOe}});function NOe(t){let{cwd:e="."}=t;return ge(e,Vv,r=>jOe(r,e))}function jOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Vv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=V_(n,e,o);s.state!=="fresh"&&i.push({detector:Vv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Vv,Wv,YP=y(()=>{"use strict";wl();wt();Vv="STALE_ATTESTATION";Wv={name:Vv,run:NOe}});function MOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return FOe(r)}function FOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:Z8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var Z8,Kv,XP=y(()=>{"use strict";Ue();Z8="DEPENDENCY_CYCLE";Kv={name:Z8,run:MOe}});import{appendFileSync as LOe,existsSync as V8,mkdirSync as zOe,readFileSync as UOe}from"node:fs";import{dirname as qOe,join as BOe}from"node:path";function W8(t){return BOe(t,HOe,GOe)}function K8(t){return QP.add(t),()=>QP.delete(t)}function Za(t,e){let r=W8(t),n=qOe(r);V8(n)||zOe(n,{recursive:!0}),LOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of QP)try{i(t,e)}catch{}}function fr(t){let e=W8(t);if(!V8(e))return[];let r=UOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var HOe,GOe,QP,ln=y(()=>{"use strict";HOe=".cladding",GOe="audit.log.jsonl";QP=new Set});import{existsSync as ZOe}from"node:fs";import{join as VOe}from"node:path";function WOe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:eC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(ZOe(VOe(e,i.artifact))||n.push({detector:eC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var eC,J8,Y8=y(()=>{"use strict";ln();eC="EVIDENCE_MISMATCH";J8={name:eC,run:WOe}});import{existsSync as KOe,readFileSync as JOe}from"node:fs";import{join as YOe}from"node:path";function XOe(t){let e=YOe(t,t5);if(!KOe(e))return null;try{let n=((0,e5.parse)(JOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*Q8(t,e){for(let r of t??[])r.startsWith(X8)&&(yield{ref:r,name:r.slice(X8.length),field:e})}function QOe(t){let{cwd:e="."}=t,r=XOe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:tC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...Q8(s.evidence_refs,"evidence_refs"),...Q8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:tC,severity:"warn",path:t5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var e5,tC,X8,t5,r5,n5=y(()=>{"use strict";e5=St(er(),1);Ue();tC="FIXTURE_REFERENCE_INVALID",X8="fixture:",t5="conformance/fixtures.yaml";r5={name:tC,run:QOe}});import{existsSync as Kl,readFileSync as rC}from"node:fs";import{join as Va}from"node:path";function eRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Ap(t){if(!Kl(t))return null;try{return JSON.parse(rC(t,"utf8"))}catch{return null}}function tRe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(rC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=eRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function rRe(t,e){for(let r of i5){let n=Va(t,r.path);if(!Kl(n))continue;let i=Ap(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function nRe(t,e){let r=Ap(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of i5){let s=Va(t,o.path);if(!Kl(s))continue;let a=Ap(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(Kl(i)){let o=Ap(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function iRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function oRe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Kl(r)||!Kl(n))return;let i=iRe(rC(r,"utf8"));if(i.length===0)return;let s=Ap(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function sRe(t){let{cwd:e="."}=t,r=[];return tRe(e,r),oRe(e,r),rRe(e,r),nRe(e,r),r}var Eo,i5,o5,s5=y(()=>{"use strict";$p();Eo="HARNESS_INTEGRITY",i5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];o5={name:Eo,run:sRe}});import{existsSync as aRe,readFileSync as cRe}from"node:fs";import{join as lRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>pRe(r,e))}function fRe(t){let e=lRe(t,"spec/capabilities.yaml");if(!aRe(e))return!1;try{let r=a5.default.parse(cRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function pRe(t,e){let r=t.features.length;if(r{"use strict";a5=St(er(),1);wt();Jv="HOLLOW_GOVERNANCE",uRe=8;c5={name:Jv,run:dRe}});import{existsSync as u5,readFileSync as d5}from"node:fs";import{join as f5}from"node:path";function p5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function gRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function yRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function _Re(t){let e=f5(t,"README.md"),r=f5(t,"docs","dogfood","matrix.md");if(!u5(e)||!u5(r))return[];let n=p5(d5(e,"utf8"),mRe),i=p5(d5(r,"utf8"),hRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=yRe(a);if(c===null)continue;let l=i[s]??"not-run",u=gRe(l);u!==null&&c>u&&o.push({detector:m5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function bRe(t){let{cwd:e="."}=t;return _Re(e)}var m5,mRe,hRe,h5,g5=y(()=>{"use strict";m5="HOST_CLAIM_DRIFT",mRe=//,hRe=//;h5={name:m5,run:bRe}});function vRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return y5(r.features.map(i=>i.id),"feature","spec/features/",n),y5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function y5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:_5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var _5,b5,v5=y(()=>{"use strict";Ue();_5="ID_COLLISION";b5={name:_5,run:vRe}});import{existsSync as Tp,readFileSync as nC,readdirSync as iC,statSync as SRe,writeFileSync as w5}from"node:fs";import{join as Ao}from"node:path";function S5(t){if(!Tp(t))return 0;try{return iC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function wRe(t){if(!Tp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=iC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=SRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function xRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Tp(e))return 0;try{let r=Yv.default.parse(nC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=S5(Ao(t,"spec","features")),r=S5(Ao(t,"spec","scenarios")),n=xRe(t),i=wRe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Jl(t,e){let r=Ao(t,"spec.yaml");if(!Tp(r))return;let n=nC(r,"utf8"),i=$Re(n,e);i!==n&&w5(r,i)}function $Re(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as n0e}from"node:buffer";import{StringDecoder as i0e}from"node:string_decoder";var av,o0e,s0e,a0e,xI=y(()=>{sn();av=(t,e,r)=>{if(r)return;if(t)return{transform:o0e.bind(void 0,new TextEncoder)};let n=new i0e(e);return{transform:s0e.bind(void 0,n),final:a0e.bind(void 0,n)}},o0e=function*(t,e){n0e.isBuffer(e)?yield bo(e):typeof e=="string"?yield t.encode(e):yield e},s0e=function*(t,e){yield qt(e)?t.write(e):e},a0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as l3}from"node:util";var $I,cv,u3,c0e,d3,l0e,f3=y(()=>{$I=l3(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=l0e}=e[r];for await(let i of n(t))yield*cv(i,e,r+1)},u3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*c0e(r,Number(e),t)},c0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cv(n,r,e+1)},d3=l3(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),l0e=function*(t){yield t}});var kI,p3,Fa,fp,u0e,d0e,EI=y(()=>{kI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},p3=(t,e)=>[...e.flatMap(r=>[...Fa(r,t,0)]),...fp(t)],Fa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=d0e}=e[r];for(let i of n(t))yield*Fa(i,e,r+1)},fp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*u0e(r,Number(e),t)},u0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Fa(n,r,e+1)},d0e=function*(t){yield t}});import{Transform as f0e,getDefaultHighWaterMark as m3}from"node:stream";var AI,lv,h3,uv=y(()=>{wr();sv();c3();xI();f3();EI();AI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=h3(t,s,o),l=Ma(e),u=Ma(r),d=l?$I.bind(void 0,cv,a):kI.bind(void 0,Fa),f=l||u?$I.bind(void 0,u3,a):kI.bind(void 0,fp),p=l||u?d3.bind(void 0,a):void 0;return{stream:new f0e({writableObjectMode:n,writableHighWaterMark:m3(n),readableObjectMode:i,readableHighWaterMark:m3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},lv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=h3(s,r,a);t=p3(c,t)}return t},h3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:o3(n,a)},av(r,s,n),ov(r,o,n,c),{transform:t,final:e},{transform:s3(i,a)},i3({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var g3,p0e,m0e,h0e,g0e,y3=y(()=>{uv();sn();wr();g3=(t,e)=>{for(let r of p0e(t))m0e(t,r,e)},p0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),m0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>h0e(a,n));r.input=Jf(s)},h0e=(t,e)=>{let r=lv(t,e,"utf8",!0);return g0e(r),Jf(r)},g0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var dv,y0e,_0e,_3,b3,b0e,v3,TI=y(()=>{Ca();wr();Ol();ds();dv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Tl(r,n)&&!an.has(e)&&y0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&_0e.has(o))||t.every(({type:i})=>Pn.has(i))),y0e=t=>t===1||t===2,_0e=new Set(["pipe","overlapped"]),_3=async(t,e,r,n)=>{for await(let i of t)b0e(e)||v3(i,r,n)},b3=(t,e,r)=>{for(let n of t)v3(n,e,r)},b0e=t=>t._readableState.pipes.length>0,v3=(t,e,r)=>{let n=ub(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as v0e,appendFileSync as S0e}from"node:fs";var S3,w0e,x0e,$0e,k0e,E0e,w3=y(()=>{TI();uv();sv();sn();wr();ja();S3=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>w0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},w0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=sW(t,o,d),p=bo(f),{stdioItems:m,objectMode:h}=e[r],g=x0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=$0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});k0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&E0e(b,m,i),S}catch(x){return n.error=x,S}},x0e=(t,e,r,n)=>{try{return lv(t,e,r,!1)}catch(i){return n.error=i,t}},$0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Jf(t)};let s=JG(t,r);return n[o]?{serializedResult:s,finalResult:wI(s,!i[o],e)}:{serializedResult:s}},k0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!dv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wI(t,!1,s);try{b3(a,e,n)}catch(c){r.error??=c}},E0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>rv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?S0e(n,t):(r.add(o),v0e(n,t))}}});var x3,$3=y(()=>{sn();dp();x3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,$o(e,r,"all")]:Array.isArray(e)?[$o(t,r,"all"),...e]:qt(t)&&qt(e)?yR([t,e]):`${t}${e}`}});import{once as OI}from"node:events";var k3,A0e,E3,A3,T0e,RI,II=y(()=>{Ia();k3=async(t,e)=>{let[r,n]=await A0e(t);return e.isForcefullyTerminated??=!1,[r,n]},A0e=async t=>{let[e,r]=await Promise.allSettled([OI(t,"spawn"),OI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?E3(t):r.value},E3=async t=>{try{return await OI(t,"exit")}catch{return E3(t)}},A3=async t=>{let[e,r]=await t;if(!T0e(e,r)&&RI(e,r))throw new ri;return[e,r]},T0e=(t,e)=>t===void 0&&e===void 0,RI=(t,e)=>t!==0||e!==null});var T3,O0e,O3=y(()=>{Ia();ja();II();T3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=O0e(t,e,r),s=o?.code==="ETIMEDOUT",a=oW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},O0e=(t,e,r)=>t!==void 0?t:RI(e,r)?new ri:void 0});import{spawnSync as R0e}from"node:child_process";var R3,I0e,P0e,C0e,fv,D0e,N0e,j0e,M0e,I3=y(()=>{ER();eI();tI();up();Qb();t3();dp();y3();w3();ja();$3();O3();R3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=I0e(t,e,r),d=D0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return zl(d,c,l)},I0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),a=P0e(r),{file:c,commandArguments:l,options:u}=zb(t,e,a);C0e(u);let d=QW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},P0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,C0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&fv("ipcInput"),t&&fv("ipc: true"),r&&fv("detached: true"),n&&fv("cancelSignal")},fv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},D0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=N0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=T3(c,r),{output:m,error:h=l}=S3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>$o(_,r,S)),b=$o(x3(m,r),r,"all");return M0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},N0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{g3(o,r);let a=j0e(r);return R0e(...Ub(t,e,a))}catch(a){return Ll({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},j0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Yb(e)}),M0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Xb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):lp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as PI,on as F0e}from"node:events";var P3,L0e,z0e,U0e,q0e,C3=y(()=>{Dl();ip();np();P3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Pl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),L0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),L0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Eb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([z0e(o,n,s),U0e(o,r,s),q0e(o,r,s)])}catch(a){throw Cl(t),a}finally{s.abort(),Ab(e,i)}},z0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await PI(t,"message",{signal:r});return n}for await(let[n]of F0e(t,"message",{signal:r}))if(e(n))return n},U0e=async(t,e,{signal:r})=>{await PI(t,"disconnect",{signal:r}),H9(e)},q0e=async(t,e,{signal:r})=>{let[n]=await PI(t,"strict:error",{signal:r});throw wb(n,e)}});import{once as N3,on as B0e}from"node:events";var j3,CI,H0e,G0e,Z0e,D3,DI=y(()=>{Dl();ip();np();j3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Pl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),Eb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return H0e(t,s,a),G0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Z0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},H0e=async(t,e,r)=>{try{await N3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},G0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await N3(t,"strict:error",{signal:r.signal});n.error=wb(i,e),r.abort()}catch{}},Z0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of B0e(r,"message",{signal:o.signal}))D3(s),yield c}catch{D3(s)}finally{o.abort(),Ab(e,a),n||Cl(t),i&&await t}},D3=({error:t})=>{if(t)throw t}});import M3 from"node:process";var F3,L3,z3,NI=y(()=>{Fb();C3();DI();Ib();F3=(t,{ipc:e})=>{Object.assign(t,z3(t,!1,e))},L3=()=>{let t=M3,e=!0,r=M3.channel!==void 0;return{...z3(t,e,r),getCancelSignal:_V.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},z3=(t,e,r)=>({sendMessage:Mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:P3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:j3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as V0e}from"node:child_process";import{PassThrough as W0e,Readable as K0e,Writable as J0e,Duplex as Y0e}from"node:stream";var U3,X0e,pp,Q0e,e$e,t$e,r$e,q3=y(()=>{iv();up();Qb();U3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bI(n);let a=new V0e;X0e(a,n),Object.assign(a,{readable:Q0e,writable:e$e,duplex:t$e});let c=Ll({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=r$e(c,s,i);return{subprocess:a,promise:l}},X0e=(t,e)=>{let r=pp(),n=pp(),i=pp(),o=Array.from({length:e.length-3},pp),s=pp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},pp=()=>{let t=new W0e;return t.end(),t},Q0e=()=>new K0e({read(){}}),e$e=()=>new J0e({write(){}}),t$e=()=>new Y0e({read(){},write(){}}),r$e=async(t,e,r)=>zl(t,e,r)});import{createReadStream as B3,createWriteStream as H3}from"node:fs";import{Buffer as n$e}from"node:buffer";import{Readable as mp,Writable as i$e,Duplex as o$e}from"node:stream";var Z3,hp,G3,s$e,V3=y(()=>{uv();iv();wr();Z3=(t,e)=>nv(s$e,t,e,!1),hp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},G3={fileNumber:hp,generator:AI,asyncGenerator:AI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:o$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},s$e={input:{...G3,fileUrl:({value:t})=>({stream:B3(t)}),filePath:({value:{file:t}})=>({stream:B3(t)}),webStream:({value:t})=>({stream:mp.fromWeb(t)}),iterable:({value:t})=>({stream:mp.from(t)}),asyncIterable:({value:t})=>({stream:mp.from(t)}),string:({value:t})=>({stream:mp.from(t)}),uint8Array:({value:t})=>({stream:mp.from(n$e.from(t))})},output:{...G3,fileUrl:({value:t})=>({stream:H3(t)}),filePath:({value:{file:t,append:e}})=>({stream:H3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:i$e.fromWeb(t)}),iterable:hp,asyncIterable:hp,string:hp,uint8Array:hp}}});import{on as a$e,once as W3}from"node:events";import{PassThrough as c$e,getDefaultHighWaterMark as l$e}from"node:stream";import{finished as Y3}from"node:stream/promises";function La(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)MI(i);let e=t.some(({readableObjectMode:i})=>i),r=u$e(t,e),n=new jI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var u$e,jI,d$e,f$e,p$e,MI,m$e,h$e,g$e,y$e,_$e,X3,Q3,FI,eK,b$e,pv,K3,J3,mv=y(()=>{u$e=(t,e)=>{if(t.length===0)return l$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},jI=class extends c$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(MI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=d$e(this,this.#t,this.#o);let r=m$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(MI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},d$e=async(t,e,r)=>{pv(t,K3);let n=new AbortController;try{await Promise.race([f$e(t,n),p$e(t,e,r,n)])}finally{n.abort(),pv(t,-K3)}},f$e=async(t,{signal:e})=>{try{await Y3(t,{signal:e,cleanup:!0})}catch(r){throw X3(t,r),r}},p$e=async(t,e,r,{signal:n})=>{for await(let[i]of a$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},MI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},m$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{pv(t,J3);let a=new AbortController;try{await Promise.race([h$e(o,e,a),g$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),y$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),pv(t,-J3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FI(t):_$e(t))},h$e=async(t,e,{signal:r})=>{try{await t,r.aborted||FI(e)}catch(n){r.aborted||X3(e,n)}},g$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Y3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Q3(s)?i.add(e):eK(t,s)}},y$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await W3(t,i,{signal:o}),!t.readable)return W3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},_$e=t=>{t.writable&&t.end()},X3=(t,e)=>{Q3(e)?FI(t):eK(t,e)},Q3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FI=t=>{(t.readable||t.writable)&&t.destroy()},eK=(t,e)=>{t.destroyed||(t.once("error",b$e),t.destroy(e))},b$e=()=>{},pv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},K3=2,J3=1});import{finished as tK}from"node:stream/promises";var ql,v$e,LI,S$e,zI,hv=y(()=>{vo();ql=(t,e)=>{t.pipe(e),v$e(t,e),S$e(t,e)},v$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LI(e)}},LI=t=>{t.writable&&t.end()},S$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}zI(t)}},zI=t=>{t.readable&&t.destroy()}});var rK,w$e,x$e,$$e,k$e,E$e,nK=y(()=>{mv();vo();kb();wr();hv();rK=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Pn.has(c)))w$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Pn.has(c)))$$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:La(o);ql(s,i)}},w$e=(t,e,r,n)=>{r==="output"?ql(t.stdio[n],e):ql(e,t.stdio[n]);let i=x$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},x$e=["stdin","stdout","stderr"],$$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;k$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},k$e=(t,{signal:e})=>{ti(t)&&Pa(t,E$e,e)},E$e=2});var za,iK=y(()=>{za=[];za.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&za.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&za.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var gv,UI,qI,A$e,BI,yv,T$e,HI,GI,ZI,oK,Iat,Pat,sK=y(()=>{iK();gv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",UI=Symbol.for("signal-exit emitter"),qI=globalThis,A$e=Object.defineProperty.bind(Object),BI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(qI[UI])return qI[UI];A$e(qI,UI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},yv=class{},T$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HI=class extends yv{onExit(){return()=>{}}load(){}unload(){}},GI=class extends yv{#t=ZI.platform==="win32"?"SIGINT":"SIGHUP";#r=new BI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of za)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!gv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of za)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,za.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return gv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&gv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},ZI=globalThis.process,{onExit:oK,load:Iat,unload:Pat}=T$e(gv(ZI)?new GI(ZI):new HI)});import{addAbortListener as O$e}from"node:events";var aK,cK=y(()=>{sK();aK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=oK(()=>{t.kill()});O$e(n,()=>{i()})}});var uK,R$e,I$e,lK,P$e,dK=y(()=>{gR();fb();ps();El();uK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=db(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=R$e(r,n,i),{sourceStream:d,sourceError:f}=P$e(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},R$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=I$e(t,e,...r),a=$b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},I$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(lK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||mR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=eb(r,...n);return{destination:e(lK)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},lK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),P$e=(t,e)=>{try{return{sourceStream:jl(t,e)}}catch(r){return{sourceError:r}}}});var pK,C$e,VI,fK,WI=y(()=>{up();hv();pK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=C$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},C$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return zI(t),n;if(e!==void 0)return LI(r),e},VI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ll({error:t,command:fK,escapedCommand:fK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),fK="source.pipe(destination)"});var mK,hK=y(()=>{mK=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as D$e}from"node:stream/promises";var gK,N$e,j$e,M$e,_v,F$e,L$e,yK=y(()=>{mv();kb();hv();gK=(t,e,r)=>{let n=_v.has(e)?j$e(t,e):N$e(t,e);return Pa(t,F$e,r.signal),Pa(e,L$e,r.signal),M$e(e),n},N$e=(t,e)=>{let r=La([t]);return ql(r,e),_v.set(e,r),r},j$e=(t,e)=>{let r=_v.get(e);return r.add(t),r},M$e=async t=>{try{await D$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_v.delete(t)},_v=new WeakMap,F$e=2,L$e=1});import{aborted as z$e}from"node:util";var _K,U$e,bK=y(()=>{WI();_K=(t,e)=>t===void 0?[]:[U$e(t,e)],U$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await z$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var bv,q$e,B$e,vK=y(()=>{_o();dK();WI();hK();yK();bK();bv=(t,...e)=>{if(Ot(e[0]))return bv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=uK(t,...e),i=q$e({...n,destination:r});return i.pipe=bv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},q$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=B$e(t,i);pK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=gK(e,o,d);return await Promise.race([mK(u),..._K(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},B$e=(t,e)=>Promise.allSettled([t,e])});import{on as H$e}from"node:events";import{getDefaultHighWaterMark as G$e}from"node:stream";var vv,Z$e,KI,V$e,wK,JI,SK,W$e,K$e,Sv=y(()=>{xI();sv();EI();vv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Z$e(e,s),wK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Z$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},KI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;V$e(e,s,t);let a=t.readableObjectMode&&!o;return wK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},V$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},wK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=H$e(t,"data",{signal:e.signal,highWaterMark:SK,highWatermark:SK});return W$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},JI=G$e(!0),SK=JI,W$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=K$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Fa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*fp(a)}},K$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[av(t,r,!e),ov(t,i,!n,{})].filter(Boolean)});import{setImmediate as J$e}from"node:timers/promises";var xK,Y$e,X$e,Q$e,YI,$K,XI=y(()=>{Jb();sn();TI();Sv();ja();dp();xK=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=Y$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([X$e(t),d]);return}let f=vI(c,r),p=KI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Q$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Y$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!dv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=KI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await _3(a,t,r,o)},X$e=async t=>{await J$e(),t.readableFlowing===null&&t.resume()},Q$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Vb(r,{maxBuffer:o})):await Kb(r,{maxBuffer:o})}catch(a){return $K(rW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YI=async t=>{try{return await t}catch(e){return $K(e)}},$K=({bufferedData:t})=>WG(t)?new Uint8Array(t):t});import{finished as eke}from"node:stream/promises";var gp,tke,rke,nke,ike,oke,QI,wv,kK,xv=y(()=>{gp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=tke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],eke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||ike(a,e,r,n)}finally{s.abort()}},tke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&rke(t,r,n),n},rke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{nke(e,r),n.call(t,...i)}},nke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},ike=(t,e,r,n)=>{if(!oke(t,e,r,n))throw t},oke=(t,e,r,n=!0)=>r.propagating?kK(t)||wv(t):(r.propagating=!0,QI(r,e)===n?kK(t):wv(t)),QI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",wv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",kK=t=>t?.code==="EPIPE"});var EK,eP,tP=y(()=>{XI();xv();EK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>eP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),eP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=gp(t,e,l);if(QI(l,e)){await u;return}let[d]=await Promise.all([xK({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var AK,TK,ske,ake,rP=y(()=>{mv();tP();AK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?La([t,e].filter(Boolean)):void 0,TK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>eP({...ske(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:ake(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),ske=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},ake=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var OK,RK,IK=y(()=>{Ol();ds();OK=t=>Tl(t,"ipc"),RK=(t,e)=>{let r=ub(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var PK,CK,DK=y(()=>{ja();IK();wo();DI();PK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=OK(o),a=So(e,"ipc"),c=So(r,"ipc");for await(let l of CI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(nW(t,i,c),i.push(l)),s&&RK(l,o);return i},CK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as cke}from"node:events";var NK,lke,uke,dke,jK=y(()=>{Na();KR();zR();WR();vo();wr();XI();DK();YR();rP();tP();II();xv();NK=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=k3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=EK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=TK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=PK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=lke(h,t,S),D=uke(m,S);try{return await Promise.race([Promise.all([{},A3(_),Promise.all(x),w,T,TV(t,d),...A,...D]),g,dke(t,b),...xV(t,o,f,b),...B9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...SV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>YI(re))),YI(w),CK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},lke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:gp(n,i,r)),uke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ii(o,{checkOpen:!1})&&!ti(o)).map(({type:i,value:o,stream:s=o})=>gp(s,n,e,{isSameDirection:Pn.has(i),stopOnExit:i==="native"}))),dke=async(t,{signal:e})=>{let[r]=await cke(t,"error",{signal:e});throw r}});var MK,yp,Bl,$v=y(()=>{Nl();MK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as FK}from"node:stream/promises";var nP,LK,iP,oP,kv,Ev,sP=y(()=>{xv();nP=async t=>{if(t!==void 0)try{await iP(t)}catch{}},LK=async t=>{if(t!==void 0)try{await oP(t)}catch{}},iP=async t=>{await FK(t,{cleanup:!0,readable:!1,writable:!0})},oP=async t=>{await FK(t,{cleanup:!0,readable:!0,writable:!1})},kv=async(t,e)=>{if(await t,e)throw e},Ev=(t,e,r)=>{r&&!wv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as fke}from"node:stream";import{callbackify as pke}from"node:util";var zK,aP,cP,lP,mke,uP,dP,UK,fP=y(()=>{Ca();ps();Sv();Nl();$v();sP();zK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||an.has(r),{subprocessStdout:a,waitReadableDestroy:c}=aP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=cP(a,s),{read:f,onStdoutDataDone:p}=lP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new fke({read:f,destroy:pke(dP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return uP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},aP=(t,e,r)=>{let n=jl(t,e),i=yp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},cP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:JI},lP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=vv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){mke(this,s,o)},onStdoutDataDone:o}},mke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},uP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await oP(t),await n,await nP(i),await e,r.readable&&r.push(null)}catch(o){await nP(i),UK(r,o)}},dP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(UK(t,n),await kv(e,n))},UK=(t,e)=>{Ev(t,t.readable,e)}});import{Writable as hke}from"node:stream";import{callbackify as qK}from"node:util";var BK,pP,mP,gke,yke,hP,gP,HK,yP=y(()=>{ps();$v();sP();BK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=pP(t,r,e),s=new hke({...mP(n,t,i),destroy:qK(gP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return hP(n,s),s},pP=(t,e,r)=>{let n=$b(t,e),i=yp(r,n,"writableFinal"),o=yp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},mP=(t,e,r)=>({write:gke.bind(void 0,t),final:qK(yke.bind(void 0,t,e,r))}),gke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},yke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},hP=async(t,e,r)=>{try{await iP(t),e.writable&&e.end()}catch(n){await LK(r),HK(e,n)}},gP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(HK(t,i),await kv(e,i))},HK=(t,e)=>{Ev(t,t.writable,e)}});import{Duplex as _ke}from"node:stream";import{callbackify as bke}from"node:util";var GK,vke,ZK=y(()=>{Ca();fP();yP();GK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||an.has(r),{subprocessStdout:c,waitReadableDestroy:l}=aP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=pP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=cP(c,a),{read:g,onStdoutDataDone:b}=lP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new _ke({read:g,...mP(u,t,d),destroy:bke(vke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return uP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),hP(u,_,c),_},vke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([dP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),gP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var _P,Ske,VK=y(()=>{Ca();ps();Sv();_P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||an.has(e),s=jl(t,r),a=vv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Ske(a,s,t)},Ske=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var WK,KK=y(()=>{$v();fP();yP();ZK();VK();WK=(t,{encoding:e})=>{let r=MK();t.readable=zK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=BK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=GK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=_P.bind(void 0,t,e),t[Symbol.asyncIterator]=_P.bind(void 0,t,e,{})}});var JK,wke,xke,YK=y(()=>{JK=(t,e)=>{for(let[r,n]of xke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},wke=(async()=>{})().constructor.prototype,xke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(wke,t)])});import{setMaxListeners as $ke}from"node:events";import{spawn as kke}from"node:child_process";var XK,Eke,Ake,Tke,Oke,Rke,QK=y(()=>{Jb();ER();eI();ps();tI();NI();up();Qb();q3();V3();dp();nK();vb();cK();vK();rP();jK();KK();Nl();YK();XK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Eke(t,e,r),{subprocess:f,promise:p}=Tke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=bv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),JK(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Eke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),{file:a,commandArguments:c,options:l}=zb(t,e,r),u=Ake(l),d=Z3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Ake=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Tke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=kke(...Ub(t,e,r))}catch(m){return U3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;$ke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];rK(c,a,l),aK(c,r,l);let d={},f=Di();c.kill=U9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=AK(c,r),WK(c,r),F3(c,r);let p=Oke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Oke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await NK({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>$o(x,e,w)),_=$o(h,e,"all"),S=Rke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return zl(S,n,e)},Rke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?lp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Xb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Av,Ike,Pke,eJ=y(()=>{_o();wo();Av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Ike(n,t[n],i)]));return{...t,...r}},Ike=(t,e,r)=>Pke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Pke=new Set(["env",...SR])});var gs,Cke,Dke,tJ=y(()=>{_o();gR();rZ();I3();QK();eJ();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Cke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Cke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Dke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?R3(a,c,l):XK(a,c,l,i)},Dke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=eZ(e)?tZ(e,r):[e,...r],[s,a,c]=eb(...o),l=Av(Av(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var rJ,nJ,iJ,Nke,jke,oJ=y(()=>{rJ=({file:t,commandArguments:e})=>iJ(t,e),nJ=({file:t,commandArguments:e})=>({...iJ(t,e),isSync:!0}),iJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Nke(t);return{file:r,commandArguments:n}},Nke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(jke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},jke=/ +/g});var sJ,aJ,Mke,cJ,Fke,lJ,uJ=y(()=>{sJ=(t,e,r)=>{t.sync=e(Mke,r),t.s=t.sync},aJ=({options:t})=>cJ(t),Mke=({options:t})=>({...cJ(t),isSync:!0}),cJ=t=>({options:{...Fke(t),...t}}),Fke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},lJ={preferLocal:!0}});var Sut,We,wut,xut,$ut,kut,Eut,Aut,Tut,Out,Lr=y(()=>{tJ();oJ();JR();uJ();NI();Sut=gs(()=>({})),We=gs(()=>({isSync:!0})),wut=gs(rJ),xut=gs(nJ),$ut=gs(kV),kut=gs(aJ,{},lJ,sJ),{sendMessage:Eut,getOneMessage:Aut,getEachMessage:Tut,getCancelSignal:Out}=L3()});import{existsSync as Tv,statSync as Lke}from"node:fs";import{dirname as bP,extname as zke,isAbsolute as dJ,join as vP,relative as SP,resolve as Ov,sep as Uke}from"node:path";function Rv(t){return t==="./gradlew"||t==="gradle"}function qke(t){return(Tv(vP(t,"build.gradle.kts"))||Tv(vP(t,"build.gradle")))&&Tv(vP(t,"gradle.properties"))}function Bke(t,e){let n=SP(t,e).split(Uke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Hke(t,e){let r=Ov(t,e),n=r;Tv(r)?Lke(r).isFile()&&(n=bP(r)):zke(r)!==""&&(n=bP(r));let i=SP(t,n);if(i.startsWith("..")||dJ(i))return null;let o=n;for(;;){if(qke(o))return o;if(Ov(o)===Ov(t))return null;let s=bP(o);if(s===o)return null;let a=SP(t,s);if(a.startsWith("..")||dJ(a))return null;o=s}}function Iv(t,e){let r=Ov(t),n=new Map,i=[];for(let o of e){let s=Hke(r,o);if(!s){i.push(o);continue}let a=Bke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Pv=y(()=>{"use strict"});import{existsSync as xP,readFileSync as Gke}from"node:fs";import{join as Hl}from"node:path";function Gl(t="."){let e=Hl(t,".cladding","config.yaml");if(!xP(e))return wP;try{let n=(0,fJ.parse)(Gke(e,"utf8"))?.gate;if(!n)return wP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Zke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return wP}}function pJ(t="."){let e=Gl(t).testReport,r=e?[e,...$P]:$P;return[...new Set(r.map(n=>Hl(t,n)))]}function mJ(t="."){let e=Gl(t).testReport;if(e){let r=Hl(t,e);return xP(r)?r:null}return $P.map(r=>Hl(t,r)).find(r=>xP(r))??null}function hJ(t,e){let r=[],n=!1;for(let i of t){let o=Vke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var fJ,Zke,wP,$P,Vke,_p=y(()=>{"use strict";fJ=St(er(),1);Pv();Zke=["type","lint","test","coverage"],wP={scope:"feature"},$P=["test-report.junit.xml",Hl("coverage","junit.xml"),Hl(".cladding","test-report.junit.xml")];Vke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as EP,readFileSync as gJ,readdirSync as Wke,statSync as Kke}from"node:fs";import{join as Cv}from"node:path";function OP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Cv(t,e);if(EP(r))try{if(yJ.test(gJ(r,"utf8")))return!0}catch{}}return!1}function _J(t){try{return EP(t)&&yJ.test(gJ(t,"utf8"))}catch{return!1}}function bJ(t,e=0){if(e>4||!EP(t))return!1;let r;try{r=Wke(t)}catch{return!1}for(let n of r){let i=Cv(t,n),o=!1;try{o=Kke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(bJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&_J(i))return!0}return!1}function Xke(t){if(OP(t))return!0;for(let e of Jke)if(_J(Cv(t,e)))return!0;for(let e of Yke)if(bJ(Cv(t,e)))return!0;return!1}function vJ(t="."){let e=Gl(t).coverage;return e||(Xke(t)?"kover":"jacoco")}function SJ(t="."){return AP[vJ(t)]}function wJ(t="."){return kP[vJ(t)]}var AP,kP,TP,yJ,Jke,Yke,Dv=y(()=>{"use strict";_p();AP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},TP=[kP.kover,kP.jacoco],yJ=/kover/i;Jke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Yke=["buildSrc","build-logic"]});import{existsSync as Zl,readFileSync as IP,readdirSync as $J}from"node:fs";import{dirname as Qke,join as xr,resolve as eEe}from"node:path";import bp from"node:process";function PP(t){return Zl(xr(t,"gradlew"))?"./gradlew":"gradle"}function tEe(t){let e=PP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[SJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function rEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(IP(xr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function iEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function aEe(t,e){for(let r of e)if(Zl(xr(t,r)))return r}function cEe(t,e){try{return $J(t).find(n=>n.endsWith(e))}catch{return}}function fEe(t){let e=[],r=bp.platform==="win32";r||e.push(xr("/etc","madge","config"),xr("/etc","madgerc"));let n=r?bp.env.USERPROFILE:bp.env.HOME;n&&e.push(xr(n,".config","madge","config"),xr(n,".config","madge"),xr(n,".madge","config"),xr(n,".madgerc"));for(let o=eEe(t);;){e.push(xr(o,".madgerc"));let s=Qke(o);if(s===o)break;o=s}let i=bp.env.MADGE_config??bp.env.madge_config;return i&&e.push(i),e}function pEe(t){let e;try{e=IP(t,"utf8")}catch{return!0}try{return JSON.parse(e).excludeRegExp!==void 0}catch{return!0}}function mEe(t,e){let r=e.madge;return r&&typeof r=="object"&&r.excludeRegExp!==void 0?!0:fEe(t).some(n=>Zl(n)&&pEe(n))}function hEe(t){try{return JSON.parse(IP(xr(t,"package.json"),"utf8"))}catch{return{}}}function vp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function xJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function gEe(t,e,r){if(mEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",dEe),{...e,args:n}}function yEe(t,e,r){if(vp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of lEe)if(n.configs.some(i=>Zl(xr(t,i))))return n.gate;if(uEe.some(n=>Zl(xr(t,n)))||r.eslintConfig!==void 0)return e}function bEe(t,e){return _Ee.some(r=>Zl(xr(t,r)))?!0:e.jest!==void 0}function vEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function RP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function SEe(t,e){let r=hEe(t),n=e.lint?yEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:gEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:RP(i,"lint"),s=vp(r,"test"),a=s?vEe(s):void 0;return s&&!a?(o=RP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...vp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&bEe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!vp(r,"coverage")&&!xJ(r,"@vitest/coverage-v8")&&!xJ(r,"@vitest/coverage-istanbul")?o=RP(o,"coverage"):a==="vitest"&&vp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of oEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=cEe(t,o):r=aEe(t,[o]),r)break;if(!r||e.requiresSource&&!iEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?SEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return sEe}var Fi,nEe,oEe,sEe,lEe,uEe,dEe,_Ee,cn=y(()=>{"use strict";Dv();Fi=["--offline","--no-install"];nEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);oEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:tEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:rEe}],sEe={language:"unknown",manifest:"",gates:{}};lEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],uEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],dEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";_Ee=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as wEe,readFileSync as xEe}from"node:fs";import{join as $Ee}from"node:path";function Ua(t){return t.code==="ENOENT"}function Nv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return kJ.test(o)||kJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ua(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Vl(t,e){let r=$Ee(t,"package.json");if(!wEe(r))return!1;try{return!!JSON.parse(xEe(r,"utf8")).scripts?.[e]}catch{return!1}}var kJ,Cn=y(()=>{"use strict";kJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function kEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:jv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:jv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Nv(i,jv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var jv,qa,Mv=y(()=>{"use strict";Lr();cn();Cn();jv="ARCHITECTURE_VIOLATION";qa={name:jv,subprocess:!0,run:kEe}});function EEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Fv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:Fv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Nv(i,Fv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Fv,Ba,Lv=y(()=>{"use strict";Lr();cn();Cn();Fv="HARDCODED_SECRET";Ba={name:Fv,subprocess:!0,run:EEe}});import{existsSync as CP,readdirSync as EJ}from"node:fs";import{join as zv}from"node:path";function TEe(t,e){let r=zv(t,e.path);if(!CP(r))return!0;if(e.isDirectory)try{return EJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function OEe(t){let{cwd:e="."}=t,r=[];for(let i of AEe)TEe(e,i)&&r.push({detector:Sp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=zv(e,"spec.yaml");if(CP(n)){let i=PEe(n),o=i?null:REe(e);if(i)r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Sp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=IEe(e);s&&r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function REe(t){for(let e of["spec/features","spec/scenarios"]){let r=zv(t,e);if(!CP(r))continue;let n;try{n=EJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(zv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function IEe(t){try{return q(t),null}catch(e){return e.message}}function PEe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Sp,AEe,AJ,TJ=y(()=>{"use strict";Ue();H_();Sp="ABSENCE_OF_GOVERNANCE",AEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];AJ={name:Sp,run:OEe}});function Uv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Uv(r)==="while",o=DEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Uv(r)}'`}let n=CEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Uv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Uv(r)}'`:null}function NEe(t,e){let r=DP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function OJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...NEe(r,n));return e}var CEe,DEe,NP=y(()=>{"use strict";CEe={event:"when",state:"while",optional:"where",unwanted:"if"},DEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function jEe(t){let{cwd:e="."}=t;return ge(e,qv,MEe)}function MEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:qv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of OJ(t.features))e.push({detector:qv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var qv,RJ,IJ=y(()=>{"use strict";NP();wt();qv="AC_DRIFT";RJ={name:qv,run:jEe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return CJ[n]??PJ}var FEe,LEe,zEe,PJ,UEe,qEe,CJ,BEe,DJ,Ha=y(()=>{"use strict";cn();FEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,LEe=/^[ \t]*import\s+([\w.]+)/gm,zEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,PJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:FEe,importStyle:"relative"},UEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:LEe,importStyle:"dotted"},qEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:zEe,importStyle:"dotted"},CJ={typescript:PJ,kotlin:UEe,python:qEe},BEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],DJ=new Set([...Object.values(CJ).flatMap(t=>t?.extensions??[]),...BEe].map(t=>t.toLowerCase()))});import{existsSync as HEe,readFileSync as GEe,readdirSync as ZEe,statSync as VEe}from"node:fs";import{join as jJ,relative as NJ}from"node:path";function WEe(t,e){if(!HEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=ZEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=jJ(i,s),c;try{c=VEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function KEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function YEe(t){return JEe.test(t)}function XEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>WEe(jJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=GEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ha();MJ="AI_HINTS_FORBIDDEN_PATTERN";JEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;FJ={name:MJ,run:XEe}});function QEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:zJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var zJ,UJ,qJ=y(()=>{"use strict";Ue();zJ="AC_DUPLICATE_WITHIN_FEATURE";UJ={name:zJ,run:QEe}});import{createRequire as eAe}from"module";import{basename as tAe,dirname as MP,normalize as rAe,relative as nAe,resolve as iAe,sep as GJ}from"path";import*as oAe from"fs";function sAe(t){let e=rAe(t);return e.length>1&&e[e.length-1]===GJ&&(e=e.substring(0,e.length-1)),e}function ZJ(t,e){return t.replace(aAe,e)}function lAe(t){return t==="/"||cAe.test(t)}function jP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=iAe(t)),(n||o)&&(t=sAe(t)),t===".")return"";let s=t[t.length-1]!==i;return ZJ(s?t+i:t,i)}function VJ(t,e){return e+t}function uAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:ZJ(nAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function dAe(t){return t}function fAe(t,e,r){return e+t+r}function pAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?uAe(t,e):n?VJ:dAe}function mAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function hAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function bAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?hAe(t):mAe(t):n&&n.length?yAe:gAe:_Ae}function kAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?$Ae:r&&r.length?n?vAe:SAe:n?wAe:xAe}function TAe(t){return t.group?AAe:EAe}function IAe(t){return t.group?OAe:RAe}function DAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?CAe:PAe}function WJ(t,e,r){if(r.options.useRealPaths)return NAe(e,r);let n=MP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=MP(n)}return r.symlinks.set(t,e),i>1}function NAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Bv(t,e,r,n){e(t&&!n?t:null,r)}function HAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?jAe:zAe:n?e?MAe:BAe:i?e?LAe:qAe:e?FAe:UAe}function VAe(t){return t?ZAe:GAe}function YAe(t,e){return new Promise((r,n)=>{YJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function YJ(t,e,r){new JJ(t,e,r).start()}function XAe(t,e){return new JJ(t,e).start()}var BJ,aAe,cAe,gAe,yAe,_Ae,vAe,SAe,wAe,xAe,$Ae,EAe,AAe,OAe,RAe,PAe,CAe,jAe,MAe,FAe,LAe,zAe,UAe,qAe,BAe,KJ,GAe,ZAe,WAe,KAe,JAe,JJ,HJ,XJ,QJ,e8=y(()=>{BJ=eAe(import.meta.url);aAe=/[\\/]/g;cAe=/^[a-z]:[\\/]$/i;gAe=(t,e)=>{e.push(t||".")},yAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},_Ae=()=>{};vAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},SAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},wAe=(t,e,r,n)=>{r.files++},xAe=(t,e)=>{e.push(t)},$Ae=()=>{};EAe=t=>t,AAe=()=>[""].slice(0,0);OAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},RAe=()=>{};PAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&WJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},CAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&WJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};jAe=t=>t.counts,MAe=t=>t.groups,FAe=t=>t.paths,LAe=t=>t.paths.slice(0,t.options.maxFiles),zAe=(t,e,r)=>(Bv(e,r,t.counts,t.options.suppressErrors),null),UAe=(t,e,r)=>(Bv(e,r,t.paths,t.options.suppressErrors),null),qAe=(t,e,r)=>(Bv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),BAe=(t,e,r)=>(Bv(e,r,t.groups,t.options.suppressErrors),null);KJ={withFileTypes:!0},GAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",KJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},ZAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",KJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};WAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},KAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},JAe=class{aborted=!1;abort(){this.aborted=!0}},JJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=HAe(e,this.isSynchronous),this.root=jP(t,e),this.state={root:lAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new KAe,options:e,queue:new WAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new JAe,fs:e.fs||oAe},this.joinPath=pAe(this.root,e),this.pushDirectory=bAe(this.root,e),this.pushFile=kAe(e),this.getArray=TAe(e),this.groupFiles=IAe(e),this.resolveSymlink=DAe(e,this.isSynchronous),this.walkDirectory=VAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=jP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=tAe(_),x=jP(MP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};HJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return YAe(this.root,this.options)}withCallback(t){YJ(this.root,this.options,t)}sync(){return XAe(this.root,this.options)}},XJ=null;try{BJ.resolve("picomatch"),XJ=BJ("picomatch")}catch{}QJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:GJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new HJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new HJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||XJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var wp=v((Cdt,o8)=>{"use strict";var t8="[^\\\\/]",QAe="(?=.)",r8="[^/]",FP="(?:\\/|$)",n8="(?:^|\\/)",LP=`\\.{1,2}${FP}`,eTe="(?!\\.)",tTe=`(?!${n8}${LP})`,rTe=`(?!\\.{0,1}${FP})`,nTe=`(?!${LP})`,iTe="[^.\\/]",oTe=`${r8}*?`,sTe="/",i8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:QAe,QMARK:r8,END_ANCHOR:FP,DOTS_SLASH:LP,NO_DOT:eTe,NO_DOTS:tTe,NO_DOT_SLASH:rTe,NO_DOTS_SLASH:nTe,QMARK_NO_DOT:iTe,STAR:oTe,START_ANCHOR:n8,SEP:sTe},aTe={...i8,SLASH_LITERAL:"[\\\\/]",QMARK:t8,STAR:`${t8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},cTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};o8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:cTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?aTe:i8}}});var xp=v(zr=>{"use strict";var{REGEX_BACKSLASH:lTe,REGEX_REMOVE_BACKSLASH:uTe,REGEX_SPECIAL_CHARS:dTe,REGEX_SPECIAL_CHARS_GLOBAL:fTe}=wp();zr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);zr.hasRegexChars=t=>dTe.test(t);zr.isRegexChar=t=>t.length===1&&zr.hasRegexChars(t);zr.escapeRegex=t=>t.replace(fTe,"\\$1");zr.toPosixSlashes=t=>t.replace(lTe,"/");zr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};zr.removeBackslashes=t=>t.replace(uTe,e=>e==="\\"?"":e);zr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?zr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};zr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};zr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};zr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var p8=v((Ndt,f8)=>{"use strict";var s8=xp(),{CHAR_ASTERISK:zP,CHAR_AT:pTe,CHAR_BACKWARD_SLASH:$p,CHAR_COMMA:mTe,CHAR_DOT:UP,CHAR_EXCLAMATION_MARK:qP,CHAR_FORWARD_SLASH:d8,CHAR_LEFT_CURLY_BRACE:BP,CHAR_LEFT_PARENTHESES:HP,CHAR_LEFT_SQUARE_BRACKET:hTe,CHAR_PLUS:gTe,CHAR_QUESTION_MARK:a8,CHAR_RIGHT_CURLY_BRACE:yTe,CHAR_RIGHT_PARENTHESES:c8,CHAR_RIGHT_SQUARE_BRACKET:_Te}=wp(),l8=t=>t===d8||t===$p,u8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},bTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&l8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=s8.removeBackslashes(P)),xe&&_===!0&&(xe=s8.removeBackslashes(xe)));let Cr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Cr.maxDepth=0,l8(A)||s.push(D),Cr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var kp=wp(),ln=xp(),{MAX_LENGTH:Hv,POSIX_REGEX_SOURCE:vTe,REGEX_NON_SPECIAL_CHARS:STe,REGEX_SPECIAL_CHARS_BACKREF:wTe,REPLACEMENTS:m8}=kp,xTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>ln.escapeRegex(i)).join("..")}return r},Wl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,h8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},$Te=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},g8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if($Te(e))return e.replace(/\\(.)/g,"$1")},kTe=t=>{let e=t.map(g8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},ETe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=g8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?ln.escapeRegex(r[0]):`[${r.map(i=>ln.escapeRegex(i)).join("")}]`}*`},ATe=t=>{let e=0,r=t.trim(),n=GP(r);for(;n;)e++,r=n.body.trim(),n=GP(r);return e},TTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kp.DEFAULT_MAX_EXTGLOB_RECURSION,n=h8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||kTe(n)))return{risky:!0};for(let i of n){let o=ETe(i);if(o)return{risky:!0,safeOutput:o};if(ATe(i)>r)return{risky:!0}}return{risky:!1}},ZP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=m8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=kp.globChars(r.windows),l=kp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ln.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Cr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},uo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},ki=H=>{$[H]++,xe.push(H)},en=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},fo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;ki("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Kde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=TTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[H.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=lt||ln.escapeRegex(ht);for(let Ai=H.tokensIndex+1;Ai1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Cr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=ZP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${Ei})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),en("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(wTe,(B,Oe,ut,zt,lt,Ei)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):Ei===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=ln.wrapOutput(ht,$,e),$)}for(;!Cr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=vTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=ln.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){ki("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Wl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Kde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),en("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));P=`\\${P}`}else ki("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Wl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}en("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||ln.hasRegexChars(B))continue;let Oe=ln.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=xTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),en("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){fo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){uo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=STe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){fo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!Ei){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ai=t[$.index+4];if(Ai&&Ai!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Cr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Cr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ai=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ai})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));$.output=ln.escapeLast($.output,"["),en("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing",")"));$.output=ln.escapeLast($.output,"("),en("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","}"));$.output=ln.escapeLast($.output,"{"),en("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};ZP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=m8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=kp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=ln.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};y8.exports=ZP});var S8=v((Mdt,v8)=>{"use strict";var OTe=p8(),VP=_8(),b8=xp(),RTe=wp(),ITe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=ITe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?b8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(b8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):VP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>OTe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=VP.fastpaths(t,e)),i.output||(i=VP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=RTe;v8.exports=Rt});var k8=v((Fdt,$8)=>{"use strict";var w8=S8(),PTe=xp();function x8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:PTe.isWindows()}),w8(t,e,r)}Object.assign(x8,w8);$8.exports=x8});import{readdir as CTe,readdirSync as DTe,realpath as NTe,realpathSync as jTe,stat as MTe,statSync as FTe}from"fs";import{isAbsolute as LTe,posix as Ga,resolve as zTe}from"path";import{fileURLToPath as UTe}from"url";function HTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&BTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ga.relative(t,n)||".":n=>Ga.relative(t,`${e}/${n}`)||"."}function VTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ga.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function O8(t){var e;let r=Kl.default.scan(t,WTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function eOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Kl.default.scan(t);return r.isGlob||r.negated}function Ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function R8(t){return typeof t=="string"?[t]:t??[]}function WP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=QTe(o);s=LTe(s.replace(rOe,""))?Ga.relative(a,s):Ga.normalize(s);let c=(i=tOe.exec(s))===null||i===void 0?void 0:i[0],l=O8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ga.join(o,...d):o}return s}function nOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function iOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=nOe(t,e,n);t.debug&&Ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(A8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Kl.default)(i.match,f),m=(0,Kl.default)(i.ignore,f),h=HTe(i.match,f),g=E8(r,d,o),b=o?g:E8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new QJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&Ep(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return Ep(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&VTe(r,d)]}function oOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function aOe(t){let e={...sOe,...t};return e.cwd=(e.cwd instanceof URL?UTe(e.cwd):zTe(e.cwd)).replace(A8,"/"),e.ignore=R8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||CTe,readdirSync:e.fs.readdirSync||DTe,realpath:e.fs.realpath||NTe,realpathSync:e.fs.realpathSync||jTe,stat:e.fs.stat||MTe,statSync:e.fs.statSync||FTe}),e.debug&&Ep("globbing with options:",e),e}function cOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=qTe(t)||typeof t=="string",i=R8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=aOe(n?e:t);return i.length>0?iOe(o,i):[]}function _s(t,e){let[r,n]=cOe(t,e);return r?oOe(r.sync(),n):[]}var Kl,qTe,A8,T8,BTe,GTe,ZTe,WTe,KTe,JTe,YTe,XTe,QTe,tOe,rOe,sOe,Ap=y(()=>{e8();Kl=St(k8(),1),qTe=Array.isArray,A8=/\\/g,T8=process.platform==="win32",BTe=/^(\/?\.\.)+$/;GTe=/^[A-Z]:\/$/i,ZTe=T8?t=>GTe.test(t):t=>t==="/";WTe={parts:!0};KTe=/(?t.replace(KTe,"\\$&"),XTe=t=>t.replace(JTe,"\\$&"),QTe=T8?XTe:YTe;tOe=/^(\/?\.\.)+/,rOe=/\\(?=[()[\]{}!*+?@|])/g;sOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Tp,readFileSync as lOe,readdirSync as uOe,statSync as I8}from"node:fs";import{join as Za}from"node:path";function dOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=KP(r);return(s.size>0||a.length>0)&&!Tp(Za(e,i.mainRoot))?[{detector:Op,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(fOe(e,i,s,o),pOe(e,i,s,o)),a.length>0&&mOe(e,i,a,o),o)}function KP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function fOe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of uOe(o)){let a=Za(o,s);I8(a).isDirectory()&&(r.has(s)||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function pOe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of r){let a=Za(o,s);Tp(a)&&I8(a).isDirectory()||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function mOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Za(t,i,s.from);if(!Tp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Za(a,l),d;try{d=lOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];hOe(p,s.to,e.importStyle)&&n.push({detector:Op,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function hOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Op,P8,JP=y(()=>{"use strict";Ap();Ue();Ha();Op="ARCHITECTURE_FROM_SPEC";P8={name:Op,run:dOe}});import{existsSync as gOe,readFileSync as yOe}from"node:fs";import{join as _Oe}from"node:path";function vOe(t){let{cwd:e="."}=t,r=_Oe(e,"spec/capabilities.yaml");if(!gOe(r))return[];let n;try{let u=yOe(r,"utf8"),d=C8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";C8=St(er(),1);Ue();Gv="CAPABILITIES_FEATURE_MAPPING",bOe=8;D8={name:Gv,run:vOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function $Oe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function kOe(t){let{cwd:e="."}=t;return ge(e,YP,r=>EOe(r,e))}function EOe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=xOe(e,o);if(!SOe(s))continue;let a=wOe(s,"utf8");$Oe(a)||n.push({detector:YP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YP,j8,M8=y(()=>{"use strict";Ha();wt();YP="CONVENTION_DRIFT";j8={name:YP,run:kOe}});import{existsSync as XP,readFileSync as F8}from"node:fs";import{join as Zv}from"node:path";function AOe(t){return JSON.parse(t).total?.lines?.pct??0}function L8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function ROe(t,e){if(!Rv(dt(t).gates.coverage?.cmd))return null;let r;try{r=Iv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=TP.find(d=>XP(Zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=L8(F8(Zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=z8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function IOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=ROe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=dt(e).language==="kotlin"?TP.find(a=>XP(Zv(e,a)))??wJ(e):n.coverageSummary,o=Zv(e,i);if(!XP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=F8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?TOe(a):n.coverageFormat==="cobertura-xml"?OOe(a):AOe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Vv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Vv}%`}]}var ko,Vv,U8,q8=y(()=>{"use strict";Ue();Dv();Ha();Pv();cn();ko="COVERAGE_DROP",Vv=70;U8={name:ko,run:IOe}});import{existsSync as POe}from"node:fs";import{join as COe}from"node:path";function NOe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>jOe(r,e))}function jOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Wv="DELIVERABLE_INTEGRITY",DOe=8;B8={name:Wv,run:NOe}});function MOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Kv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function FOe(t){let e=MOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Kv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function LOe(t){let{cwd:e="."}=t;return ge(e,Kv,r=>FOe(r))}var Kv,G8,Z8=y(()=>{"use strict";wt();Kv="SMOKE_PROBE_DEMAND";G8={name:Kv,run:LOe}});function zOe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>UOe(r,e))}function UOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Jv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=J_(n,e,o);s.state!=="fresh"&&i.push({detector:Jv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Jv,Yv,QP=y(()=>{"use strict";xl();wt();Jv="STALE_ATTESTATION";Yv={name:Jv,run:zOe}});function qOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return BOe(r)}function BOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:V8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var V8,Xv,eC=y(()=>{"use strict";Ue();V8="DEPENDENCY_CYCLE";Xv={name:V8,run:qOe}});import{appendFileSync as HOe,existsSync as W8,mkdirSync as GOe,readFileSync as ZOe}from"node:fs";import{dirname as VOe,join as WOe}from"node:path";function K8(t){return WOe(t,KOe,JOe)}function J8(t){return tC.add(t),()=>tC.delete(t)}function Va(t,e){let r=K8(t),n=VOe(r);W8(n)||GOe(n,{recursive:!0}),HOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of tC)try{i(t,e)}catch{}}function fr(t){let e=K8(t);if(!W8(e))return[];let r=ZOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var KOe,JOe,tC,un=y(()=>{"use strict";KOe=".cladding",JOe="audit.log.jsonl";tC=new Set});import{existsSync as YOe}from"node:fs";import{join as XOe}from"node:path";function QOe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:rC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(YOe(XOe(e,i.artifact))||n.push({detector:rC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var rC,Y8,X8=y(()=>{"use strict";un();rC="EVIDENCE_MISMATCH";Y8={name:rC,run:QOe}});import{existsSync as eRe,readFileSync as tRe}from"node:fs";import{join as rRe}from"node:path";function nRe(t){let e=rRe(t,r5);if(!eRe(e))return null;try{let n=((0,t5.parse)(tRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*e5(t,e){for(let r of t??[])r.startsWith(Q8)&&(yield{ref:r,name:r.slice(Q8.length),field:e})}function iRe(t){let{cwd:e="."}=t,r=nRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:nC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...e5(s.evidence_refs,"evidence_refs"),...e5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:nC,severity:"warn",path:r5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var t5,nC,Q8,r5,n5,i5=y(()=>{"use strict";t5=St(er(),1);Ue();nC="FIXTURE_REFERENCE_INVALID",Q8="fixture:",r5="conformance/fixtures.yaml";n5={name:nC,run:iRe}});import{existsSync as Jl,readFileSync as iC}from"node:fs";import{join as Wa}from"node:path";function oRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Rp(t){if(!Jl(t))return null;try{return JSON.parse(iC(t,"utf8"))}catch{return null}}function sRe(t,e){let r=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=oRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function aRe(t,e){for(let r of o5){let n=Wa(t,r.path);if(!Jl(n))continue;let i=Rp(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function cRe(t,e){let r=Rp(Wa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of o5){let s=Wa(t,o.path);if(!Jl(s))continue;let a=Rp(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Wa(t,".claude-plugin","marketplace.json");if(Jl(i)){let o=Rp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function lRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function uRe(t,e){let r=Wa(t,"src","cli","clad.ts"),n=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Jl(r)||!Jl(n))return;let i=lRe(iC(r,"utf8"));if(i.length===0)return;let s=Rp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function dRe(t){let{cwd:e="."}=t,r=[];return sRe(e,r),uRe(e,r),aRe(e,r),cRe(e,r),r}var Eo,o5,s5,a5=y(()=>{"use strict";Ap();Eo="HARNESS_INTEGRITY",o5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];s5={name:Eo,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function gRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>_Re(r,e))}function yRe(t){let e=mRe(t,"spec/capabilities.yaml");if(!fRe(e))return!1;try{let r=c5.default.parse(pRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function _Re(t,e){let r=t.features.length;if(r{"use strict";c5=St(er(),1);wt();Qv="HOLLOW_GOVERNANCE",hRe=8;l5={name:Qv,run:gRe}});import{existsSync as d5,readFileSync as f5}from"node:fs";import{join as p5}from"node:path";function m5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function SRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function wRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function xRe(t){let e=p5(t,"README.md"),r=p5(t,"docs","dogfood","matrix.md");if(!d5(e)||!d5(r))return[];let n=m5(f5(e,"utf8"),bRe),i=m5(f5(r,"utf8"),vRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=wRe(a);if(c===null)continue;let l=i[s]??"not-run",u=SRe(l);u!==null&&c>u&&o.push({detector:h5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function $Re(t){let{cwd:e="."}=t;return xRe(e)}var h5,bRe,vRe,g5,y5=y(()=>{"use strict";h5="HOST_CLAIM_DRIFT",bRe=//,vRe=//;g5={name:h5,run:$Re}});function kRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return _5(r.features.map(i=>i.id),"feature","spec/features/",n),_5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function _5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:b5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var b5,v5,S5=y(()=>{"use strict";Ue();b5="ID_COLLISION";v5={name:b5,run:kRe}});import{existsSync as Ip,readFileSync as oC,readdirSync as sC,statSync as ERe,writeFileSync as x5}from"node:fs";import{join as Ao}from"node:path";function w5(t){if(!Ip(t))return 0;try{return sC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ARe(t){if(!Ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=ERe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function TRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Ip(e))return 0;try{let r=eS.default.parse(oC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=w5(Ao(t,"spec","features")),r=w5(Ao(t,"spec","scenarios")),n=TRe(t),i=ARe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Yl(t,e){let r=Ao(t,"spec.yaml");if(!Ip(r))return;let n=oC(r,"utf8"),i=ORe(n,e);i!==n&&x5(r,i)}function ORe(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`],s=d=>r===`\r @@ -271,51 +271,51 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function Wa(t="."){let e=Ao(t,"spec","features");if(!Tp(e))return!1;let r=[];for(let i of iC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Yv.parse)(nC(Ao(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function Ka(t="."){let e=Ao(t,"spec","features");if(!Ip(e))return!1;let r=[];for(let i of sC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,eS.parse)(oC(Ao(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return w5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var Yv,Op=y(()=>{"use strict";Yv=St(er(),1)});import{existsSync as x5,readFileSync as $5,readdirSync as kRe}from"node:fs";import{join as oC}from"node:path";function ERe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=k5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return sC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...sC(e),{detector:Rp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of k5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Rp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...sC(e)),o}function sC(t){let e=oC(t,"spec","index.yaml"),r=oC(t,"spec","features");if(!x5(e)||!x5(r))return[];let n=new Map;try{for(let l of $5(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of kRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=$5(oC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Rp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Rp,k5,E5,A5=y(()=>{"use strict";Op();Ue();Rp="INVENTORY_DRIFT",k5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];E5={name:Rp,run:ERe}});import{existsSync as ARe,readFileSync as TRe}from"node:fs";import{join as ORe}from"node:path";function IRe(t){let{cwd:e="."}=t,r=ORe(e,"src","spec","schema.json"),n=[];if(ARe(r)){let i;try{i=JSON.parse(TRe(r,"utf8"))}catch(o){n.push({detector:Ip,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of RRe)i.required?.includes(o)||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ip,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==T5&&n.push({detector:Ip,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${T5}'`})}catch{}return n}var Ip,RRe,T5,O5,R5=y(()=>{"use strict";Ue();Ip="META_INTEGRITY",RRe=["schema","project","features"],T5="0.1";O5={name:Ip,run:IRe}});function PRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return I5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),I5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function I5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:P5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var P5,C5,D5=y(()=>{"use strict";Ue();P5="SLUG_CONFLICT";C5={name:P5,run:PRe}});function Yl(t){return t==="planned"||t==="in_progress"}var Xv=y(()=>{"use strict"});import{existsSync as CRe}from"node:fs";import{join as DRe}from"node:path";function NRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>jRe(r,e))}function jRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=DRe(e,i);CRe(o)||r.push(MRe(n.id,i,n.status))}return r}function MRe(t,e,r){return Yl(r)?{detector:Qv,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:Qv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Qv,eS,aC=y(()=>{"use strict";Xv();wt();Qv="MISSING_IMPLEMENTATION";eS={name:Qv,run:NRe}});function FRe(t){let{cwd:e="."}=t;return ge(e,cC,LRe)}function LRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:cC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var cC,tS,lC=y(()=>{"use strict";wt();cC="MISSING_TESTS";tS={name:cC,run:FRe}});import{existsSync as zRe,readFileSync as URe}from"node:fs";import{join as N5}from"node:path";function j5(t){if(zRe(t))try{return JSON.parse(URe(t,"utf8"))}catch{return}}function GRe(t){let{cwd:e="."}=t,r=j5(N5(e,qRe)),n=j5(N5(e,BRe));if(!r||!n)return[{detector:uC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>HRe&&i.push({detector:uC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var uC,qRe,BRe,HRe,M5,F5=y(()=>{"use strict";uC="PERFORMANCE_DRIFT",qRe="perf/baseline.json",BRe="perf/current.json",HRe=10;M5={name:uC,run:GRe}});import{existsSync as ZRe}from"node:fs";import{join as VRe}from"node:path";function KRe(t){let{cwd:e="."}=t;return ge(e,dC,r=>YRe(r,e))}function JRe(t,e){return(t.modules??[]).some(r=>ZRe(VRe(e,r)))}function YRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||JRe(s,e)||r.push(s.id);let n=WRe;if(r.length<=n)return[];let i=r.slice(0,L5).join(", "),o=r.length>L5?", \u2026":"";return[{detector:dC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var dC,WRe,L5,z5,U5=y(()=>{"use strict";wt();dC="PLANNED_BACKLOG",WRe=5,L5=8;z5={name:dC,run:KRe}});import{existsSync as XRe,readFileSync as QRe}from"node:fs";import{join as eIe}from"node:path";function nIe(t){let{cwd:e="."}=t;return ge(e,fC,r=>iIe(r,e))}function iIe(t,e){if(t.features.lengthn.includes(i))?[{detector:fC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var fC,tIe,rIe,q5,B5=y(()=>{"use strict";wt();fC="PROJECT_CONTEXT_DRIFT",tIe=8,rIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];q5={name:fC,run:nIe}});function H5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:rS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function oIe(t){let{cwd:e="."}=t;return ge(e,rS,sIe)}function sIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...H5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:rS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...H5(e,n.features,`scenario ${n.id}.features`));return r}var rS,nS,pC=y(()=>{"use strict";wt();rS="REFERENCE_INTEGRITY";nS={name:rS,run:oIe}});function Pp(t=""){return new RegExp(aIe,t)}var aIe,mC=y(()=>{"use strict";aIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as cIe,readdirSync as lIe,readFileSync as uIe,statSync as dIe,writeFileSync as fIe}from"node:fs";import{dirname as pIe,join as Cp,normalize as mIe,relative as hIe}from"node:path";function vIe(t){let e=[];for(let r of t.matchAll(bIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Pp("g"))??[])e.push(n);return[...new Set(e)].sort()}function SIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function G5(t){return t.split("\\").join("/")}function wIe(t){return gIe.some(e=>t===e||t.startsWith(`${e}/`))}function xIe(t){let e=Cp(t,"docs");if(!cIe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=lIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Cp(i,s),c;try{c=dIe(a)}catch{continue}let l=G5(hIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function $Ie(t,e){if(/^[a-z]+:/i.test(e))return null;let r=mIe(Cp(pIe(t),e));return G5(r)}function Dp(t="."){let e=[];for(let r of xIe(t)){let n;try{n=uIe(Cp(t,r),"utf8")}catch{continue}let i=SIe(n),o=vIe(i);if(wIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(yIe)?[]:i.match(Pp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(_Ie)){let d=$Ie(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function Z5(t="."){let e=Dp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return fIe(Cp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return x5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var eS,Pp=y(()=>{"use strict";eS=St(er(),1)});import{existsSync as $5,readFileSync as k5,readdirSync as RRe}from"node:fs";import{join as aC}from"node:path";function IRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=E5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cC(e),{detector:Cp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of E5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Cp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...cC(e)),o}function cC(t){let e=aC(t,"spec","index.yaml"),r=aC(t,"spec","features");if(!$5(e)||!$5(r))return[];let n=new Map;try{for(let l of k5(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of RRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=k5(aC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Cp,E5,A5,T5=y(()=>{"use strict";Pp();Ue();Cp="INVENTORY_DRIFT",E5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];A5={name:Cp,run:IRe}});import{existsSync as PRe,readFileSync as CRe}from"node:fs";import{join as DRe}from"node:path";function jRe(t){let{cwd:e="."}=t,r=DRe(e,"src","spec","schema.json"),n=[];if(PRe(r)){let i;try{i=JSON.parse(CRe(r,"utf8"))}catch(o){n.push({detector:Dp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of NRe)i.required?.includes(o)||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==O5&&n.push({detector:Dp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${O5}'`})}catch{}return n}var Dp,NRe,O5,R5,I5=y(()=>{"use strict";Ue();Dp="META_INTEGRITY",NRe=["schema","project","features"],O5="0.1";R5={name:Dp,run:jRe}});function MRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return P5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),P5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function P5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:C5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var C5,D5,N5=y(()=>{"use strict";Ue();C5="SLUG_CONFLICT";D5={name:C5,run:MRe}});function Xl(t){return t==="planned"||t==="in_progress"}var tS=y(()=>{"use strict"});import{existsSync as FRe}from"node:fs";import{join as LRe}from"node:path";function zRe(t){let{cwd:e="."}=t;return ge(e,rS,r=>URe(r,e))}function URe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=LRe(e,i);FRe(o)||r.push(qRe(n.id,i,n.status))}return r}function qRe(t,e,r){return Xl(r)?{detector:rS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:rS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var rS,nS,lC=y(()=>{"use strict";tS();wt();rS="MISSING_IMPLEMENTATION";nS={name:rS,run:zRe}});function BRe(t){let{cwd:e="."}=t;return ge(e,uC,HRe)}function HRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:uC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var uC,iS,dC=y(()=>{"use strict";wt();uC="MISSING_TESTS";iS={name:uC,run:BRe}});import{existsSync as GRe,readFileSync as ZRe}from"node:fs";import{join as j5}from"node:path";function M5(t){if(GRe(t))try{return JSON.parse(ZRe(t,"utf8"))}catch{return}}function JRe(t){let{cwd:e="."}=t,r=M5(j5(e,VRe)),n=M5(j5(e,WRe));if(!r||!n)return[{detector:fC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>KRe&&i.push({detector:fC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var fC,VRe,WRe,KRe,F5,L5=y(()=>{"use strict";fC="PERFORMANCE_DRIFT",VRe="perf/baseline.json",WRe="perf/current.json",KRe=10;F5={name:fC,run:JRe}});import{existsSync as YRe}from"node:fs";import{join as XRe}from"node:path";function eIe(t){let{cwd:e="."}=t;return ge(e,pC,r=>rIe(r,e))}function tIe(t,e){return(t.modules??[]).some(r=>YRe(XRe(e,r)))}function rIe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||tIe(s,e)||r.push(s.id);let n=QRe;if(r.length<=n)return[];let i=r.slice(0,z5).join(", "),o=r.length>z5?", \u2026":"";return[{detector:pC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var pC,QRe,z5,U5,q5=y(()=>{"use strict";wt();pC="PLANNED_BACKLOG",QRe=5,z5=8;U5={name:pC,run:eIe}});import{existsSync as nIe,readFileSync as iIe}from"node:fs";import{join as oIe}from"node:path";function cIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>lIe(r,e))}function lIe(t,e){if(t.features.lengthn.includes(i))?[{detector:mC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var mC,sIe,aIe,B5,H5=y(()=>{"use strict";wt();mC="PROJECT_CONTEXT_DRIFT",sIe=8,aIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];B5={name:mC,run:cIe}});function G5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:oS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function uIe(t){let{cwd:e="."}=t;return ge(e,oS,dIe)}function dIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...G5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:oS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...G5(e,n.features,`scenario ${n.id}.features`));return r}var oS,sS,hC=y(()=>{"use strict";wt();oS="REFERENCE_INTEGRITY";sS={name:oS,run:uIe}});function Np(t=""){return new RegExp(fIe,t)}var fIe,gC=y(()=>{"use strict";fIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as pIe,readdirSync as mIe,readFileSync as hIe,statSync as gIe,writeFileSync as yIe}from"node:fs";import{dirname as _Ie,join as jp,normalize as bIe,relative as vIe}from"node:path";function kIe(t){let e=[];for(let r of t.matchAll($Ie))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Np("g"))??[])e.push(n);return[...new Set(e)].sort()}function EIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function Z5(t){return t.split("\\").join("/")}function AIe(t){return SIe.some(e=>t===e||t.startsWith(`${e}/`))}function TIe(t){let e=jp(t,"docs");if(!pIe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=mIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=jp(i,s),c;try{c=gIe(a)}catch{continue}let l=Z5(vIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function OIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=bIe(jp(_Ie(t),e));return Z5(r)}function Mp(t="."){let e=[];for(let r of TIe(t)){let n;try{n=hIe(jp(t,r),"utf8")}catch{continue}let i=EIe(n),o=kIe(i);if(AIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(wIe)?[]:i.match(Np("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(xIe)){let d=OIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function V5(t="."){let e=Mp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return yIe(jp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var gIe,yIe,_Ie,bIe,iS=y(()=>{"use strict";mC();gIe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],yIe="clad-doc-links: ignore",_Ie=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,bIe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as kIe}from"node:fs";import{join as EIe}from"node:path";function AIe(t){let{cwd:e="."}=t;return ge(e,oS,r=>TIe(r,e))}function TIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Dp(e).docs){for(let o of i.doc_links)kIe(EIe(e,o))||n.push({detector:oS,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:oS,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var oS,sS,hC=y(()=>{"use strict";iS();wt();oS="DOC_LINK_INTEGRITY";sS={name:oS,run:AIe}});function OIe(t){let{cwd:e="."}=t;return ge(e,Np,r=>RIe(r))}function RIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=V5,o=t.project.onboarding_seeded===!0&&!i;r>=V5&&n.length===0&&e.push({detector:Np,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let a of n)(a.features??[]).length===0&&e.push({detector:Np,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Np,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Np,V5,W5,K5=y(()=>{"use strict";wt();Np="SCENARIO_COVERAGE",V5=8;W5={name:Np,run:OIe}});import{createHash as IIe}from"node:crypto";function PIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function jp(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??J5),sample:PIe(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(J5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Mp(t){return(t.features??[]).filter(e=>e.status==="done").length}function CIe(t,e){return e<=0?!1:e>=1?!0:parseInt(IIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var J5,aS=y(()=>{"use strict";J5=["unwanted"]});import{chmodSync as DIe,existsSync as X5,readFileSync as NIe,readdirSync as jIe,statSync as Q5,unlinkSync as MIe,utimesSync as FIe,writeFileSync as LIe}from"node:fs";import{join as eY}from"node:path";import tY from"node:process";function zIe(t){return dJ(t).map(e=>{try{let r=Q5(e);return r.isFile()?{path:e,body:NIe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function UIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!X5(r.path))continue;if(!Q5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}MIe(r.path);continue}LIe(r.path,r.body),r.mode!==void 0&&DIe(r.path,r.mode),r.atime&&r.mtime&&FIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function qIe(t){let e=!1,r=n=>{for(let i of jIe(n,{withFileTypes:!0})){if(e)return;let o=eY(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function gC(t={}){let{cwd:e="."}=t,r=eY(e,vs);if(!X5(r)||!qIe(r))return{stage:Ka,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${vs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Ka,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=zIe(e)}catch(d){return{stage:Ka,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,vs];try{s=We(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=UIe(o);if(l.length>0)return{stage:Ka,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Ka,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=Nt(Ka,i.cmd,s,c);return u||Yt(Ka,s)}var Ka,vs,BIe,yC=y(()=>{"use strict";Fr();an();gp();Pn();Ka="stage_2.3",vs="tests/oracle";BIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tY.argv[1]}`;if(BIe){let t=gC();console.log(JSON.stringify(t)),tY.exit(t.exitCode)}});import{existsSync as HIe}from"node:fs";import{join as GIe}from"node:path";function ZIe(t){let{cwd:e="."}=t;return ge(e,ii,r=>VIe(r,e))}function VIe(t,e){let r=[],n=jp(t.project,Mp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?fr(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Fp(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:ii,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${vs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!HIe(GIe(e,f))){r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${vs}/`)||r.push({detector:ii,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${vs}/ \u2014 stage_2.3 only runs ${vs}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ii,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:ii,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:ii,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:ii,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var ii,rY,nY=y(()=>{"use strict";ln();aS();yC();wt();ii="SPEC_CONFORMANCE";rY={name:ii,run:ZIe}});function WIe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:_C,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>iY&&i.push({detector:_C,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${iY})`})}return i}var _C,iY,oY,sY=y(()=>{"use strict";ln();_C="STALE_EVIDENCE",iY=90;oY={name:_C,run:WIe}});import{existsSync as aY}from"node:fs";import{join as cY}from"node:path";function KIe(t){let{cwd:e="."}=t;return ge(e,Xl,r=>JIe(r,e))}function JIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Xl,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Xl,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>aY(cY(e,o)));i.length>0&&r.push({detector:Xl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Yl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>aY(cY(e,i)))&&r.push({detector:Xl,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var Xl,cS,bC=y(()=>{"use strict";Xv();wt();Xl="STALE_SPECIFICATION";cS={name:Xl,run:KIe}});import{existsSync as lY,statSync as uY}from"node:fs";import{join as dY}from"node:path";function XIe(t,e){let r=0;for(let n of e){let i=dY(t,n);if(!lY(i))continue;let o=uY(i).mtimeMs;o>r&&(r=o)}return r}function QIe(t){let{cwd:e="."}=t;return ge(e,vC,r=>ePe(r,e))}function ePe(t,e){let r=Fi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=XIe(e,n);if(i===0)return[];let o=_s([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=dY(e,a);if(!lY(c))continue;let l=uY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>YIe&&s.push({detector:vC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var vC,YIe,lS,SC=y(()=>{"use strict";$p();Ba();wt();vC="STALE_TESTS",YIe=30;lS={name:vC,run:QIe}});import{existsSync as tPe}from"node:fs";import{join as rPe}from"node:path";function nPe(t){let{cwd:e="."}=t;return ge(e,Lp,r=>iPe(r,e))}function iPe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:Lp,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!tPe(rPe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Lp,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:Lp,severity:Yl(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var Lp,uS,wC=y(()=>{"use strict";Xv();wt();Lp="STATUS_DRIFT";uS={name:Lp,run:nPe}});function oPe(t){let{cwd:e="."}=t;return ge(e,dS,r=>sPe(r,e))}function sPe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:dS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:dS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var dS,fY,pY=y(()=>{"use strict";an();wt();dS="TECH_STACK_MISMATCH";fY={name:dS,run:oPe}});function uPe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function dPe(t){let{cwd:e="."}=t;return ge(e,xC,r=>fPe(r,e))}function fPe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=_s([...uPe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:xC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var xC,mY,aPe,cPe,lPe,fS,$C=y(()=>{"use strict";$p();WP();wt();xC="UNMAPPED_ARTIFACT",mY=["src/stages/**/*.ts","src/spec/**/*.ts"],aPe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},cPe={kotlin:"src/main/kotlin"},lPe=8;fS={name:xC,run:dPe}});import{existsSync as hY}from"node:fs";import{join as gY}from"node:path";function mPe(t){return pPe.some(e=>t.startsWith(e))}function hPe(t){let{cwd:e="."}=t;return ge(e,kC,r=>gPe(r,e))}function gPe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(mPe(o))continue;let s=o.split("#",1)[0];hY(gY(e,o))||s&&hY(gY(e,s))||r.push({detector:kC,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`}function qx(t){return`${JSON.stringify(t,null,2)} +`}function gte(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${fte(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(pte);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(pte);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${fte(s)}.md`,`${a.join(` +`)}`)}return o}function pte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as yqe}from"node:fs";import{dirname as _qe,join as Pj}from"node:path";import{fileURLToPath as bqe}from"node:url";var Cj=_qe(bqe(import.meta.url));function yte(t){for(let e of[Pj(Cj,"viewer",t),Pj(Cj,"..","graph","viewer",t),Pj(Cj,"..","..","dist","viewer",t)])try{return yqe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function _te(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -901,21 +901,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}XP();hC();aC();lC();pC();YP();SC();wC();$C();EC();Qm();mC();Ue();var fqe=[tS,pS,eS,fS,nS,sS,Kv,uS,lS,Wv];function pqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Pp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Ux(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of fqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of pqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Pj();Ue();Ii();var hqe=new Set(["mermaid","dot","json","obsidian","html"]);function bte(t={}){try{let e=t.format??"mermaid";if(!hqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=wc(n,".");if(t.focus){let s=Nx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Dx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=hte(i);for(let[c,l]of a){let u=mqe(s,c);Cj(Nj(u),{recursive:!0}),Dj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=zx(i,Ux(i,"."));Cj(Nj(t.out),{recursive:!0}),Dj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?mte(i):r==="json"?Lx(i):pte(i);t.out?(Cj(Nj(t.out),{recursive:!0}),Dj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function vte(){try{let t=wc(q(),".");process.stdout.write(_te(qx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Qm();import{createServer as gqe}from"node:http";import{existsSync as yqe,watch as _qe}from"node:fs";import{join as bqe}from"node:path";Ue();Ii();function vqe(t={}){let e=t.cwd??".",r=new Set,n=()=>wc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}eC();yC();lC();dC();hC();QP();xC();$C();EC();TC();rh();gC();Ue();var vqe=[iS,gS,nS,hS,sS,lS,Xv,pS,fS,Yv];function Sqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Np().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Hx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of vqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of Sqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Dj();Ue();Pi();var xqe=new Set(["mermaid","dot","json","obsidian","html"]);function vte(t={}){try{let e=t.format??"mermaid";if(!xqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=xc(n,".");if(t.focus){let s=Fx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Mx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=gte(i);for(let[c,l]of a){let u=wqe(s,c);Nj(Mj(u),{recursive:!0}),jj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Bx(i,Hx(i,"."));Nj(Mj(t.out),{recursive:!0}),jj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?hte(i):r==="json"?qx(i):mte(i);t.out?(Nj(Mj(t.out),{recursive:!0}),jj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function Ste(){try{let t=xc(q(),".");process.stdout.write(bte(Gx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}rh();import{createServer as $qe}from"node:http";import{existsSync as kqe,watch as Eqe}from"node:fs";import{join as Aqe}from"node:path";Ue();Pi();function Tqe(t={}){let e=t.cwd??".",r=new Set,n=()=>xc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=gqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=Lx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Ux(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected +`)}catch{r.delete(u)}},o=$qe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=qx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Hx(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected -`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=zx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=bqe(e,u);if(yqe(d))try{let f=_qe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Bx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=Aqe(e,u);if(kqe(d))try{let f=Eqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Ste(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await vqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Sqe=["stage_1.1","stage_2.1","stage_2.3"];function wqe(t){return(t.features??[]).filter(e=>e.status==="done")}function xqe(t,e){let r=wqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function wte(t,e){let r=[];for(let n of Sqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=xqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}kS();import xte from"node:process";function $qe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Bx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=$qe(n,t);i.pass||r.push(i)}return r}ln();var jj="stage_4.1";function Mj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:jj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Bx(r);if(n.length===0)return{stage:jj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:jj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var kqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xte.argv[1]}`;if(kqe){let t=Mj();console.log(JSON.stringify(t)),xte.exit(t.exitCode)}xl();import{randomBytes as Eqe}from"node:crypto";import{unlinkSync as Aqe}from"node:fs";import{tmpdir as Tqe}from"node:os";import{join as Oqe,resolve as Fj}from"node:path";import Rqe from"node:process";var Br=null;function $te(t){Br={cwd:Fj(t),run:null,jsonFile:null}}function Lj(){return Br!==null}function zj(t,e){if(!Br||Br.cwd!==Fj(t))return null;if(Br.run)return Br.run;let r=Oqe(Tqe(),`clad-shared-vitest-${Rqe.pid}-${Eqe(6).toString("hex")}.json`);Br.jsonFile=r;let n=e(r);return Br.run={proc:n,jsonFile:r},Br.run}function kte(t){return!Br||Br.cwd!==Fj(t)?null:Br.run}function Uj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ete(){let t=Br?.jsonFile;if(Br=null,t)try{Aqe(t)}catch{}}Fr();import Ate from"node:process";var Hx="stage_1.4";function qj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Hx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Hx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Hx,pass:!0,exitCode:0}:{stage:Hx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var Iqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ate.argv[1]}`;if(Iqe){let t=qj();console.log(JSON.stringify(t)),Ate.exit(t.exitCode)}Fr();import Tte from"node:process";eh();Pn();var Gx="stage_2.2";function Bj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Yi("coverage",t))}catch(c){return{stage:Gx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Gx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=kte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Gx,r,s,n);return a||Yt(Gx,s)}var Dqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tte.argv[1]}`;if(Dqe){let t=Bj();console.log(JSON.stringify(t)),Tte.exit(t.exitCode)}Up();Hj();Fr();an();Pn();import Rte from"node:process";var Wx="stage_3.2";function Gj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Wx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Zl(e,o[o.length-1]))return{stage:Wx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Wx,i,s,o);return a||Yt(Wx,s)}var e4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(e4e){let t=Gj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Fr();Ue();Pn();import{existsSync as t4e}from"node:fs";import{resolve as Pte}from"node:path";import Cte from"node:process";var di="stage_2.4",Zj=5e3,r4e=3e4;function Vj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:di,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return i4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:di,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:di,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Pte(e,r.path);if(!t4e(s))return{stage:di,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Zj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(di,r.path,c);if(l)return l;if(c.timedOut)return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:di,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:di,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Ite={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},n4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function i4e(t,e,r){let n=Math.min(e.length*Zj,r4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(o4e(t,s,r))}return s4e(o)}function o4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Pte(t,a):a,u=Zj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function s4e(t){let e="skip";for(let o of t)Ite[o.disposition]>Ite[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${n4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:di,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:di,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var a4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(a4e){let t=Vj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}Fr();an();Pn();import Dte from"node:process";var Kx="stage_3.1";function Wj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Kx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Zl(e,o[o.length-1]))return{stage:Kx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Kx,i,s,o);return a||Yt(Kx,s)}var c4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Dte.argv[1]}`;if(c4e){let t=Wj();console.log(JSON.stringify(t)),Dte.exit(t.exitCode)}yC();Kj();Jj();Fr();Zx();import{randomBytes as h4e}from"node:crypto";import{unlinkSync as g4e}from"node:fs";import{tmpdir as y4e}from"node:os";import{join as _4e}from"node:path";import Xj from"node:process";eh();Pn();Ue();import{readFileSync as d4e}from"node:fs";import{resolve as Mte}from"node:path";function f4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Mte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function p4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function m4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=p4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Mte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Yj(t,e){try{let r=f4e(d4e(t,"utf8"));return r?m4e(q(e),r,e):[]}catch{return[]}}var Hr="stage_2.1";function Fte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Lte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function zte(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function b4e(t,e,r){let n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Fte(n,i))return null;let o=n,s=i,a=zj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Hr,n,c,s))return null;let u=Yt(Hr,c);if(Uj(u)==="fallback")return null;if(r){let d=Yj(l,e);if(d.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Hr,pass:!0,exitCode:0}}function v4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Yi("coverage",t))}catch{return null}if(!n||!i||!Lte(n,i))return null;let o=n,s=i,a=zj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Hr,o,a.proc,s))return null;let c=Yt(Hr,a.proc);if(Uj(c)==="fallback")return null;if(r&&zte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Hr,pass:!0,exitCode:0}}function Qj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Yi("test",t))}catch(d){return{stage:Hr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Hr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Fte(n,i),a=Lte(n,i),c=r&&s;if(Lj()&&s){let d=b4e(t,e,c);if(d)return d}if(Lj()&&a){let d=v4e(t,e);if(d)return d}let l,u=i;c&&(l=_4e(y4e(),`clad-vitest-${Xj.pid}-${h4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Hr,n,d,u);if(f)return f;let p=Nu("unit",Yt(Hr,d),d);if(r&&p.pass&&zte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Hr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Yj(l,e);if(m.length>0)return{stage:Hr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{g4e(l)}catch{}}}var S4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xj.argv[1]}`;if(S4e){let t=Qj();console.log(JSON.stringify(t)),Xj.exit(t.exitCode)}Fr();an();Pn();import Ute from"node:process";var Xx="stage_3.3";function eM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Zl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var w4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ute.argv[1]}`;if(w4e){let t=eM();console.log(JSON.stringify(t)),Ute.exit(t.exitCode)}bC();Uf();ba();rM();Op();iS();var Wte=St(er(),1);import{existsSync as nM,readFileSync as C4e,readdirSync as Vte,statSync as D4e,writeFileSync as N4e}from"node:fs";import{basename as oh,join as sh,relative as Zte}from"node:path";var j4e=["self-dogfood:","fixture:","derived:"],Kte=/\.(test|spec)\.[jt]sx?$/;function Jte(t,e=t,r=[]){let n;try{n=Vte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=sh(e,i);try{D4e(o).isDirectory()?Jte(t,o,r):Kte.test(i)&&r.push(o)}catch{continue}}return r}function Yte(t="."){let e=sh(t,"spec","features"),r=sh(t,"tests"),n=[],i=[];if(!nM(e)||!nM(r))return{repaired:n,suggested:i};let o=Jte(r),s=new Map;for(let a of o){let c=Zte(t,a).split("\\").join("/"),l=s.get(oh(a))??[];l.push(c),s.set(oh(a),l)}for(let a of Vte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=sh(e,a),l,u;try{l=C4e(c,"utf8"),u=(0,Wte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(j4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(nM(sh(t,b)))continue;let _=s.get(oh(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>oh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Zte(t,h).split("\\").join("/")).find(h=>{let g=oh(h).replace(Kte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function wte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Tqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Oqe=["stage_1.1","stage_2.1","stage_2.3"];function Rqe(t){return(t.features??[]).filter(e=>e.status==="done")}function Iqe(t,e){let r=Rqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function xte(t,e){let r=[];for(let n of Oqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=Iqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}TS();import $te from"node:process";function Pqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Zx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Pqe(n,t);i.pass||r.push(i)}return r}un();var Fj="stage_4.1";function Lj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Fj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Zx(r);if(n.length===0)return{stage:Fj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Fj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var Cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$te.argv[1]}`;if(Cqe){let t=Lj();console.log(JSON.stringify(t)),$te.exit(t.exitCode)}$l();import{randomBytes as Dqe}from"node:crypto";import{unlinkSync as Nqe}from"node:fs";import{tmpdir as jqe}from"node:os";import{join as Mqe,resolve as zj}from"node:path";import Fqe from"node:process";var Hr=null;function kte(t){Hr={cwd:zj(t),run:null,jsonFile:null}}function Uj(){return Hr!==null}function qj(t,e){if(!Hr||Hr.cwd!==zj(t))return null;if(Hr.run)return Hr.run;let r=Mqe(jqe(),`clad-shared-vitest-${Fqe.pid}-${Dqe(6).toString("hex")}.json`);Hr.jsonFile=r;let n=e(r);return Hr.run={proc:n,jsonFile:r},Hr.run}function Ete(t){return!Hr||Hr.cwd!==zj(t)?null:Hr.run}function Bj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ate(){let t=Hr?.jsonFile;if(Hr=null,t)try{Nqe(t)}catch{}}Lr();import Tte from"node:process";var Vx="stage_1.4";function Hj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Vx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Vx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Vx,pass:!0,exitCode:0}:{stage:Vx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Lqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tte.argv[1]}`;if(Lqe){let t=Hj();console.log(JSON.stringify(t)),Tte.exit(t.exitCode)}Lr();import Ote from"node:process";nh();Cn();var Wx="stage_2.2";function Gj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Wx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Wx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Ete(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Wx,r,s,n);return a||Yt(Wx,s)}var qqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ote.argv[1]}`;if(qqe){let t=Gj();console.log(JSON.stringify(t)),Ote.exit(t.exitCode)}Hp();Zj();Lr();cn();Cn();import Ite from"node:process";var Yx="stage_3.2";function Vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Yx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Yx,i,s,o);return a||Yt(Yx,s)}var c4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ite.argv[1]}`;if(c4e){let t=Vj();console.log(JSON.stringify(t)),Ite.exit(t.exitCode)}Lr();Ue();Cn();import{existsSync as l4e}from"node:fs";import{resolve as Cte}from"node:path";import Dte from"node:process";var fi="stage_2.4",Wj=5e3,u4e=3e4;function Kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return f4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Cte(e,r.path);if(!l4e(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Wj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Pte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},d4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function f4e(t,e,r){let n=Math.min(e.length*Wj,u4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(p4e(t,s,r))}return m4e(o)}function p4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Cte(t,a):a,u=Wj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ua(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function m4e(t){let e="skip";for(let o of t)Pte[o.disposition]>Pte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${d4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var h4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Dte.argv[1]}`;if(h4e){let t=Kj();console.log(JSON.stringify(t)),Dte.exit(t.exitCode)}Lr();cn();Cn();import Nte from"node:process";var Xx="stage_3.1";function Jj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var g4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Nte.argv[1]}`;if(g4e){let t=Jj();console.log(JSON.stringify(t)),Nte.exit(t.exitCode)}bC();Yj();Xj();Lr();Kx();import{randomBytes as x4e}from"node:crypto";import{unlinkSync as $4e}from"node:fs";import{tmpdir as k4e}from"node:os";import{join as E4e}from"node:path";import eM from"node:process";nh();Cn();Ue();import{readFileSync as b4e}from"node:fs";import{resolve as Fte}from"node:path";function v4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Fte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function S4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function w4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=S4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Fte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Qj(t,e){try{let r=v4e(b4e(t,"utf8"));return r?w4e(q(e),r,e):[]}catch{return[]}}var Gr="stage_2.1";function Lte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function zte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Ute(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function A4e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Lte(n,i))return null;let o=n,s=i,a=qj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Gr,n,c,s))return null;let u=Yt(Gr,c);if(Bj(u)==="fallback")return null;if(r){let d=Qj(l,e);if(d.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Gr,pass:!0,exitCode:0}}function T4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!zte(n,i))return null;let o=n,s=i,a=qj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Gr,o,a.proc,s))return null;let c=Yt(Gr,a.proc);if(Bj(c)==="fallback")return null;if(r&&Ute(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Gr,pass:!0,exitCode:0}}function tM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Gr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Gr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Lte(n,i),a=zte(n,i),c=r&&s;if(Uj()&&s){let d=A4e(t,e,c);if(d)return d}if(Uj()&&a){let d=T4e(t,e);if(d)return d}let l,u=i;c&&(l=E4e(k4e(),`clad-vitest-${eM.pid}-${x4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Gr,n,d,u);if(f)return f;let p=ju("unit",Yt(Gr,d),d);if(r&&p.pass&&Ute(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Qj(l,e);if(m.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{$4e(l)}catch{}}}var O4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${eM.argv[1]}`;if(O4e){let t=tM();console.log(JSON.stringify(t)),eM.exit(t.exitCode)}Lr();cn();Cn();import qte from"node:process";var t0="stage_3.3";function rM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Yt(t0,s)}var R4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${qte.argv[1]}`;if(R4e){let t=rM();console.log(JSON.stringify(t)),qte.exit(t.exitCode)}SC();Bf();ba();iM();Pp();aS();var Kte=St(er(),1);import{existsSync as oM,readFileSync as U4e,readdirSync as Wte,statSync as q4e,writeFileSync as B4e}from"node:fs";import{basename as ch,join as lh,relative as Vte}from"node:path";var H4e=["self-dogfood:","fixture:","derived:"],Jte=/\.(test|spec)\.[jt]sx?$/;function Yte(t,e=t,r=[]){let n;try{n=Wte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=lh(e,i);try{q4e(o).isDirectory()?Yte(t,o,r):Jte.test(i)&&r.push(o)}catch{continue}}return r}function Xte(t="."){let e=lh(t,"spec","features"),r=lh(t,"tests"),n=[],i=[];if(!oM(e)||!oM(r))return{repaired:n,suggested:i};let o=Yte(r),s=new Map;for(let a of o){let c=Vte(t,a).split("\\").join("/"),l=s.get(ch(a))??[];l.push(c),s.set(ch(a),l)}for(let a of Wte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=lh(e,a),l,u;try{l=U4e(c,"utf8"),u=(0,Kte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(H4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(oM(lh(t,b)))continue;let _=s.get(ch(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>ch(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Vte(t,h).split("\\").join("/")).find(h=>{let g=ch(h).replace(Jte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&N4e(c,l,"utf8")}return{repaired:n,suggested:i}}wl();import{existsSync as M4e,readFileSync as F4e}from"node:fs";import{join as L4e}from"node:path";function z4e(t,e){let r=L4e(t,e);if(!M4e(r))return[];let n=[];for(let i of F4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Xte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>z4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function Qte(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}aS();Ue();ln();Ii();ln();wl();var iM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],U4e=[...iM,"att"];function q4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Bx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function B4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":V_(e,r,t).state==="fresh"?"\u2713":"!"}function r0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...iM.map(o=>q4e(i,o,e)),B4e(i,r,e)]}));return{columns:U4e,rows:n}}function ere(t,e=".",r={}){let n=r.internal??!1,i=r0(t,e),o=[...iM.map(c=>n?c.replace("stage_",""):H4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function H4e(t){return Ta(t).slice(0,3)}async function y5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(hde(),mde)),Promise.resolve().then(()=>(vde(),bde)),Promise.resolve().then(()=>(rm(),R7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ote(s),prepareInit:({cwd:s,mode:a,intent:c})=>nte(s,a,c),initialize:bj,prepareClarify:(s,{cwd:a})=>ite(a,s),clarify:xj,resolveReview:(s,{cwd:a})=>Qee(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function _5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await bj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&B4e(c,l,"utf8")}return{repaired:n,suggested:i}}xl();import{existsSync as G4e,readFileSync as Z4e}from"node:fs";import{join as V4e}from"node:path";function W4e(t,e){let r=V4e(t,e);if(!G4e(r))return[];let n=[];for(let i of Z4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Qte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>W4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function ere(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}uS();Ue();un();Pi();un();xl();var sM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],K4e=[...sM,"att"];function J4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Y4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":J_(e,r,t).state==="fresh"?"\u2713":"!"}function o0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...sM.map(o=>J4e(i,o,e)),Y4e(i,r,e)]}));return{columns:K4e,rows:n}}function tre(t,e=".",r={}){let n=r.internal??!1,i=o0(t,e),o=[...sM.map(c=>n?c.replace("stage_",""):X4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function X4e(t){return Ta(t).slice(0,3)}async function k5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(gde(),hde)),Promise.resolve().then(()=>(Sde(),vde)),Promise.resolve().then(()=>(om(),I7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ste(s),prepareInit:({cwd:s,mode:a,intent:c})=>ite(s,a,c),initialize:Sj,prepareClarify:(s,{cwd:a})=>ote(a,s),clarify:kj,resolveReview:(s,{cwd:a})=>ete(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function E5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Sj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} `),G.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){G.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())G.stdout.write(` ${o+1}. ${s} @@ -926,32 +926,32 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&N4e(c,l,"u `),G.stdout.write(` e.g. clad init payment SaaS for B2B `),G.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));G.exit(0)}async function b5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Gde(),Hde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>lR(l,s)),c=`${bG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function v5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Jl(".",r),Wa("."),Z5(".");let n=ou(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Yte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=t0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=cS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function S5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=R_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function w5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=I_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}P_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} +`));G.exit(0)}async function A5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Zde(),Gde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>uR(l,s)),c=`${SG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function T5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Yl(".",r),Ka("."),V5(".");let n=su(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Xte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=i0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=dS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function O5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=C_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function R5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=D_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}N_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} `):G.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),G.exit(0)}async function x5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await XC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function $5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await e7(".",{wireHosts:async()=>(await XC({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` +`),G.exit(0)}async function I5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await eD({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function P5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await t7(".",{wireHosts:async()=>(await eD({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),TA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var k5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function TA(t){let e=t.tier??"all",r=t.silent===!0,n=k5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>nh(i)],["stage_1.2",()=>rh(i)],["stage_1.3",()=>oi({...i,strict:t.strict})],["stage_1.4",qj],["stage_1.5",rc],["stage_1.6",Jp],["stage_2.1",()=>Qj({...i,strict:t.strict})],["stage_2.2",()=>Bj(i)],["stage_2.3",gC],["stage_2.4",Vj],["stage_3.1",Wj],["stage_3.2",Gj],["stage_3.3",eM],["stage_4.1",Mj],["stage_4.2",ih]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ci(d)?"fail":"skip",u=[];W_("."),$te(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=UX(p);ci(h)&&(c=!0,a=Math.max(a,qX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),ci(h)&&C5e(p))}}finally{J_(),Ete()}if(t.strict)try{let d=q();for(let f of wte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!ci(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>ci(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{BG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function E5e(t){try{let e=q(),r=ml(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} -`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function A5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} -`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function T5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=mS(e,o=>{try{return Vde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function O5e(t={}){try{if(t.sessions){cte(t);return}if(t.trend!==void 0&&t.trend!==!1){lte(t);return}let e=q(),n=FH(e,o=>{try{return Vde(o,"utf8")}catch{return null}},"."),i=zH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${hl}`];G.stdout.write(`${c.join(` +`),IA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var C5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function IA(t){let e=t.tier??"all",r=t.silent===!0,n=C5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>sh(i)],["stage_1.2",()=>oh(i)],["stage_1.3",()=>si({...i,strict:t.strict})],["stage_1.4",Hj],["stage_1.5",nc],["stage_1.6",Qp],["stage_2.1",()=>tM({...i,strict:t.strict})],["stage_2.2",()=>Gj(i)],["stage_2.3",_C],["stage_2.4",Kj],["stage_3.1",Jj],["stage_3.2",Vj],["stage_3.3",rM],["stage_4.1",Lj],["stage_4.2",ah]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":li(d)?"fail":"skip",u=[];Y_("."),kte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=qX(p);li(h)&&(c=!0,a=Math.max(a,BX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),li(h)&&U5e(p))}}finally{Q_(),Ate()}if(t.strict)try{let d=q();for(let f of xte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!li(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>li(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{GG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function D5e(t){try{let e=q(),r=hl(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} +`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function N5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} +`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function j5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=yS(e,o=>{try{return Wde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function M5e(t={}){try{if(t.sessions){lte(t);return}if(t.trend!==void 0&&t.trend!==!1){ute(t);return}let e=q(),n=zH(e,o=>{try{return Wde(o,"utf8")}catch{return null}},"."),i=qH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${gl}`];G.stdout.write(`${c.join(` `)} -`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function R5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=TA({...t,focusModules:e});if(!t.json){let n=SX(".");n&&G.stdout.write(`\u2139 ${n} -`)}G.exitCode=r.worst}function I5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=dX(".",t,{checkStages:TA,onIndex:Wa,gitOpInProgress:OO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function P5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=Y5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function F5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=IA({...t,focusModules:e});if(!t.json){let n=wX(".");n&&G.stdout.write(`\u2139 ${n} +`)}G.exitCode=r.worst}function L5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=fX(".",t,{checkStages:IA,onIndex:Ka,gitOpInProgress:PO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function z5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=X5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),G.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";G.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}G.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Xte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${Qte(i)} -`),G.exit(0)}function C5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Zde(vl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] +`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Qte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${ere(i)} +`),G.exit(0)}function U5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Vde(Sl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&G.stdout.write(` \u2026 and ${n.length-3} more finding(s) `),t.hint&&G.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Zde(e.trim(),160)} -`)}}function Zde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function D5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(r0(e,"."),null,2)} -`),G.exitCode=0;return}G.stdout.write(`${ere(e,".",{internal:t.internal})} -`),G.exit(0)}function N5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function j5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=r0(i,e),s={gitHead:Sa(e),version:tu(),generatedAt:t.now??new Date().toISOString()},a=_l(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:gl(u),auditMarkdown:yl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{g5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${N5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function M5e(t){let e=VA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function F5e(){let t=new T4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(_5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(b5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(v5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(x5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action($5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(R5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(S5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(I5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>P5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(w5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(D5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(E5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>A5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>KX(r,{checkStages:TA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>T5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>O5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>bte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>vte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{Ste(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>_G(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>PY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>j5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(M5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(zX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(y5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){aX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}NY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(rte),t}var L5e=!!globalThis.__CLADDING_BUNDLED,z5e=L5e||import.meta.url===`file://${G.argv[1]}`;z5e&&F5e().parse();export{k5e as TIER_STAGES,F5e as createProgram,j5e as runBundleCommand,R5e as runCheckCommand,TA as runCheckStages,S5e as runCheckpointCommand,E5e as runContextCommand,I5e as runDoneCommand,A5e as runImpactCommand,T5e as runInferDepsCommand,_5e as runInitCommand,O5e as runMeasureCommand,P5e as runOracleCommand,w5e as runRollbackCommand,M5e as runRouteCommand,b5e as runRunCommand,y5e as runServeCommand,x5e as runSetupCommand,D5e as runStatusCommand,v5e as runSyncCommand,$5e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Vde(e.trim(),160)} +`)}}function Vde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function q5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} +`),G.exitCode=0;return}G.stdout.write(`${tre(e,".",{internal:t.internal})} +`),G.exit(0)}function B5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function H5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=bl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:yl(u),auditMarkdown:_l(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=DG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{$5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${B5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function G5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function Z5e(){let t=new R4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(E5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(A5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(T5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(I5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(P5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(F5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(O5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(L5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>z5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(R5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(q5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(D5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>N5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>JX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>j5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>M5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>vte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Ste()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{wte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>vG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>CY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>H5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(G5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(UX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(k5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){cX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}jY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(nte),t}var V5e=!!globalThis.__CLADDING_BUNDLED,W5e=V5e||import.meta.url===`file://${G.argv[1]}`;W5e&&Z5e().parse();export{C5e as TIER_STAGES,Z5e as createProgram,H5e as runBundleCommand,F5e as runCheckCommand,IA as runCheckStages,O5e as runCheckpointCommand,D5e as runContextCommand,L5e as runDoneCommand,N5e as runImpactCommand,j5e as runInferDepsCommand,E5e as runInitCommand,M5e as runMeasureCommand,z5e as runOracleCommand,R5e as runRollbackCommand,G5e as runRouteCommand,A5e as runRunCommand,k5e as runServeCommand,I5e as runSetupCommand,q5e as runStatusCommand,T5e as runSyncCommand,P5e as runUpdateCommand}; diff --git a/spec/attestation.yaml b/spec/attestation.yaml index a8f18b1b..d5f5c1d8 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -17,15 +17,15 @@ attested_modules: .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: af69d16f2b298b79 + CHANGELOG.md: a67e4c092a7223c1 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: b54da47187e0d23a - README.ja.md: f69f828a85166942 - README.ko.html: c234b7f20cfd0941 - README.ko.md: 10e6fd0dded8af59 - README.md: 92ebf6ffccbb27e6 - README.zh.md: 56bf8c47e2a979a4 + README.html: cd57c4adbf63c21f + README.ja.md: 0b9ae54836f7c7c5 + README.ko.html: c90c121ff05543e2 + README.ko.md: 201d815f50b9a5c8 + README.md: 0f3ff03524db0951 + README.zh.md: 07f985aed7eb3304 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -56,7 +56,7 @@ attested_modules: docs/dogfood/cursor-agent-2026-07-15.md: a2f621fd0c3b57af docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: e1847cc9fe9b6eb6 - docs/glossary.md: 9e897b963c3aa88f + docs/glossary.md: fc7258d4d3dcb9a2 docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/independence.svg: 1b3048b3b5206483 docs/img/en/relationship.svg: c7a24203925b4664 @@ -163,7 +163,7 @@ attested_modules: src/cli/init.ts: 91cf7be2b7427fbf src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 - src/cli/report.ts: dc5233ffb3398cdc + src/cli/report.ts: ee7d35b6c36dfa76 src/cli/scan/architecture.ts: c9cfd5445ea77e45 src/cli/scan/conventions.ts: 577468c0fc3fdf6a src/cli/scan/dispatcher.ts: 97bd3f12cece4fc4 @@ -228,9 +228,9 @@ attested_modules: src/oracle/payload.ts: 0171633d758ceed8 src/oracle/policy.ts: 8919ad927bd59b08 src/oracle/record.ts: 0b9c124225abe1ac - src/report/ac-delta.ts: d5f219cee7691d01 + src/report/ac-delta.ts: 18ba218cebf5b6f1 src/report/bundle.ts: f8a2fb6c2d02326f - src/report/report.ts: 01bcc88dc44e77f6 + src/report/report.ts: f6f6f8bdb679b702 src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 @@ -317,7 +317,7 @@ attested_modules: src/stages/spec-conformance.ts: 1e9b052a2a268d7a src/stages/test-run-cache.ts: 462a5ef1d30eb766 src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e - src/stages/toolchain/detect.ts: 630d123781c6d49c + src/stages/toolchain/detect.ts: 1fa0f54b90c9494d src/stages/toolchain/gate-config.ts: 818a0a549d875581 src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 @@ -425,7 +425,7 @@ attested_modules: tests/stages/stale-tests.test.ts: 1467ceedb8019e86 tests/stages/status-drift.test.ts: cff1092eeb23c268 tests/stages/tech-stack-mismatch.test.ts: 878436ffd2f94c97 - tests/stages/toolchain.test.ts: e5b26494c00782f5 + tests/stages/toolchain.test.ts: 958add1f40d1f06d tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 diff --git a/spec/features/arch-gate-skips-build-output-2c02991f.yaml b/spec/features/arch-gate-skips-build-output-2c02991f.yaml index 6b5d0158..981fecfa 100644 --- a/spec/features/arch-gate-skips-build-output-2c02991f.yaml +++ b/spec/features/arch-gate-skips-build-output-2c02991f.yaml @@ -8,9 +8,9 @@ acceptance_criteria: - id: AC-caa9471d ears: event condition: "when the TypeScript or JavaScript architecture gate is composed for a project" - text: "When the TypeScript or JavaScript architecture gate is composed for a project, then the system shall exclude generated build-output directories from the circular-dependency scan." + text: "When the TypeScript or JavaScript architecture gate is composed for a project, then the system shall exclude generated build-output directories from the circular-dependency scan — the unambiguous ones at any depth, and the ones whose names also occur as real source directories at the repository root only." test_refs: ["tests/stages/toolchain.test.ts"] - notes: "WHY: a bundler's output legitimately contains mutual imports, so scanning it reports cycles that exist in no hand-written file. Measured on a live adopter: five recorded hard-blocking gate failures, all five inside a version-ignored bundle — 100% false with respect to source. The adopter's recorded root cause was wrong and the issue stayed open for sixteen days. A second adopter reproduces the same shape today, four for four." + notes: "WHY: a bundler's output legitimately contains mutual imports, so scanning it reports cycles that exist in no hand-written file. Measured on a live adopter: five recorded hard-blocking gate failures, all five inside a version-ignored bundle — 100% false with respect to source. The adopter's recorded root cause was wrong and the issue stayed open for sixteen days.\n\nWHY THE TWO DEPTHS: excluding `build`, `out` or `target` at any depth would drop hand-written code from the scan, and a false negative is worse than the false RED this fixes. `dist`, `coverage` and the framework caches carry no such risk — no repository on hand commits source under them — and anchoring THEM at the root left a monorepo package or a front-end subdirectory (`frontend/dist`) still blocking.\n\nHONEST SCOPE OF THE MEASUREMENT: the four-cycles-to-zero figure was taken by running the scanner directly in a front-end subdirectory that is not itself a gate root, so it corroborates the pattern rather than measuring gate impact. On the gate roots on record the fix removes no findings today — cladding is already clean, and the adopter that filed the issue has its own scanner config, which makes cladding stand down there by design." - id: AC-554d9436 ears: unwanted condition: "if the project declares its own dependency-scanner configuration" diff --git a/spec/features/review-packet-ac-delta-5dfbac9c.yaml b/spec/features/review-packet-ac-delta-5dfbac9c.yaml index 9777ee50..67b871e1 100644 --- a/spec/features/review-packet-ac-delta-5dfbac9c.yaml +++ b/spec/features/review-packet-ac-delta-5dfbac9c.yaml @@ -16,7 +16,7 @@ acceptance_criteria: notes: "WHY: the changelog collector is a SHIPPED filter — it keeps only done/archived transitions and drops planned/in_progress outright. Measured on a live corpus, 74% of the range's spec entries fell into that hole, which would make two of the three new sections structurally unbuildable." - id: AC-c32cbab2 ears: ubiquitous - text: "The system shall classify each acceptance criterion in the range as new, rewritten, removed, or unchanged by joining the base and head revisions on the criterion id, counting a difference in text, EARS pattern, or condition as a rewrite and ignoring differences that are only whitespace." + text: "The system shall classify each acceptance criterion in the range as new, rewritten, removed, or unchanged by joining the base and head revisions on the criterion id, counting a difference in any field that states the obligation — the statement, the EARS pattern, the trigger condition, the action, or the response — as a rewrite, and ignoring differences that are only whitespace." test_refs: ["tests/report/ac-delta.test.ts"] notes: "WHY: a criterion keeps its id across a rewrite — verified on a live reversal where the text flipped polarity while the id held — so the id is a sound join key and the rewrite is invisible to any check that only compares code against the current spec." - id: AC-1a6cb22f diff --git a/src/cli/report.ts b/src/cli/report.ts index 5e5fc96c..5c70e6b9 100644 --- a/src/cli/report.ts +++ b/src/cli/report.ts @@ -4,7 +4,8 @@ // rendering lives in the pure foundation layer src/report/. It composes, for a // `..HEAD` range: // -// • spec-shard movement — from the changelog collector +// • spec entry movement — from the changelog collector +// • acceptance-criterion deltas — each criterion at both revisions // • changed source → owning feats — each changed file resolved via the // reverse index's blast-radius slice // • the regression set — deduped union of test_refs across slices @@ -18,6 +19,8 @@ // 1 any other failure. import {execFileSync} from 'node:child_process'; +import {existsSync} from 'node:fs'; +import {join} from 'node:path'; import process from 'node:process'; import { @@ -25,8 +28,9 @@ import { collectSpecEntryRevisions, defaultSinceRef, type ChangelogManifest, + type SpecEntryRevision, } from '../changelog/collect.js'; -import {mergeBaseWithHead, refExists} from '../core/git-ops.js'; +import {mergeBaseWithHead, refExists, resolveRefToCommit} from '../core/git-ops.js'; import {latestEventOfType} from '../events/log.js'; import {buildImpactSlice, ledgerOf} from '../optimizer/reverse-slice.js'; import { @@ -40,7 +44,7 @@ import { import {toSarif} from '../report/sarif.js'; import {attestedFeatureCount, readAttestation} from '../spec/attestation.js'; import {loadSpec} from '../spec/load.js'; -import {reverseIndexOf} from '../spec/reverse-index.js'; +import {reverseIndexOf, testRefPath} from '../spec/reverse-index.js'; import type {Feature, Spec} from '../spec/types.js'; import {runDrift} from '../stages/drift.js'; import {pulse} from '../ui/pulse.js'; @@ -114,6 +118,28 @@ function changedPaths(cwd: string, baseRef: string): readonly string[] { ].sort((a, b) => a.localeCompare(b)); } +/** + * Declared test paths of the touched entries that have no file behind them. + * + * Existence is impure, so it is resolved here and handed to the pure model as + * data. It matters because every sibling existence check in the harness is + * done-only: for a planned or in-progress entry this section is the only place + * a dangling reference is visible at all, and calling it "unchanged" would read + * as a real test that merely did not move. + */ +function absentTestRefs(cwd: string, entries: readonly SpecEntryRevision[]): readonly string[] { + const missing = new Set(); + for (const entry of entries) { + for (const ac of entry.headAcs) { + for (const ref of ac.test_refs ?? []) { + const p = testRefPath(ref); + if (p !== null && !existsSync(join(cwd, p))) missing.add(p); + } + } + } + return [...missing].sort((a, b) => a.localeCompare(b)); +} + /** Resolves an owning-feature id to its title + slug from the spec. */ function ownerOf(id: string, byId: ReadonlyMap): OwningFeature { const f = byId.get(id); @@ -157,13 +183,15 @@ function gatherInputs( return {path, owners, testRefs: slice.test_refs}; }); + const specEntries = collectSpecEntryRevisions(cwd, baseRef); return { specChanges: manifest, codeChanges, ledgerEmpty, gate: gatherGateState(cwd), - specEntries: collectSpecEntryRevisions(cwd, baseRef), + specEntries, changedPaths: allChanged, + missingTestRefs: absentTestRefs(cwd, specEntries), }; } @@ -205,13 +233,19 @@ export function runReportCommand(opts: ReportCommandOptions): void { // helper falls back to the ref itself and the packet still renders // (AC-4b6fe145). const baseRef = mergeBaseWithHead(cwd, sinceRef); + // Disclose the base only when it is a DIFFERENT commit from the one the + // reader named. `resolveRefToCommit` peels annotated tags, so this is a + // commit-to-commit comparison — comparing the ref NAME to a sha would + // announce a difference on every linear range. + const sinceSha = resolveRefToCommit(cwd, sinceRef); + const disclosedBase = sinceSha !== null && sinceSha !== baseRef ? baseRef : undefined; const manifest = collectChangelog(cwd, baseRef); const spec = loadSpec(cwd); const model = buildReportModel(gatherInputs(cwd, spec, baseRef, manifest)); out = format === 'json' ? `${JSON.stringify({since: sinceRef, base: baseRef, head: manifest.head, ...model}, null, 2)}\n` - : `${renderReportMarkdown(model, {sinceRef, baseSha: baseRef, head: manifest.head})}\n`; + : `${renderReportMarkdown(model, {sinceRef, ...(disclosedBase ? {baseSha: disclosedBase} : {}), head: manifest.head})}\n`; } // Set exitCode and let the event loop DRAIN stdout instead of process.exit(): // the packet can exceed the 64KB pipe buffer, and a forced exit truncates a diff --git a/src/report/ac-delta.ts b/src/report/ac-delta.ts index bf63ba99..4c3581b9 100644 --- a/src/report/ac-delta.ts +++ b/src/report/ac-delta.ts @@ -64,14 +64,29 @@ function norm(value: string | undefined): string { const FIELD_SEPARATOR = '\u0000'; /** - * The comparison key for a criterion: its statement, its EARS pattern, and its - * trigger condition. Those three are the contract. `notes` is deliberately - * EXCLUDED — it is the free-prose field authors actually use, and treating an - * expanded rationale as a contract rewrite would make the signal fire on the - * one habit worth encouraging. + * The comparison key for a criterion: every field that states the obligation — + * the pre-rendered statement, the EARS pattern, and the structured trigger / + * action / outcome. + * + * `action` and `response` are not decoration. The impl-blind oracle renders + * `action` as "system shall:" (src/oracle/payload.ts), and AC_DRIFT accepts a + * criterion carrying only these fields as fully specified — so a criterion may + * have no `text` at all and still state a complete requirement. Comparing only + * text/ears/condition made this section blind to a rewrite of the obligation + * itself, which is precisely the change it exists to surface. + * + * `notes` stays EXCLUDED — it is the free-prose field authors actually use, and + * treating an expanded rationale as a contract rewrite would make the signal + * fire on the one habit worth encouraging. */ function contractKey(ac: AcceptanceCriterion): string { - return [norm(ac.text), norm(ac.ears), norm(ac.condition)].join(FIELD_SEPARATOR); + return [ + norm(ac.text), + norm(ac.ears), + norm(ac.condition), + norm(ac.action), + norm(ac.response), + ].join(FIELD_SEPARATOR); } function byId(acs: readonly AcceptanceCriterion[]): Map { diff --git a/src/report/report.ts b/src/report/report.ts index 272b2a2d..a630aa03 100644 --- a/src/report/report.ts +++ b/src/report/report.ts @@ -3,7 +3,7 @@ // A reviewer, team-lead, or auditor opening a pull request wants ONE artifact // that answers "what moved, who owns it, what must I re-run, and was it // verified?" — without walking the spec tree. This module renders that packet -// from data the CLI composes: the changelog collector's spec-shard movement, +// from data the CLI composes: the changelog collector's spec entry movement, // each changed source file resolved to its owning feature(s) via the reverse // index, the deduped regression set (union of test_refs across the impact // slices), and the gate + attestation state. @@ -11,9 +11,9 @@ // It RENDERS; it gates nothing. The gate stays in `clad check`. // // DETERMINISM (AC-cbf1c202): every collection is sorted, and the body carries -// NO wall-clock — the meta range + HEAD sha are the only variable inputs and -// they are stable for a fixed repository state, so two runs serialize -// byte-identically. That is the property that makes the packet auditable. +// NO wall-clock — the meta range, the resolved base and the HEAD sha are the +// only variable inputs, and all three are stable for a fixed repository state, +// so two runs serialize byte-identically. That is what makes the packet auditable. // // HONEST UNDER-REPORTING (AC-7672ce5d): a changed source file that maps to no // feature's `modules` is listed under Unowned changes, never silently dropped — @@ -61,8 +61,15 @@ export interface GateStateInput { } | null; } -/** Whether an acceptance criterion's declared test moved with the code. */ -export type TestRefState = 'co-changed' | 'unchanged' | 'placeholder'; +/** + * Whether an acceptance criterion's declared test moved with the code. + * + * `missing` is separate from `unchanged` on purpose: a path with no file behind + * it did not "stay put", it was never there. Every sibling existence check in + * the harness is done-only, so this status-blind section is the only surface + * that speaks for planned and in-progress entries. + */ +export type TestRefState = 'co-changed' | 'unchanged' | 'missing' | 'placeholder'; /** One declared test reference of one criterion, and how it fared in the range. */ export interface TestRefRow { @@ -84,6 +91,8 @@ export interface ReportInputs { readonly specEntries?: readonly SpecEntryRevision[]; /** Every path that changed in the range — the co-change oracle. */ readonly changedPaths?: readonly string[]; + /** Declared test paths with no file on disk; the CLI resolves existence. */ + readonly missingTestRefs?: readonly string[]; } /** The deterministic, fully-sorted review-packet model. */ @@ -109,13 +118,13 @@ export interface ReportMeta { /** Full HEAD sha (from `git rev-parse HEAD`); deterministic for a fixed state. */ readonly head: string; /** - * The commit the packet actually compared against — the merge base of - * `sinceRef` and HEAD, or `sinceRef` itself when no merge base resolves. + * The commit the packet compared against, set ONLY when it differs from the + * commit `sinceRef` names — the CLI resolves both and decides, because only + * it can peel a ref to a sha (an annotated tag is not its own commit). * - * It is stamped because it can DIFFER from what the reader asked for: on a - * branch that forked earlier, the named tag can sit several commits off the - * fork point. An audit artifact that does not name the revision it audited - * against cannot be reproduced by hand. + * When present it is rendered: an audit artifact that silently audited a + * different revision than the reader asked for cannot be reproduced by hand. + * When absent the two are the same commit and there is nothing to disclose. */ readonly baseSha?: string; } @@ -147,7 +156,7 @@ function normalizeOwners(owners: readonly OwningFeature[]): readonly OwningFeatu * deduped regression set. Pure — no I/O, no clock. */ /** - * Resolves each declared test reference of the touched entries to one of three + * Resolves each declared test reference of the touched entries to one of four * states. * * The third state is load-bearing. `clad sync` writes `derived:` refs into @@ -159,14 +168,23 @@ function normalizeOwners(owners: readonly OwningFeature[]): readonly OwningFeatu function buildTestRefRows( entries: readonly SpecEntryRevision[], changed: ReadonlySet, + missing: ReadonlySet, ): readonly TestRefRow[] { const rows: TestRefRow[] = []; for (const entry of entries) { for (const ac of entry.headAcs) { for (const ref of ac.test_refs ?? []) { const path = testRefPath(ref); + // Existence first: a path that resolves to nothing cannot have moved, + // and calling it co-changed or unchanged both overstate what is known. const state: TestRefState = - path === null ? 'placeholder' : changed.has(path) ? 'co-changed' : 'unchanged'; + path === null + ? 'placeholder' + : missing.has(path) + ? 'missing' + : changed.has(path) + ? 'co-changed' + : 'unchanged'; rows.push({featureId: entry.id, acId: ac.id, ref, state}); } } @@ -206,7 +224,7 @@ export function buildReportModel(inputs: ReportInputs): ReportModel { ledgerEmpty: inputs.ledgerEmpty, gate: inputs.gate, specEntryDeltas: buildSpecEntryDeltas(specEntries), - testRefRows: buildTestRefRows(specEntries, changed), + testRefRows: buildTestRefRows(specEntries, changed, new Set(inputs.missingTestRefs ?? [])), }; } @@ -331,7 +349,7 @@ function renderTestRefs(model: ReportModel): string { } lines.push( '', - '_`changed` = the named file also moved in this range. `unchanged` = declared, untouched. `no file` = a placeholder the harness suggested, not a test that exists._', + '_`changed` = the named file also moved in this range. `unchanged` = declared, untouched. `absent` = a concrete path with no file behind it. `no file` = a placeholder the harness suggested, not a test that exists._', '', ); let current = ''; @@ -341,7 +359,13 @@ function renderTestRefs(model: ReportModel): string { lines.push(`- ${row.featureId}`); } const label = - row.state === 'co-changed' ? 'changed' : row.state === 'unchanged' ? 'unchanged' : 'no file'; + row.state === 'co-changed' + ? 'changed' + : row.state === 'unchanged' + ? 'unchanged' + : row.state === 'missing' + ? 'absent' + : 'no file'; lines.push(` - ${row.acId} · ${row.ref} — ${label}`); } return lines.join('\n'); @@ -380,13 +404,12 @@ function renderGate(gate: GateStateInput): string { */ export function renderReportMarkdown(model: ReportModel, meta: ReportMeta): string { const shortHead = meta.head.slice(0, 12); - // Name the revision actually compared against when it is not the ref the - // reader named — otherwise reproducing the packet by hand silently uses a - // different base. - const base = - meta.baseSha && !meta.baseSha.startsWith(meta.sinceRef) && meta.sinceRef !== meta.baseSha - ? [`_Compared against ${meta.baseSha.slice(0, 12)} — the merge base of ${meta.sinceRef} and HEAD._`, ''] - : []; + // Present iff the CLI resolved a base that is NOT the commit `sinceRef` + // names. Comparing here is impossible: a ref name and a sha are different + // kinds of thing, and only git can tell whether they denote the same commit. + const base = meta.baseSha + ? [`_Compared against ${meta.baseSha.slice(0, 12)} — the merge base of ${meta.sinceRef} and HEAD._`, ''] + : []; return [ `# Review packet — ${meta.sinceRef}..${shortHead}`, '', diff --git a/src/stages/toolchain/detect.ts b/src/stages/toolchain/detect.ts index 862c25e6..774f7326 100644 --- a/src/stages/toolchain/detect.ts +++ b/src/stages/toolchain/detect.ts @@ -13,7 +13,8 @@ import {existsSync, readFileSync, readdirSync} from 'node:fs'; import type {Dirent} from 'node:fs'; -import {join} from 'node:path'; +import {dirname, join, resolve} from 'node:path'; +import process from 'node:process'; import {kotlinCoverageTask} from './coverage-tool.js'; import type {Language, Toolchain, ToolchainGates, ToolSpec} from './types.js'; @@ -373,18 +374,88 @@ const ESLINT_CONFIGS: readonly string[] = [ * adopter this blocked the gate five times, every one of them inside a version-ignored * bundle; the recorded root cause was wrong and the issue stayed open for sixteen days. * - * Anchored at the repository root (`^`) so a source directory that merely happens to be - * named `build/` deeper in the tree is still scanned. + * Two anchorings, because the names differ in how ambiguous they are: + * + * - `dist`, `coverage` and the framework caches are excluded at ANY depth. A + * monorepo package or a front-end subdirectory keeps its bundle one level down + * (`frontend/dist`), and a root-only anchor left exactly those still blocking + * the gate. No repository on hand commits hand-written source under these names. + * - `build`, `out` and `target` stay anchored at the repository root: they DO name + * real source directories often enough (`src/build/…`) that excluding them at + * depth would silently drop hand-written code from the scan — a false negative, + * which is the one outcome worse than a false RED. */ const BUILD_OUTPUT_EXCLUDE = - '^(dist|build|out|coverage|target|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/'; + '(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/'; + +/** + * Every path madge's config loader consults, in its own order. + * + * Read off `rc` (madge/bin/cli.js:7) rather than assumed: `/etc/madge/config` + * and `/etc/madgerc` on POSIX, four `$HOME` locations, then the EXACT name + * `.madgerc` walked upward from cwd to the filesystem root. Only that one + * filename is ever read — `.madgerc.json` / `.js` / `.yaml` are not madge + * config at all, and treating them as such silently disabled the exclusion. + */ +function madgeConfigPaths(cwd: string): readonly string[] { + const paths: string[] = []; + const win = process.platform === 'win32'; + if (!win) paths.push(join('/etc', 'madge', 'config'), join('/etc', 'madgerc')); + const home = win ? process.env.USERPROFILE : process.env.HOME; + if (home) { + paths.push( + join(home, '.config', 'madge', 'config'), + join(home, '.config', 'madge'), + join(home, '.madge', 'config'), + join(home, '.madgerc'), + ); + } + // The upward walk is the half a cwd-only check misses — and missing it is the + // damaging direction: we would send `--exclude`, madge would REPLACE the + // user's rules with ours, and cycles they had suppressed would block the gate. + for (let dir = resolve(cwd); ; ) { + paths.push(join(dir, '.madgerc')); + const parent = dirname(dir); + if (parent === dir) break; + dir = parent; + } + const envConfig = process.env.MADGE_config ?? process.env.madge_config; + if (envConfig) paths.push(envConfig); + return paths; +} /** - * Files that mean "this project configures the dependency scanner itself". - * `rc` resolves `.madgerc` and its typed variants; `package.json#madge` is the - * inline form. + * True when this config file actually puts an exclusion in force. + * + * Presence is not enough: an empty `.madgerc`, or one carrying only + * `detectiveOptions` (madge's own README recipe), configures no exclusion — so + * standing down for it would leave build output blocking the gate while + * cladding believed the project had it handled. + * + * A file we cannot parse (rc also accepts ini) returns true: we do not guess + * against a user's config, and standing down only restores the prior behavior. */ -const MADGE_CONFIGS: readonly string[] = ['.madgerc', '.madgerc.json', '.madgerc.js', '.madgerc.yaml', '.madgerc.yml']; +function declaresMadgeExclude(file: string): boolean { + let body: string; + try { + body = readFileSync(file, 'utf8'); + } catch { + return true; + } + try { + return (JSON.parse(body) as {excludeRegExp?: unknown}).excludeRegExp !== undefined; + } catch { + return true; + } +} + +/** True when the project itself has a madge exclusion in force. */ +function madgeExclusionInForce(cwd: string, pkg: PackageManifest): boolean { + // `package.json#madge` is read from cwd only (madge/bin/cli.js:63) — no walk. + const inline = pkg.madge as {excludeRegExp?: unknown} | undefined; + if (inline && typeof inline === 'object' && inline.excludeRegExp !== undefined) return true; + return madgeConfigPaths(cwd).some((p) => existsSync(p) && declaresMadgeExclude(p)); +} /** Reads package.json once for gate refinement; malformed input declares nothing. */ function readPackageManifest(cwd: string): PackageManifest { @@ -412,10 +483,15 @@ function hasPackageDependency(pkg: PackageManifest, name: string): boolean { * configures the scanner itself (AC-caa9471d, AC-554d9436). * * The guard is not politeness — madge REPLACES its configured `excludeRegExp` - * with the command-line flag rather than merging the two. Passing ours - * unconditionally would silently delete an adopter's own rules, including the - * workaround one adopter is currently relying on. When they have declared - * nothing we supply the default; when they have, we stay out of the way. + * with the command-line flag rather than merging the two (madge/bin/cli.js:97). + * Passing ours unconditionally would silently delete an adopter's own rules, + * including the workaround one adopter is currently relying on. When they have + * an exclusion in force we stay out of the way; otherwise we supply the default. + * + * "In force" is decided by CONTENT and over madge's WHOLE search path, not by a + * filename in cwd: the loader walks `.madgerc` up to the filesystem root and + * reads `$HOME` and `/etc` too, so a cwd-only check would send `--exclude` to a + * user whose rules live one directory up and turn their green gate red. * * The scan ROOT is deliberately left at `.` (AC-c04171bd): narrowing it to a * named source directory was measured to be worse than the defect it fixes — @@ -424,9 +500,7 @@ function hasPackageDependency(pkg: PackageManifest, name: string): boolean { * checked nothing. */ function resolveTsArch(cwd: string, base: ToolSpec, pkg: PackageManifest): ToolSpec { - const projectConfigures = - pkg.madge !== undefined || MADGE_CONFIGS.some((c) => existsSync(join(cwd, c))); - if (projectConfigures) return base; + if (madgeExclusionInForce(cwd, pkg)) return base; const args = [...base.args]; // Before the trailing scan root, so the root stays last as madge expects. args.splice(args.length - 1, 0, '--exclude', BUILD_OUTPUT_EXCLUDE); diff --git a/tests/report/ac-delta.test.ts b/tests/report/ac-delta.test.ts index 8747d0e9..a0c0b683 100644 --- a/tests/report/ac-delta.test.ts +++ b/tests/report/ac-delta.test.ts @@ -34,6 +34,14 @@ function entry( }; } +/** One entry's delta from a base/head criterion pair — the common shape below. */ +function buildSpecDeltasFor( + baseAcs: readonly AcceptanceCriterion[], + headAcs: readonly AcceptanceCriterion[], +) { + return buildSpecEntryDeltas([entry(baseAcs, headAcs)]); +} + /** The single row for `id`, asserted to exist. */ function row(deltas: ReturnType, id: string) { const found = deltas[0]?.rows.find((r) => r.id === id); @@ -102,6 +110,32 @@ describe('AC-c32cbab2 · classifying how each criterion moved', () => { expect(row(d, 'AC-0001').kind).toBe('unchanged'); }); + test('a changed EARS action is a rewrite — it IS the obligation', () => { + // `action` renders to the impl-blind oracle as "system shall:", so rewriting + // it rewrites the requirement. 79% of this project's own criteria carry it, + // and a sibling corpus has criteria with NO `text` at all — there the whole + // obligation lives in these fields. + const d = buildSpecDeltasFor( + [ac('AC-0001', {text: undefined, ears: 'event', condition: 'when a file is uploaded', action: 'route it by filename extension'})], + [ac('AC-0001', {text: undefined, ears: 'event', condition: 'when a file is uploaded', action: 'route it by validated content'})], + ); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('a changed EARS response is a rewrite', () => { + const d = buildSpecDeltasFor( + [ac('AC-0001', {response: 'the upload is accepted'})], + [ac('AC-0001', {response: 'the upload is rejected'})], + ); + expect(row(d, 'AC-0001').kind).toBe('rewritten'); + }); + + test('an identical EARS-only criterion is still unchanged', () => { + const same = {text: undefined, ears: 'state' as const, condition: 'while idle', action: 'hold the latch', response: 'nothing spawns'}; + const d = buildSpecDeltasFor([ac('AC-0001', same)], [ac('AC-0001', same)]); + expect(row(d, 'AC-0001').kind).toBe('unchanged'); + }); + test('an expanded rationale alone is not a rewrite — notes are outside the contract key', () => { const d = buildSpecEntryDeltas([ entry([ac('AC-0001', {notes: 'brief'})], [ac('AC-0001', {notes: 'a much longer WHY'})]), diff --git a/tests/report/report-cli.test.ts b/tests/report/report-cli.test.ts index 743dc0bc..8cc2971a 100644 --- a/tests/report/report-cli.test.ts +++ b/tests/report/report-cli.test.ts @@ -337,3 +337,59 @@ describe('the packet names the revision it audited against', () => { } }); }); + +describe('the base disclosure appears only when the base is a different commit', () => { + test('a linear range says nothing — the named ref IS the merge base', () => { + const lin = mkdtempSync(join(tmpdir(), 'clad-report-linear-')); + try { + git(lin, ['init', '-q']); + git(lin, ['config', 'user.email', 'test@example.com']); + git(lin, ['config', 'user.name', 'test']); + git(lin, ['config', 'commit.gpgsign', 'false']); + mkdirSync(join(lin, 'spec', 'features'), {recursive: true}); + writeFileSync(join(lin, 'spec.yaml'), SPEC_YAML); + writeFileSync(join(lin, 'spec', 'features', 'owned-feature-aaaa1111.yaml'), shard('in_progress')); + writeFileSync(join(lin, 'src.ts'), 'export const a = 1;\n'); + git(lin, ['add', '-A']); + git(lin, ['commit', '-q', '-m', 'baseline']); + git(lin, ['tag', 'v0']); + writeFileSync(join(lin, 'src.ts'), 'export const a = 2;\n'); + git(lin, ['add', '-A']); + git(lin, ['commit', '-q', '-m', 'work']); + + const ran = runClad(lin, ['report', '--since', 'v0']); + expect(ran.status).toBe(0); + // Before this was decided by comparing a ref name to a sha, it fired here. + expect(ran.stdout).not.toContain('Compared against'); + } finally { + rmSync(lin, {recursive: true, force: true}); + } + }); + + test('an ANNOTATED tag on the merge base is also silent — the ref is peeled, not string-compared', () => { + const ann = mkdtempSync(join(tmpdir(), 'clad-report-annotated-')); + try { + git(ann, ['init', '-q']); + git(ann, ['config', 'user.email', 'test@example.com']); + git(ann, ['config', 'user.name', 'test']); + git(ann, ['config', 'commit.gpgsign', 'false']); + mkdirSync(join(ann, 'spec', 'features'), {recursive: true}); + writeFileSync(join(ann, 'spec.yaml'), SPEC_YAML); + writeFileSync(join(ann, 'spec', 'features', 'owned-feature-aaaa1111.yaml'), shard('in_progress')); + writeFileSync(join(ann, 'src.ts'), 'export const a = 1;\n'); + git(ann, ['add', '-A']); + git(ann, ['commit', '-q', '-m', 'baseline']); + // An annotated tag object is NOT the commit it points at. + git(ann, ['tag', '-a', 'v1', '-m', 'release one']); + writeFileSync(join(ann, 'src.ts'), 'export const a = 2;\n'); + git(ann, ['add', '-A']); + git(ann, ['commit', '-q', '-m', 'work']); + + const ran = runClad(ann, ['report', '--since', 'v1']); + expect(ran.status).toBe(0); + expect(ran.stdout).not.toContain('Compared against'); + } finally { + rmSync(ann, {recursive: true, force: true}); + } + }); +}); diff --git a/tests/report/report.test.ts b/tests/report/report.test.ts index 2d351b03..2a762991 100644 --- a/tests/report/report.test.ts +++ b/tests/report/report.test.ts @@ -177,9 +177,13 @@ describe('report/report — renderReportMarkdown six sections + determinism (AC- expect(md).toContain('the merge base of v0 and HEAD'); }); - test('stays silent when the base IS the named ref — no noise on a linear range', () => { - const md = renderReportMarkdown(buildReportModel(mkInputs()), {...META, baseSha: 'v0'}); - expect(md).not.toContain('Compared against'); + test('renders whenever a base is supplied — the CLI, not the renderer, decides', () => { + // A ref NAME and a sha are different kinds of thing; only git can say + // whether they denote the same commit (an annotated tag is not its own + // commit). Comparing them here announced a difference on every linear + // range, so the decision moved to the layer that can resolve refs. + const md = renderReportMarkdown(buildReportModel(mkInputs()), {...META, baseSha: 'abc123def4560000000000000000000000000000'}); + expect(md).toContain('Compared against abc123def456'); }); test('an absent base sha renders as before — the field is additive', () => { @@ -277,6 +281,31 @@ describe('AC-e68c868a · declared tests and whether they moved with the code', ( ]); }); + test('a declared test with no file on disk is not passed off as an untouched test', () => { + // Every sibling existence check is done-only, so this status-blind section + // is the only surface that speaks for planned/in_progress entries — and + // "unchanged" there reads as "a real test that simply did not move". + const model = buildReportModel( + mkInputs({ + specEntries: [entryDeclaring(['tests/gone.test.ts'])], + changedPaths: [], + missingTestRefs: ['tests/gone.test.ts'], + }), + ); + expect(model.testRefRows.map((r) => r.state)).toEqual(['missing']); + }); + + test('a missing file wins over co-change — a path that cannot exist did not move', () => { + const model = buildReportModel( + mkInputs({ + specEntries: [entryDeclaring(['tests/gone.test.ts'])], + changedPaths: ['tests/gone.test.ts'], + missingTestRefs: ['tests/gone.test.ts'], + }), + ); + expect(model.testRefRows[0]?.state).toBe('missing'); + }); + test('a harness-written placeholder is never reported as an untouched test', () => { // `clad sync` writes `derived:` refs as unconfirmed suggestions. Rendering // one as "declared but did not change" would pass a harness guess off as a diff --git a/tests/stages/toolchain.test.ts b/tests/stages/toolchain.test.ts index f09ceaeb..b1bd05b2 100644 --- a/tests/stages/toolchain.test.ts +++ b/tests/stages/toolchain.test.ts @@ -282,7 +282,7 @@ describe('detectToolchain', () => { args: [ '--offline', '--no-install', 'madge', '--circular', '--extensions', 'ts,tsx,js,jsx', - '--exclude', '^(dist|build|out|coverage|target|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/', + '--exclude', '(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/', '.', ], }); @@ -308,6 +308,11 @@ describe('detectToolchain', () => { 'dist/index.js', 'build/main.js', 'out/app.js', 'coverage/lcov-report/x.js', 'target/classes/a.js', '.next/server/page.js', '.nuxt/dist/client.js', '.output/server/index.mjs', '.svelte-kit/output/x.js', '.vite/deps/chunk.js', + // A monorepo or a front-end subdirectory puts its bundle one level down. + // Anchoring only at depth 0 left those blocking the gate — the exact + // shape the motivating adopter has (`frontend/dist`). + 'frontend/dist/index.js', 'packages/ui/dist/bundle.js', 'apps/web/.next/x.js', + 'packages/core/coverage/lcov-report/y.js', 'plugins/host/dist/bundle.js', ]) { expect(re.test(generated), `${generated} should be excluded`).toBe(true); } @@ -319,9 +324,11 @@ describe('detectToolchain', () => { for (const source of [ 'src/index.ts', 'tests/unit.test.ts', 'lib/util.ts', 'app/page.tsx', 'packages/core/src/a.ts', 'backend/api/main.ts', - // Anchored at the repository root: a SOURCE directory that merely happens - // to be named build/ or dist/ deeper in the tree must keep being scanned. - 'src/build/compile.ts', 'app/dist/renderer.ts', 'packages/out/index.ts', + // `build`, `out` and `target` are ambiguous — they name real source + // directories often enough that they stay anchored at the repository + // root. (`dist`, `coverage` and the framework caches are not ambiguous: + // no repository on hand commits hand-written source under any of them.) + 'src/build/compile.ts', 'packages/out/index.ts', 'app/target/gen.ts', ]) { expect(re.test(source), `${source} must NOT be excluded`).toBe(false); } @@ -330,21 +337,91 @@ describe('detectToolchain', () => { test('AC-554d9436 · a project that configures the scanner itself keeps its own rules', () => { // madge REPLACES its configured excludeRegExp with the command-line flag // rather than merging, so passing ours would silently delete theirs. - for (const config of ['.madgerc', '.madgerc.json', '.madgerc.js', '.madgerc.yaml', '.madgerc.yml']) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, '.madgerc'), '{"excludeRegExp": ["^vendor/"]}'); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-554d9436 · an inline package.json madge block also wins', () => { + writeFileSync(join(dir, 'package.json'), JSON.stringify({madge: {excludeRegExp: ['^vendor/']}})); + expect(detectToolchain(dir).gates.arch?.args).not.toContain('--exclude'); + }); + + test('AC-554d9436 · a .madgerc in a PARENT directory is honoured — madge walks up, so must we', () => { + // The config loader recurses from cwd to the filesystem root. A guard that + // looks only in cwd sends --exclude anyway, madge REPLACES the parent's + // rules with ours, and cycles the user had suppressed come back RED. + const parent = mkdtempSync(join(tmpdir(), 'clad-madge-parent-')); + try { + writeFileSync(join(parent, '.madgerc'), '{"excludeRegExp": ["^vendor/"]}'); + const child = join(parent, 'workspace', 'app'); + mkdirSync(child, {recursive: true}); + writeFileSync(join(child, 'package.json'), '{}'); + expect(detectToolchain(child).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(parent, {recursive: true, force: true}); + } + }); + + test('AC-554d9436 · a .madgerc under $HOME is honoured too', () => { + const fakeHome = mkdtempSync(join(tmpdir(), 'clad-madge-home-')); + const realHome = process.env.HOME; + const realProfile = process.env.USERPROFILE; + try { + writeFileSync(join(fakeHome, '.madgerc'), '{"excludeRegExp": ["^vendor/"]}'); + process.env.HOME = fakeHome; + process.env.USERPROFILE = fakeHome; const own = mkdtempSync(join(tmpdir(), 'clad-madge-')); try { writeFileSync(join(own, 'package.json'), '{}'); - writeFileSync(join(own, config), '{"excludeRegExp": ["^vendor/"]}'); - expect(detectToolchain(own).gates.arch?.args, config).not.toContain('--exclude'); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); } finally { rmSync(own, {recursive: true, force: true}); } + } finally { + if (realHome === undefined) delete process.env.HOME; else process.env.HOME = realHome; + if (realProfile === undefined) delete process.env.USERPROFILE; else process.env.USERPROFILE = realProfile; + rmSync(fakeHome, {recursive: true, force: true}); } }); - test('AC-554d9436 · an inline package.json madge block also wins', () => { - writeFileSync(join(dir, 'package.json'), JSON.stringify({madge: {excludeRegExp: ['^vendor/']}})); - expect(detectToolchain(dir).gates.arch?.args).not.toContain('--exclude'); + test('AC-caa9471d · a config that sets no exclusion does NOT switch the fix off', () => { + // These all EXIST but put no excludeRegExp in force, so build output would + // keep blocking the gate while cladding believed the project had it covered. + for (const [label, write] of [ + ['empty .madgerc', (d: string) => writeFileSync(join(d, '.madgerc'), '{}')], + ['detectiveOptions-only .madgerc', (d: string) => writeFileSync(join(d, '.madgerc'), '{"detectiveOptions": {"ts": {"skipTypeImports": true}}}')], + // Not config files at all — the loader reads only the exact name `.madgerc`. + ['.madgerc.json', (d: string) => writeFileSync(join(d, '.madgerc.json'), '{"excludeRegExp": ["^vendor/"]}')], + ['.madgerc.yaml', (d: string) => writeFileSync(join(d, '.madgerc.yaml'), 'excludeRegExp: ["^vendor/"]')], + ['package.json madge block without excludeRegExp', (d: string) => writeFileSync(join(d, 'package.json'), JSON.stringify({madge: {detectiveOptions: {}}}))], + ] as [string, (d: string) => void][]) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-inert-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + write(own); + expect(detectToolchain(own).gates.arch?.args, label).toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + test('AC-554d9436 · an unparseable .madgerc makes cladding stand down, not guess', () => { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-ini-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + // rc also accepts ini; we cannot read it reliably, so we must not override. + writeFileSync(join(own, '.madgerc'), 'excludeRegExp[] = ^vendor/\n'); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } }); test('AC-c04171bd · the scan root stays the repository root, never a named directory', () => { From 9d5283b46cc37b0db8cae964e8c01e0d94c81f5d Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Mon, 3 Aug 2026 16:14:05 +0900 Subject: [PATCH 5/8] fix(report,arch): close what an external black-box run found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous round was checked by reading the source. This one drove the shipped bundle from outside the repo, against real adopter clones and against madge itself as a two-sided oracle. Three of five changes held up unchanged; two did not, and one of those was wrong in a way no source review had caught. THE CRITERION DELTA READ THE WORKING TREE FOR ITS HEAD SIDE. The packet names two commits, but one side of the comparison was whatever happened to be on disk. So an uncommitted edit could hide a rewrite that IS in the range, or charge the range with one it never made — and the same leak reached the status, which manufactures exactly the rewrite-plus-done pairing this section exists to surface. That it was a slip rather than a decision is visible in the asymmetry: the candidate set and the declared-test column both already read the committed diff. One line, plus the three regression tests that were missing — the suite passed unpatched, so nothing pinned the contract. THE MADGE GUARD ASKED "IS THE KEY THERE", NOT "IS AN EXCLUSION IN FORCE". It understood only strict JSON and only key presence, with any parse failure counting as configured. So an empty, whitespace-only, comment-bearing, INI-form or vacuous (`[]`, `null`, `""`, `false`) config made cladding stand down while madge applied nothing — withholding the build-output exclusion and leaving the gate red over cycles that exist only in generated code. It now reads the file the way madge's loader does, JSON then INI, and judges the effective value. Driven against madge as the oracle, cladding's decision now matches madge's actual behaviour on all thirteen config states. Two more, found by running the battery the audit had designed but never executed. Both are the damaging direction — madge honours a rule cladding cannot see, so cladding sends its own exclusion, which REPLACES rather than merges, and the user's rule disappears: - `madge_excludeRegExp` in the environment is a live rule with no file behind it; the config loader folds any `madge_*` variable in. - A byte-order mark in package.json hid its `madge` block, because madge reads that file with require() and JSON.parse does not tolerate a BOM. And one in the safe direction: a `.madgerc` that is a DIRECTORY carries no config, but was being treated as one, silently withholding the fix. Also: a duplicated criterion id joined first-wins, so a rewrite of the later occurrence reported unchanged while the same packet's spec-changes section printed the new text. Occurrences now pair positionally, surplus on either side counting as added or removed. The strict gate rejects duplicates, but this renderer gates nothing and runs precisely in the window before green. Every fix was mutation-checked: reverting each makes its tests fail (3, 1, 1 and 1). Verified end to end through a tarball built in a clean clone and installed into an empty project, driven against adopter clones: with a criterion edited but uncommitted, the packet is byte-identical. Known and unchanged: a spec entry's TITLE still moves with the working tree in the spec-changes and code-changes sections, which read the worktree by an older design. Those are different consumers and the criterion data is unaffected. 2803 tests green, `clad check --tier=pre-push --strict` exits 0. Co-Authored-By: Claude Opus 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- plugins/claude-code/dist/clad.js | 622 +++++++++++++++---------------- spec/attestation.yaml | 20 +- src/changelog/collect.ts | 8 +- src/report/ac-delta.ts | 63 ++-- src/stages/toolchain/detect.ts | 80 +++- tests/changelog/collect.test.ts | 60 +++ tests/report/ac-delta.test.ts | 20 + tests/stages/toolchain.test.ts | 98 ++++- 14 files changed, 615 insertions(+), 380 deletions(-) diff --git a/README.html b/README.html index 3c4b6cdf..6a40024d 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2794/2794
+
2803/2803
all pass
diff --git a/README.ja.md b/README.ja.md index 0a1d3e9b..8105e04e 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 | 15 段階 · 41 detectors | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 | 15 段階 · 41 detectors | 273(269 done) | 249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 88fb2b1f..4654965f 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2794/2794
+
2803/2803
all pass
diff --git a/README.ko.md b/README.ko.md index 92f134ae..dabe65ff 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | 249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 8cd78d28..4f594f95 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 | 15 stages · 41 detectors | 273 (269 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 | 15 stages · 41 detectors | 273 (269 done) | 249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 3d190aac..6d726a08 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2794 / 2794 | 15 阶段 · 41 检测器 | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 | 15 阶段 · 41 检测器 | 273(269 done) | 249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 69fce466..079ee28b 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,20 +4,20 @@ const require = __claddingCreateRequire(import.meta.url); // Marker for stages/*.ts: when true, the per-stage CLI-entry guard // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; -var Jde=Object.create;var PA=Object.defineProperty;var Yde=Object.getOwnPropertyDescriptor;var Xde=Object.getOwnPropertyNames;var Qde=Object.getPrototypeOf,efe=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dr=(t,e)=>{for(var r in e)PA(t,r,{get:e[r],enumerable:!0})},tfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xde(e))!efe.call(t,i)&&i!==r&&PA(t,i,{get:()=>e[i],enumerable:!(n=Yde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Jde(Qde(t)):{},tfe(e||!t||!t.__esModule?PA(r,"default",{value:t,enumerable:!0}):r,t));var lf=v(DA=>{var ky=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},CA=class extends ky{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};DA.CommanderError=ky;DA.InvalidArgumentError=CA});var Ey=v(jA=>{var{InvalidArgumentError:rfe}=lf(),NA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new rfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function nfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}jA.Argument=NA;jA.humanReadableArgName=nfe});var LA=v(FA=>{var{humanReadableArgName:ife}=Ey(),MA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>ife(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` +var Yde=Object.create;var PA=Object.defineProperty;var Xde=Object.getOwnPropertyDescriptor;var Qde=Object.getOwnPropertyNames;var efe=Object.getPrototypeOf,tfe=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dr=(t,e)=>{for(var r in e)PA(t,r,{get:e[r],enumerable:!0})},rfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qde(e))!tfe.call(t,i)&&i!==r&&PA(t,i,{get:()=>e[i],enumerable:!(n=Xde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Yde(efe(t)):{},rfe(e||!t||!t.__esModule?PA(r,"default",{value:t,enumerable:!0}):r,t));var lf=v(DA=>{var ky=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},CA=class extends ky{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};DA.CommanderError=ky;DA.InvalidArgumentError=CA});var Ey=v(jA=>{var{InvalidArgumentError:nfe}=lf(),NA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new nfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ife(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}jA.Argument=NA;jA.humanReadableArgName=ife});var LA=v(FA=>{var{humanReadableArgName:ofe}=Ey(),MA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>ofe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` `)}displayWidth(e){return y4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function y4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}FA.Help=MA;FA.stripColor=y4});var BA=v(qA=>{var{InvalidArgumentError:ofe}=lf(),zA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=sfe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new ofe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?_4(this.name().replace(/^no-/,"")):_4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},UA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function _4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function sfe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function y4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}FA.Help=MA;FA.stripColor=y4});var BA=v(qA=>{var{InvalidArgumentError:sfe}=lf(),zA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=afe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new sfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?_4(this.name().replace(/^no-/,"")):_4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},UA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function _4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function afe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}qA.Option=zA;qA.DualOptions=UA});var v4=v(b4=>{function afe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function cfe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=afe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}qA.Option=zA;qA.DualOptions=UA});var v4=v(b4=>{function cfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function lfe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=cfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}b4.suggestSimilar=cfe});var $4=v(WA=>{var lfe=Ge("node:events").EventEmitter,HA=Ge("node:child_process"),po=Ge("node:path"),Ay=Ge("node:fs"),Be=Ge("node:process"),{Argument:ufe,humanReadableArgName:dfe}=Ey(),{CommanderError:GA}=lf(),{Help:ffe,stripColor:pfe}=LA(),{Option:S4,DualOptions:mfe}=BA(),{suggestSimilar:w4}=v4(),ZA=class t extends lfe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>VA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>VA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>pfe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new ffe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name -- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new ufe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. +(Did you mean ${n[0]}?)`:""}b4.suggestSimilar=lfe});var $4=v(WA=>{var ufe=Ge("node:events").EventEmitter,HA=Ge("node:child_process"),po=Ge("node:path"),Ay=Ge("node:fs"),Be=Ge("node:process"),{Argument:dfe,humanReadableArgName:ffe}=Ey(),{CommanderError:GA}=lf(),{Help:pfe,stripColor:mfe}=LA(),{Option:S4,DualOptions:hfe}=BA(),{suggestSimilar:w4}=v4(),ZA=class t extends ufe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>VA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>VA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>mfe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new pfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new dfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new GA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new S4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof S4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. - 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(e,r,n){if(Ay.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist @@ -26,20 +26,20 @@ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._life - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=po.resolve(u,d);if(Ay.existsSync(f))return f;if(i.includes(po.extname(d)))return;let p=i.find(m=>Ay.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=po.resolve(po.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=po.basename(this._scriptPath,po.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(po.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=x4(Be.execArgv).concat(r),c=HA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=HA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=x4(Be.execArgv).concat(r),c=HA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new GA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new GA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` -`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new mfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=w4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=w4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} -`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>dfe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=po.basename(e,po.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=w4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=w4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} +`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>ffe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=po.basename(e,po.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function x4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function VA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}WA.Command=ZA;WA.useColor=VA});var T4=v(Tn=>{var{Argument:k4}=Ey(),{Command:KA}=$4(),{CommanderError:hfe,InvalidArgumentError:E4}=lf(),{Help:gfe}=LA(),{Option:A4}=BA();Tn.program=new KA;Tn.createCommand=t=>new KA(t);Tn.createOption=(t,e)=>new A4(t,e);Tn.createArgument=(t,e)=>new k4(t,e);Tn.Command=KA;Tn.Option=A4;Tn.Argument=k4;Tn.Help=gfe;Tn.CommanderError=hfe;Tn.InvalidArgumentError=E4;Tn.InvalidOptionArgumentError=E4});var De=v(Qt=>{"use strict";var YA=Symbol.for("yaml.alias"),P4=Symbol.for("yaml.document"),Ty=Symbol.for("yaml.map"),C4=Symbol.for("yaml.pair"),XA=Symbol.for("yaml.scalar"),Oy=Symbol.for("yaml.seq"),mo=Symbol.for("yaml.node.type"),wfe=t=>!!t&&typeof t=="object"&&t[mo]===YA,xfe=t=>!!t&&typeof t=="object"&&t[mo]===P4,$fe=t=>!!t&&typeof t=="object"&&t[mo]===Ty,kfe=t=>!!t&&typeof t=="object"&&t[mo]===C4,D4=t=>!!t&&typeof t=="object"&&t[mo]===XA,Efe=t=>!!t&&typeof t=="object"&&t[mo]===Oy;function N4(t){if(t&&typeof t=="object")switch(t[mo]){case Ty:case Oy:return!0}return!1}function Afe(t){if(t&&typeof t=="object")switch(t[mo]){case YA:case Ty:case XA:case Oy:return!0}return!1}var Tfe=t=>(D4(t)||N4(t))&&!!t.anchor;Qt.ALIAS=YA;Qt.DOC=P4;Qt.MAP=Ty;Qt.NODE_TYPE=mo;Qt.PAIR=C4;Qt.SCALAR=XA;Qt.SEQ=Oy;Qt.hasAnchor=Tfe;Qt.isAlias=wfe;Qt.isCollection=N4;Qt.isDocument=xfe;Qt.isMap=$fe;Qt.isNode=Afe;Qt.isPair=kfe;Qt.isScalar=D4;Qt.isSeq=Efe});var uf=v(QA=>{"use strict";var Ut=De(),Nr=Symbol("break visit"),j4=Symbol("skip children"),Ti=Symbol("remove node");function Ry(t,e){let r=M4(e);Ut.isDocument(t)?el(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):el(null,t,r,Object.freeze([]))}Ry.BREAK=Nr;Ry.SKIP=j4;Ry.REMOVE=Ti;function el(t,e,r,n){let i=F4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return L4(t,n,i),el(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var z4=De(),Ofe=uf(),Rfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ife=t=>t.replace(/[!,[\]{}]/g,e=>Rfe[e]),df=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Ife(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&z4.isNode(e.contents)){let o={};Ofe.visit(e.contents,(s,a)=>{z4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};df.defaultYaml={explicit:!1,version:"1.2"};df.defaultTags={"!!":"tag:yaml.org,2002:"};U4.Directives=df});var Py=v(ff=>{"use strict";var q4=De(),Pfe=uf();function Cfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function B4(t){let e=new Set;return Pfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function H4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Dfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=B4(t));let s=H4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(q4.isScalar(s.node)||q4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}ff.anchorIsValid=Cfe;ff.anchorNames=B4;ff.createNodeAnchors=Dfe;ff.findNewAnchor=H4});var tT=v(G4=>{"use strict";function pf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Nfe=De();function Z4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Z4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Nfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}V4.toJS=Z4});var Cy=v(K4=>{"use strict";var jfe=tT(),W4=De(),Mfe=Vo(),rT=class{constructor(e){Object.defineProperty(this,W4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!W4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Mfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?jfe.applyReviver(o,{"":a},"",a):a}};K4.NodeBase=rT});var mf=v(J4=>{"use strict";var Ffe=Py(),Lfe=uf(),rl=De(),zfe=Cy(),Ufe=Vo(),nT=class extends zfe.NodeBase{constructor(e){super(rl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Lfe.visit(e,{Node:(o,s)=>{(rl.isAlias(s)||rl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(Ufe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Dy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Ffe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Dy(t,e,r){if(rl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(rl.isCollection(e)){let n=0;for(let i of e.items){let o=Dy(t,i,r);o>n&&(n=o)}return n}else if(rl.isPair(e)){let n=Dy(t,e.key,r),i=Dy(t,e.value,r);return Math.max(n,i)}return 1}J4.Alias=nT});var Dt=v(iT=>{"use strict";var qfe=De(),Bfe=Cy(),Hfe=Vo(),Gfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends Bfe.NodeBase{constructor(e){super(qfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Hfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";iT.Scalar=Wo;iT.isScalarValue=Gfe});var hf=v(X4=>{"use strict";var Zfe=mf(),fa=De(),Y4=Dt(),Vfe="tag:yaml.org,2002:";function Wfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Kfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Zfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Vfe+e.slice(2));let l=Wfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Y4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Y4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}X4.createNode=Kfe});var jy=v(Ny=>{"use strict";var Jfe=hf(),Oi=De(),Yfe=Cy();function oT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Jfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Q4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,sT=class extends Yfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Q4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ny.Collection=sT;Ny.collectionFromPath=oT;Ny.isEmptyPath=Q4});var gf=v(My=>{"use strict";var Xfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function aT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Qfe=(t,e,r)=>t.endsWith(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function x4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function VA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}WA.Command=ZA;WA.useColor=VA});var T4=v(Tn=>{var{Argument:k4}=Ey(),{Command:KA}=$4(),{CommanderError:gfe,InvalidArgumentError:E4}=lf(),{Help:yfe}=LA(),{Option:A4}=BA();Tn.program=new KA;Tn.createCommand=t=>new KA(t);Tn.createOption=(t,e)=>new A4(t,e);Tn.createArgument=(t,e)=>new k4(t,e);Tn.Command=KA;Tn.Option=A4;Tn.Argument=k4;Tn.Help=yfe;Tn.CommanderError=gfe;Tn.InvalidArgumentError=E4;Tn.InvalidOptionArgumentError=E4});var De=v(Qt=>{"use strict";var YA=Symbol.for("yaml.alias"),P4=Symbol.for("yaml.document"),Ty=Symbol.for("yaml.map"),C4=Symbol.for("yaml.pair"),XA=Symbol.for("yaml.scalar"),Oy=Symbol.for("yaml.seq"),mo=Symbol.for("yaml.node.type"),xfe=t=>!!t&&typeof t=="object"&&t[mo]===YA,$fe=t=>!!t&&typeof t=="object"&&t[mo]===P4,kfe=t=>!!t&&typeof t=="object"&&t[mo]===Ty,Efe=t=>!!t&&typeof t=="object"&&t[mo]===C4,D4=t=>!!t&&typeof t=="object"&&t[mo]===XA,Afe=t=>!!t&&typeof t=="object"&&t[mo]===Oy;function N4(t){if(t&&typeof t=="object")switch(t[mo]){case Ty:case Oy:return!0}return!1}function Tfe(t){if(t&&typeof t=="object")switch(t[mo]){case YA:case Ty:case XA:case Oy:return!0}return!1}var Ofe=t=>(D4(t)||N4(t))&&!!t.anchor;Qt.ALIAS=YA;Qt.DOC=P4;Qt.MAP=Ty;Qt.NODE_TYPE=mo;Qt.PAIR=C4;Qt.SCALAR=XA;Qt.SEQ=Oy;Qt.hasAnchor=Ofe;Qt.isAlias=xfe;Qt.isCollection=N4;Qt.isDocument=$fe;Qt.isMap=kfe;Qt.isNode=Tfe;Qt.isPair=Efe;Qt.isScalar=D4;Qt.isSeq=Afe});var uf=v(QA=>{"use strict";var Ut=De(),Nr=Symbol("break visit"),j4=Symbol("skip children"),Ti=Symbol("remove node");function Ry(t,e){let r=M4(e);Ut.isDocument(t)?el(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):el(null,t,r,Object.freeze([]))}Ry.BREAK=Nr;Ry.SKIP=j4;Ry.REMOVE=Ti;function el(t,e,r,n){let i=F4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return L4(t,n,i),el(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var z4=De(),Rfe=uf(),Ife={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pfe=t=>t.replace(/[!,[\]{}]/g,e=>Ife[e]),df=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Pfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&z4.isNode(e.contents)){let o={};Rfe.visit(e.contents,(s,a)=>{z4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};df.defaultYaml={explicit:!1,version:"1.2"};df.defaultTags={"!!":"tag:yaml.org,2002:"};U4.Directives=df});var Py=v(ff=>{"use strict";var q4=De(),Cfe=uf();function Dfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function B4(t){let e=new Set;return Cfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function H4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Nfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=B4(t));let s=H4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(q4.isScalar(s.node)||q4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}ff.anchorIsValid=Dfe;ff.anchorNames=B4;ff.createNodeAnchors=Nfe;ff.findNewAnchor=H4});var tT=v(G4=>{"use strict";function pf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var jfe=De();function Z4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Z4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!jfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}V4.toJS=Z4});var Cy=v(K4=>{"use strict";var Mfe=tT(),W4=De(),Ffe=Vo(),rT=class{constructor(e){Object.defineProperty(this,W4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!W4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Ffe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Mfe.applyReviver(o,{"":a},"",a):a}};K4.NodeBase=rT});var mf=v(J4=>{"use strict";var Lfe=Py(),zfe=uf(),rl=De(),Ufe=Cy(),qfe=Vo(),nT=class extends Ufe.NodeBase{constructor(e){super(rl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],zfe.visit(e,{Node:(o,s)=>{(rl.isAlias(s)||rl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(qfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Dy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Lfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Dy(t,e,r){if(rl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(rl.isCollection(e)){let n=0;for(let i of e.items){let o=Dy(t,i,r);o>n&&(n=o)}return n}else if(rl.isPair(e)){let n=Dy(t,e.key,r),i=Dy(t,e.value,r);return Math.max(n,i)}return 1}J4.Alias=nT});var Dt=v(iT=>{"use strict";var Bfe=De(),Hfe=Cy(),Gfe=Vo(),Zfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends Hfe.NodeBase{constructor(e){super(Bfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Gfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";iT.Scalar=Wo;iT.isScalarValue=Zfe});var hf=v(X4=>{"use strict";var Vfe=mf(),fa=De(),Y4=Dt(),Wfe="tag:yaml.org,2002:";function Kfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Jfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Vfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Wfe+e.slice(2));let l=Kfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Y4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Y4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}X4.createNode=Jfe});var jy=v(Ny=>{"use strict";var Yfe=hf(),Oi=De(),Xfe=Cy();function oT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Yfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Q4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,sT=class extends Xfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Q4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ny.Collection=sT;Ny.collectionFromPath=oT;Ny.isEmptyPath=Q4});var gf=v(My=>{"use strict";var Qfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function aT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var epe=(t,e,r)=>t.endsWith(` `)?aT(r,e):r.includes(` `)?` -`+aT(r,e):(t.endsWith(" ")?"":" ")+r;My.indentComment=aT;My.lineComment=Qfe;My.stringifyComment=Xfe});var t6=v(yf=>{"use strict";var epe="flow",cT="block",Fy="quoted";function tpe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===cT&&(h=e6(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Fy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`+aT(r,e):(t.endsWith(" ")?"":" ")+r;My.indentComment=aT;My.lineComment=epe;My.stringifyComment=Qfe});var t6=v(yf=>{"use strict";var tpe="flow",cT="block",Fy="quoted";function rpe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===cT&&(h=e6(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Fy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` `)r===cT&&(h=e6(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` `&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Fy){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Yn=Dt(),Ko=t6(),zy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Uy=t=>/^(%|---|\.\.\.)/m.test(t);function rpe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;o{"use strict";var Yn=Dt(),Ko=t6(),zy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Uy=t=>/^(%|---|\.\.\.)/m.test(t);function npe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function _f(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Uy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` @@ -57,12 +57,12 @@ ${r}`)+"'";return e.implicitKey?n:Ko.foldFlowLines(n,r,Ko.FOLD_FLOW,zy(e,!1))}fu `)b=g;else break}let _=r.substring(0,b{O=!0});let A=Ko.foldFlowLines(`${_}${w}${p}`,l,Ko.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function npe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` +${l}${_}${r}${p}`}function ipe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` `)||u&&/[[\]{},]/.test(o))return nl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` `)?nl(o,e):Ly(t,e,r,n);if(!a&&!u&&i!==Yn.Scalar.PLAIN&&o.includes(` `))return Ly(t,e,r,n);if(Uy(o)){if(c==="")return e.forceBlockIndent=!0,Ly(t,e,r,n);if(a&&c===l)return nl(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return nl(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,zy(e,!1))}function ipe(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Yn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Yn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Yn.Scalar.BLOCK_FOLDED:case Yn.Scalar.BLOCK_LITERAL:return i||o?nl(s.value,e):Ly(s,e,r,n);case Yn.Scalar.QUOTE_DOUBLE:return _f(s.value,e);case Yn.Scalar.QUOTE_SINGLE:return lT(s.value,e);case Yn.Scalar.PLAIN:return npe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}r6.stringifyString=ipe});var vf=v(dT=>{"use strict";var ope=Py(),Jo=De(),spe=gf(),ape=bf();function cpe(t,e){let r=Object.assign({blockQuote:!0,commentString:spe.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function lpe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function upe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&ope.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function dpe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=lpe(e.doc.schema.tags,o));let s=upe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?ape.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}dT.createStringifyContext=cpe;dT.stringify=dpe});var s6=v(o6=>{"use strict";var ho=De(),n6=Dt(),i6=vf(),Sf=gf();function fpe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=ho.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ho.isCollection(t)||!ho.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||ho.isCollection(t)||(ho.isScalar(t)?t.type===n6.Scalar.BLOCK_FOLDED||t.type===n6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=i6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=Sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Sf.lineComment(g,r.indent,l(f))),g=`? ${g} +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return nl(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,zy(e,!1))}function ope(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Yn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Yn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Yn.Scalar.BLOCK_FOLDED:case Yn.Scalar.BLOCK_LITERAL:return i||o?nl(s.value,e):Ly(s,e,r,n);case Yn.Scalar.QUOTE_DOUBLE:return _f(s.value,e);case Yn.Scalar.QUOTE_SINGLE:return lT(s.value,e);case Yn.Scalar.PLAIN:return ipe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}r6.stringifyString=ope});var vf=v(dT=>{"use strict";var spe=Py(),Jo=De(),ape=gf(),cpe=bf();function lpe(t,e){let r=Object.assign({blockQuote:!0,commentString:ape.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function upe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function dpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&spe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function fpe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=upe(e.doc.schema.tags,o));let s=dpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?cpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}dT.createStringifyContext=lpe;dT.stringify=fpe});var s6=v(o6=>{"use strict";var ho=De(),n6=Dt(),i6=vf(),Sf=gf();function ppe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=ho.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ho.isCollection(t)||!ho.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||ho.isCollection(t)||(ho.isScalar(t)?t.type===n6.Scalar.BLOCK_FOLDED||t.type===n6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=i6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=Sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Sf.lineComment(g,r.indent,l(f))),g=`? ${g} ${a}:`):(g=`${g}:`,f&&(g+=Sf.lineComment(g,r.indent,l(f))));let b,_,S;ho.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&ho.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ho.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=i6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` ${Sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` @@ -72,32 +72,32 @@ ${Sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` ${r.indent}`}else if(!p&&ho.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let re=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var a6=Ge("process");function ppe(t,...e){t==="debug"&&console.log(...e)}function mpe(t,e){(t==="debug"||t==="warn")&&(typeof a6.emitWarning=="function"?a6.emitWarning(e):console.warn(e))}fT.debug=ppe;fT.warn=mpe});var Zy=v(Gy=>{"use strict";var Hy=De(),c6=Dt(),qy="<<",By={identify:t=>t===qy||typeof t=="symbol"&&t.description===qy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c6.Scalar(Symbol(qy)),{addToJSMap:l6}),stringify:()=>qy},hpe=(t,e)=>(By.identify(e)||Hy.isScalar(e)&&(!e.type||e.type===c6.Scalar.PLAIN)&&By.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===By.tag&&r.default);function l6(t,e,r){let n=u6(t,r);if(Hy.isSeq(n))for(let i of n.items)mT(t,e,i);else if(Array.isArray(n))for(let i of n)mT(t,e,i);else mT(t,e,n)}function mT(t,e,r){let n=u6(t,r);if(!Hy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function u6(t,e){return t&&Hy.isAlias(e)?e.resolve(t.doc,t):e}Gy.addMergeToJSMap=l6;Gy.isMergeKey=hpe;Gy.merge=By});var gT=v(p6=>{"use strict";var gpe=pT(),d6=Zy(),ype=vf(),f6=De(),hT=Vo();function _pe(t,e,{key:r,value:n}){if(f6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(d6.isMergeKey(t,r))d6.addMergeToJSMap(t,e,n);else{let i=hT.toJS(r,"",t);if(e instanceof Map)e.set(i,hT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=bpe(r,i,t),s=hT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function bpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(f6.isNode(t)&&r?.doc){let n=ype.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),gpe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}p6.addPairToJSMap=_pe});var Yo=v(yT=>{"use strict";var m6=hf(),vpe=s6(),Spe=gT(),Vy=De();function wpe(t,e,r){let n=m6.createNode(t,void 0,r),i=m6.createNode(e,void 0,r);return new Wy(n,i)}var Wy=class t{constructor(e,r=null){Object.defineProperty(this,Vy.NODE_TYPE,{value:Vy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Vy.isNode(r)&&(r=r.clone(e)),Vy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Spe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?vpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};yT.Pair=Wy;yT.createPair=wpe});var _T=v(g6=>{"use strict";var pa=De(),h6=vf(),Ky=gf();function xpe(t,e,r){return(e.inFlow??t.flow?kpe:$pe)(t,e,r)}function $pe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Ky.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var a6=Ge("process");function mpe(t,...e){t==="debug"&&console.log(...e)}function hpe(t,e){(t==="debug"||t==="warn")&&(typeof a6.emitWarning=="function"?a6.emitWarning(e):console.warn(e))}fT.debug=mpe;fT.warn=hpe});var Zy=v(Gy=>{"use strict";var Hy=De(),c6=Dt(),qy="<<",By={identify:t=>t===qy||typeof t=="symbol"&&t.description===qy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c6.Scalar(Symbol(qy)),{addToJSMap:l6}),stringify:()=>qy},gpe=(t,e)=>(By.identify(e)||Hy.isScalar(e)&&(!e.type||e.type===c6.Scalar.PLAIN)&&By.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===By.tag&&r.default);function l6(t,e,r){let n=u6(t,r);if(Hy.isSeq(n))for(let i of n.items)mT(t,e,i);else if(Array.isArray(n))for(let i of n)mT(t,e,i);else mT(t,e,n)}function mT(t,e,r){let n=u6(t,r);if(!Hy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function u6(t,e){return t&&Hy.isAlias(e)?e.resolve(t.doc,t):e}Gy.addMergeToJSMap=l6;Gy.isMergeKey=gpe;Gy.merge=By});var gT=v(p6=>{"use strict";var ype=pT(),d6=Zy(),_pe=vf(),f6=De(),hT=Vo();function bpe(t,e,{key:r,value:n}){if(f6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(d6.isMergeKey(t,r))d6.addMergeToJSMap(t,e,n);else{let i=hT.toJS(r,"",t);if(e instanceof Map)e.set(i,hT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=vpe(r,i,t),s=hT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function vpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(f6.isNode(t)&&r?.doc){let n=_pe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),ype.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}p6.addPairToJSMap=bpe});var Yo=v(yT=>{"use strict";var m6=hf(),Spe=s6(),wpe=gT(),Vy=De();function xpe(t,e,r){let n=m6.createNode(t,void 0,r),i=m6.createNode(e,void 0,r);return new Wy(n,i)}var Wy=class t{constructor(e,r=null){Object.defineProperty(this,Vy.NODE_TYPE,{value:Vy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Vy.isNode(r)&&(r=r.clone(e)),Vy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return wpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Spe.stringifyPair(this,e,r,n):JSON.stringify(this)}};yT.Pair=Wy;yT.createPair=xpe});var _T=v(g6=>{"use strict";var pa=De(),h6=vf(),Ky=gf();function $pe(t,e,r){return(e.inFlow??t.flow?Epe:kpe)(t,e,r)}function kpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Ky.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` +`+Ky.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Epe({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` `)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Ky.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Jy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ky.indentComment(e(n),t);r.push(o.trimStart())}}g6.stringifyCollection=xpe});var Qo=v(vT=>{"use strict";var Epe=_T(),Ape=gT(),Tpe=jy(),Xo=De(),Yy=Yo(),Ope=Dt();function wf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var bT=class extends Tpe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Yy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yy.Pair(e,e?.value):n=new Yy.Pair(e.key,e.value);let i=wf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Ope.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=wf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=wf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!wf(this.items,e)}set(e,r){this.add(new Yy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Ape.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Epe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};vT.YAMLMap=bT;vT.findPair=wf});var il=v(_6=>{"use strict";var Rpe=De(),y6=Qo(),Ipe={collection:"map",default:!0,nodeClass:y6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Rpe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>y6.YAMLMap.from(t,e,r)};_6.map=Ipe});var es=v(b6=>{"use strict";var Ppe=hf(),Cpe=_T(),Dpe=jy(),Qy=De(),Npe=Dt(),jpe=Vo(),ST=class extends Dpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Xy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Xy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Qy.isScalar(i)?i.value:i}has(e){let r=Xy(e);return typeof r=="number"&&r=0?e:null}b6.YAMLSeq=ST});var ol=v(S6=>{"use strict";var Mpe=De(),v6=es(),Fpe={collection:"seq",default:!0,nodeClass:v6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Mpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>v6.YAMLSeq.from(t,e,r)};S6.seq=Fpe});var xf=v(w6=>{"use strict";var Lpe=bf(),zpe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),Lpe.stringifyString(t,e,r,n)}};w6.string=zpe});var e_=v(k6=>{"use strict";var x6=Dt(),$6={identify:t=>t==null,createNode:()=>new x6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new x6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&$6.test.test(t)?t:e.options.nullStr};k6.nullTag=$6});var wT=v(A6=>{"use strict";var Upe=Dt(),E6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Upe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&E6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};A6.boolTag=E6});var sl=v(T6=>{"use strict";function qpe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}T6.stringifyNumber=qpe});var $T=v(t_=>{"use strict";var Bpe=Dt(),xT=sl(),Hpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xT.stringifyNumber},Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():xT.stringifyNumber(t)}},Zpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Bpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:xT.stringifyNumber};t_.float=Zpe;t_.floatExp=Gpe;t_.floatNaN=Hpe});var ET=v(n_=>{"use strict";var O6=sl(),r_=t=>typeof t=="bigint"||Number.isInteger(t),kT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R6(t,e,r){let{value:n}=t;return r_(n)&&n>=0?r+n.toString(e):O6.stringifyNumber(t)}var Vpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>kT(t,2,8,r),stringify:t=>R6(t,8,"0o")},Wpe={identify:r_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>kT(t,0,10,r),stringify:O6.stringifyNumber},Kpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>kT(t,2,16,r),stringify:t=>R6(t,16,"0x")};n_.int=Wpe;n_.intHex=Kpe;n_.intOct=Vpe});var P6=v(I6=>{"use strict";var Jpe=il(),Ype=e_(),Xpe=ol(),Qpe=xf(),eme=wT(),AT=$T(),TT=ET(),tme=[Jpe.map,Xpe.seq,Qpe.string,Ype.nullTag,eme.boolTag,TT.intOct,TT.int,TT.intHex,AT.floatNaN,AT.floatExp,AT.float];I6.schema=tme});var N6=v(D6=>{"use strict";var rme=Dt(),nme=il(),ime=ol();function C6(t){return typeof t=="bigint"||Number.isInteger(t)}var i_=({value:t})=>JSON.stringify(t),ome=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:i_},{identify:t=>t==null,createNode:()=>new rme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:i_},{identify:C6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>C6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:i_}],sme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},ame=[nme.map,ime.seq].concat(ome,sme);D6.schema=ame});var RT=v(j6=>{"use strict";var $f=Ge("buffer"),OT=Dt(),cme=bf(),lme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $f.Buffer=="function")return $f.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var o_=De(),IT=Yo(),ume=Dt(),dme=es();function M6(t,e){if(o_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new IT.Pair(new ume.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Jy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ky.indentComment(e(n),t);r.push(o.trimStart())}}g6.stringifyCollection=$pe});var Qo=v(vT=>{"use strict";var Ape=_T(),Tpe=gT(),Ope=jy(),Xo=De(),Yy=Yo(),Rpe=Dt();function wf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var bT=class extends Ope.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Yy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yy.Pair(e,e?.value):n=new Yy.Pair(e.key,e.value);let i=wf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Rpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=wf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=wf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!wf(this.items,e)}set(e,r){this.add(new Yy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Tpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ape.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};vT.YAMLMap=bT;vT.findPair=wf});var il=v(_6=>{"use strict";var Ipe=De(),y6=Qo(),Ppe={collection:"map",default:!0,nodeClass:y6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ipe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>y6.YAMLMap.from(t,e,r)};_6.map=Ppe});var es=v(b6=>{"use strict";var Cpe=hf(),Dpe=_T(),Npe=jy(),Qy=De(),jpe=Dt(),Mpe=Vo(),ST=class extends Npe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Xy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Xy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Qy.isScalar(i)?i.value:i}has(e){let r=Xy(e);return typeof r=="number"&&r=0?e:null}b6.YAMLSeq=ST});var ol=v(S6=>{"use strict";var Fpe=De(),v6=es(),Lpe={collection:"seq",default:!0,nodeClass:v6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Fpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>v6.YAMLSeq.from(t,e,r)};S6.seq=Lpe});var xf=v(w6=>{"use strict";var zpe=bf(),Upe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),zpe.stringifyString(t,e,r,n)}};w6.string=Upe});var e_=v(k6=>{"use strict";var x6=Dt(),$6={identify:t=>t==null,createNode:()=>new x6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new x6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&$6.test.test(t)?t:e.options.nullStr};k6.nullTag=$6});var wT=v(A6=>{"use strict";var qpe=Dt(),E6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new qpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&E6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};A6.boolTag=E6});var sl=v(T6=>{"use strict";function Bpe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}T6.stringifyNumber=Bpe});var $T=v(t_=>{"use strict";var Hpe=Dt(),xT=sl(),Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xT.stringifyNumber},Zpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():xT.stringifyNumber(t)}},Vpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Hpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:xT.stringifyNumber};t_.float=Vpe;t_.floatExp=Zpe;t_.floatNaN=Gpe});var ET=v(n_=>{"use strict";var O6=sl(),r_=t=>typeof t=="bigint"||Number.isInteger(t),kT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R6(t,e,r){let{value:n}=t;return r_(n)&&n>=0?r+n.toString(e):O6.stringifyNumber(t)}var Wpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>kT(t,2,8,r),stringify:t=>R6(t,8,"0o")},Kpe={identify:r_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>kT(t,0,10,r),stringify:O6.stringifyNumber},Jpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>kT(t,2,16,r),stringify:t=>R6(t,16,"0x")};n_.int=Kpe;n_.intHex=Jpe;n_.intOct=Wpe});var P6=v(I6=>{"use strict";var Ype=il(),Xpe=e_(),Qpe=ol(),eme=xf(),tme=wT(),AT=$T(),TT=ET(),rme=[Ype.map,Qpe.seq,eme.string,Xpe.nullTag,tme.boolTag,TT.intOct,TT.int,TT.intHex,AT.floatNaN,AT.floatExp,AT.float];I6.schema=rme});var N6=v(D6=>{"use strict";var nme=Dt(),ime=il(),ome=ol();function C6(t){return typeof t=="bigint"||Number.isInteger(t)}var i_=({value:t})=>JSON.stringify(t),sme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:i_},{identify:t=>t==null,createNode:()=>new nme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:i_},{identify:C6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>C6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:i_}],ame={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},cme=[ime.map,ome.seq].concat(sme,ame);D6.schema=cme});var RT=v(j6=>{"use strict";var $f=Ge("buffer"),OT=Dt(),lme=bf(),ume={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $f.Buffer=="function")return $f.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var o_=De(),IT=Yo(),dme=Dt(),fme=es();function M6(t,e){if(o_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new IT.Pair(new dme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=o_.isPair(n)?n:new IT.Pair(n)}}else e("Expected a sequence for this tag");return t}function F6(t,e,r){let{replacer:n}=r,i=new dme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(IT.createPair(a,c,r))}return i}var fme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:M6,createNode:F6};s_.createPairs=F6;s_.pairs=fme;s_.resolvePairs=M6});var DT=v(CT=>{"use strict";var L6=De(),PT=Vo(),kf=Qo(),pme=es(),z6=a_(),ma=class t extends pme.YAMLSeq{constructor(){super(),this.add=kf.YAMLMap.prototype.add.bind(this),this.delete=kf.YAMLMap.prototype.delete.bind(this),this.get=kf.YAMLMap.prototype.get.bind(this),this.has=kf.YAMLMap.prototype.has.bind(this),this.set=kf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(L6.isPair(i)?(o=PT.toJS(i.key,"",r),s=PT.toJS(i.value,o,r)):o=PT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=z6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var mme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=z6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)L6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};CT.YAMLOMap=ma;CT.omap=mme});var G6=v(NT=>{"use strict";var U6=Dt();function q6({value:t,source:e},r){return e&&(t?B6:H6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var B6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new U6.Scalar(!0),stringify:q6},H6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new U6.Scalar(!1),stringify:q6};NT.falseTag=H6;NT.trueTag=B6});var Z6=v(c_=>{"use strict";var hme=Dt(),jT=sl(),gme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jT.stringifyNumber},yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():jT.stringifyNumber(t)}},_me={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new hme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:jT.stringifyNumber};c_.float=_me;c_.floatExp=yme;c_.floatNaN=gme});var W6=v(Af=>{"use strict";var V6=sl(),Ef=t=>typeof t=="bigint"||Number.isInteger(t);function l_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function MT(t,e,r){let{value:n}=t;if(Ef(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return V6.stringifyNumber(t)}var bme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>l_(t,2,2,r),stringify:t=>MT(t,2,"0b")},vme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>l_(t,1,8,r),stringify:t=>MT(t,8,"0")},Sme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>l_(t,0,10,r),stringify:V6.stringifyNumber},wme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>l_(t,2,16,r),stringify:t=>MT(t,16,"0x")};Af.int=Sme;Af.intBin=bme;Af.intHex=wme;Af.intOct=vme});var LT=v(FT=>{"use strict";var f_=De(),u_=Yo(),d_=Qo(),ha=class t extends d_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;f_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new u_.Pair(e.key,null):r=new u_.Pair(e,null),d_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=d_.findPair(this.items,e);return!r&&f_.isPair(n)?f_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=d_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new u_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(u_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var xme={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(f_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};FT.YAMLSet=ha;FT.set=xme});var UT=v(p_=>{"use strict";var $me=sl();function zT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function K6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return $me.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var kme={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>zT(t,r),stringify:K6},Eme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zT(t,!1),stringify:K6},J6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(J6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=zT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};p_.floatTime=Eme;p_.intTime=kme;p_.timestamp=J6});var Q6=v(X6=>{"use strict";var Ame=il(),Tme=e_(),Ome=ol(),Rme=xf(),Ime=RT(),Y6=G6(),qT=Z6(),m_=W6(),Pme=Zy(),Cme=DT(),Dme=a_(),Nme=LT(),BT=UT(),jme=[Ame.map,Ome.seq,Rme.string,Tme.nullTag,Y6.trueTag,Y6.falseTag,m_.intBin,m_.intOct,m_.int,m_.intHex,qT.floatNaN,qT.floatExp,qT.float,Ime.binary,Pme.merge,Cme.omap,Dme.pairs,Nme.set,BT.intTime,BT.floatTime,BT.timestamp];X6.schema=jme});var lB=v(ZT=>{"use strict";var nB=il(),Mme=e_(),iB=ol(),Fme=xf(),Lme=wT(),HT=$T(),GT=ET(),zme=P6(),Ume=N6(),oB=RT(),Tf=Zy(),sB=DT(),aB=a_(),eB=Q6(),cB=LT(),h_=UT(),tB=new Map([["core",zme.schema],["failsafe",[nB.map,iB.seq,Fme.string]],["json",Ume.schema],["yaml11",eB.schema],["yaml-1.1",eB.schema]]),rB={binary:oB.binary,bool:Lme.boolTag,float:HT.float,floatExp:HT.floatExp,floatNaN:HT.floatNaN,floatTime:h_.floatTime,int:GT.int,intHex:GT.intHex,intOct:GT.intOct,intTime:h_.intTime,map:nB.map,merge:Tf.merge,null:Mme.nullTag,omap:sB.omap,pairs:aB.pairs,seq:iB.seq,set:cB.set,timestamp:h_.timestamp},qme={"tag:yaml.org,2002:binary":oB.binary,"tag:yaml.org,2002:merge":Tf.merge,"tag:yaml.org,2002:omap":sB.omap,"tag:yaml.org,2002:pairs":aB.pairs,"tag:yaml.org,2002:set":cB.set,"tag:yaml.org,2002:timestamp":h_.timestamp};function Bme(t,e,r){let n=tB.get(e);if(n&&!t)return r&&!n.includes(Tf.merge)?n.concat(Tf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(tB.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Tf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?rB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(rB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ZT.coreKnownTags=qme;ZT.getTags=Bme});var KT=v(uB=>{"use strict";var VT=De(),Hme=il(),Gme=ol(),Zme=xf(),g_=lB(),Vme=(t,e)=>t.keye.key?1:0,WT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?g_.getTags(e,"compat"):e?g_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?g_.coreKnownTags:{},this.tags=g_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,VT.MAP,{value:Hme.map}),Object.defineProperty(this,VT.SCALAR,{value:Zme.string}),Object.defineProperty(this,VT.SEQ,{value:Gme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Vme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};uB.Schema=WT});var fB=v(dB=>{"use strict";var Wme=De(),JT=vf(),Of=gf();function Kme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=JT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Of.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Wme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Of.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=JT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Of.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(JT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +${o.comment}`:n.comment}n=i}t.items[r]=o_.isPair(n)?n:new IT.Pair(n)}}else e("Expected a sequence for this tag");return t}function F6(t,e,r){let{replacer:n}=r,i=new fme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(IT.createPair(a,c,r))}return i}var pme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:M6,createNode:F6};s_.createPairs=F6;s_.pairs=pme;s_.resolvePairs=M6});var DT=v(CT=>{"use strict";var L6=De(),PT=Vo(),kf=Qo(),mme=es(),z6=a_(),ma=class t extends mme.YAMLSeq{constructor(){super(),this.add=kf.YAMLMap.prototype.add.bind(this),this.delete=kf.YAMLMap.prototype.delete.bind(this),this.get=kf.YAMLMap.prototype.get.bind(this),this.has=kf.YAMLMap.prototype.has.bind(this),this.set=kf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(L6.isPair(i)?(o=PT.toJS(i.key,"",r),s=PT.toJS(i.value,o,r)):o=PT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=z6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var hme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=z6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)L6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};CT.YAMLOMap=ma;CT.omap=hme});var G6=v(NT=>{"use strict";var U6=Dt();function q6({value:t,source:e},r){return e&&(t?B6:H6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var B6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new U6.Scalar(!0),stringify:q6},H6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new U6.Scalar(!1),stringify:q6};NT.falseTag=H6;NT.trueTag=B6});var Z6=v(c_=>{"use strict";var gme=Dt(),jT=sl(),yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jT.stringifyNumber},_me={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():jT.stringifyNumber(t)}},bme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new gme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:jT.stringifyNumber};c_.float=bme;c_.floatExp=_me;c_.floatNaN=yme});var W6=v(Af=>{"use strict";var V6=sl(),Ef=t=>typeof t=="bigint"||Number.isInteger(t);function l_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function MT(t,e,r){let{value:n}=t;if(Ef(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return V6.stringifyNumber(t)}var vme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>l_(t,2,2,r),stringify:t=>MT(t,2,"0b")},Sme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>l_(t,1,8,r),stringify:t=>MT(t,8,"0")},wme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>l_(t,0,10,r),stringify:V6.stringifyNumber},xme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>l_(t,2,16,r),stringify:t=>MT(t,16,"0x")};Af.int=wme;Af.intBin=vme;Af.intHex=xme;Af.intOct=Sme});var LT=v(FT=>{"use strict";var f_=De(),u_=Yo(),d_=Qo(),ha=class t extends d_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;f_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new u_.Pair(e.key,null):r=new u_.Pair(e,null),d_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=d_.findPair(this.items,e);return!r&&f_.isPair(n)?f_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=d_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new u_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(u_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var $me={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(f_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};FT.YAMLSet=ha;FT.set=$me});var UT=v(p_=>{"use strict";var kme=sl();function zT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function K6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return kme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Eme={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>zT(t,r),stringify:K6},Ame={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zT(t,!1),stringify:K6},J6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(J6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=zT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};p_.floatTime=Ame;p_.intTime=Eme;p_.timestamp=J6});var Q6=v(X6=>{"use strict";var Tme=il(),Ome=e_(),Rme=ol(),Ime=xf(),Pme=RT(),Y6=G6(),qT=Z6(),m_=W6(),Cme=Zy(),Dme=DT(),Nme=a_(),jme=LT(),BT=UT(),Mme=[Tme.map,Rme.seq,Ime.string,Ome.nullTag,Y6.trueTag,Y6.falseTag,m_.intBin,m_.intOct,m_.int,m_.intHex,qT.floatNaN,qT.floatExp,qT.float,Pme.binary,Cme.merge,Dme.omap,Nme.pairs,jme.set,BT.intTime,BT.floatTime,BT.timestamp];X6.schema=Mme});var lB=v(ZT=>{"use strict";var nB=il(),Fme=e_(),iB=ol(),Lme=xf(),zme=wT(),HT=$T(),GT=ET(),Ume=P6(),qme=N6(),oB=RT(),Tf=Zy(),sB=DT(),aB=a_(),eB=Q6(),cB=LT(),h_=UT(),tB=new Map([["core",Ume.schema],["failsafe",[nB.map,iB.seq,Lme.string]],["json",qme.schema],["yaml11",eB.schema],["yaml-1.1",eB.schema]]),rB={binary:oB.binary,bool:zme.boolTag,float:HT.float,floatExp:HT.floatExp,floatNaN:HT.floatNaN,floatTime:h_.floatTime,int:GT.int,intHex:GT.intHex,intOct:GT.intOct,intTime:h_.intTime,map:nB.map,merge:Tf.merge,null:Fme.nullTag,omap:sB.omap,pairs:aB.pairs,seq:iB.seq,set:cB.set,timestamp:h_.timestamp},Bme={"tag:yaml.org,2002:binary":oB.binary,"tag:yaml.org,2002:merge":Tf.merge,"tag:yaml.org,2002:omap":sB.omap,"tag:yaml.org,2002:pairs":aB.pairs,"tag:yaml.org,2002:set":cB.set,"tag:yaml.org,2002:timestamp":h_.timestamp};function Hme(t,e,r){let n=tB.get(e);if(n&&!t)return r&&!n.includes(Tf.merge)?n.concat(Tf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(tB.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Tf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?rB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(rB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ZT.coreKnownTags=Bme;ZT.getTags=Hme});var KT=v(uB=>{"use strict";var VT=De(),Gme=il(),Zme=ol(),Vme=xf(),g_=lB(),Wme=(t,e)=>t.keye.key?1:0,WT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?g_.getTags(e,"compat"):e?g_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?g_.coreKnownTags:{},this.tags=g_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,VT.MAP,{value:Gme.map}),Object.defineProperty(this,VT.SCALAR,{value:Vme.string}),Object.defineProperty(this,VT.SEQ,{value:Zme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Wme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};uB.Schema=WT});var fB=v(dB=>{"use strict";var Kme=De(),JT=vf(),Of=gf();function Jme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=JT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Of.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Kme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Of.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=JT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Of.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(JT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(Of.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Of.indentComment(o(c),"")))}return r.join(` `)+` -`}dB.stringifyDocument=Kme});var Rf=v(pB=>{"use strict";var Jme=mf(),al=jy(),On=De(),Yme=Yo(),Xme=Vo(),Qme=KT(),ehe=fB(),YT=Py(),the=tT(),rhe=hf(),XT=eT(),QT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,On.NODE_TYPE,{value:On.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new XT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[On.NODE_TYPE]:{value:On.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=On.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){cl(this.contents)&&this.contents.add(e)}addIn(e,r){cl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=YT.anchorNames(this);e.anchor=!r||n.has(r)?YT.findNewAnchor(r||"a",n):r}return new Jme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=YT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=rhe.createNode(e,u,m);return a&&On.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Yme.Pair(i,o)}delete(e){return cl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return al.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):cl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return On.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return al.isEmptyPath(e)?!r&&On.isScalar(this.contents)?this.contents.value:this.contents:On.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return On.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return al.isEmptyPath(e)?this.contents!==void 0:On.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=al.collectionFromPath(this.schema,[e],r):cl(this.contents)&&this.contents.set(e,r)}setIn(e,r){al.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=al.collectionFromPath(this.schema,Array.from(e),r):cl(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new XT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new XT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new Qme.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Xme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?the.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return ehe.stringifyDocument(this,e)}};function cl(t){if(On.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}pB.Document=QT});var Cf=v(Pf=>{"use strict";var If=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},eO=class extends If{constructor(e,r,n){super("YAMLParseError",e,r,n)}},tO=class extends If{constructor(e,r,n){super("YAMLWarning",e,r,n)}},nhe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}dB.stringifyDocument=Jme});var Rf=v(pB=>{"use strict";var Yme=mf(),al=jy(),On=De(),Xme=Yo(),Qme=Vo(),ehe=KT(),the=fB(),YT=Py(),rhe=tT(),nhe=hf(),XT=eT(),QT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,On.NODE_TYPE,{value:On.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new XT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[On.NODE_TYPE]:{value:On.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=On.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){cl(this.contents)&&this.contents.add(e)}addIn(e,r){cl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=YT.anchorNames(this);e.anchor=!r||n.has(r)?YT.findNewAnchor(r||"a",n):r}return new Yme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=YT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=nhe.createNode(e,u,m);return a&&On.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Xme.Pair(i,o)}delete(e){return cl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return al.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):cl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return On.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return al.isEmptyPath(e)?!r&&On.isScalar(this.contents)?this.contents.value:this.contents:On.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return On.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return al.isEmptyPath(e)?this.contents!==void 0:On.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=al.collectionFromPath(this.schema,[e],r):cl(this.contents)&&this.contents.set(e,r)}setIn(e,r){al.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=al.collectionFromPath(this.schema,Array.from(e),r):cl(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new XT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new XT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new ehe.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Qme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?rhe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return the.stringifyDocument(this,e)}};function cl(t){if(On.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}pB.Document=QT});var Cf=v(Pf=>{"use strict";var If=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},eO=class extends If{constructor(e,r,n){super("YAMLParseError",e,r,n)}},tO=class extends If{constructor(e,r,n){super("YAMLWarning",e,r,n)}},ihe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};Pf.YAMLError=If;Pf.YAMLParseError=eO;Pf.YAMLWarning=tO;Pf.prettifyError=nhe});var Df=v(mB=>{"use strict";function ihe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}mB.resolveProps=ihe});var y_=v(hB=>{"use strict";function rO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(rO(e.key)||rO(e.value))return!0}return!1;default:return!0}}hB.containsNewline=rO});var nO=v(gB=>{"use strict";var ohe=y_();function she(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&ohe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gB.flowIndentCheck=she});var iO=v(_B=>{"use strict";var yB=De();function ahe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||yB.isScalar(o)&&yB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}_B.mapIncludes=ahe});var $B=v(xB=>{"use strict";var bB=Yo(),che=Qo(),vB=Df(),lhe=y_(),SB=nO(),uhe=iO(),wB="All mapping items must start at the same column";function dhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??che.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=vB.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",wB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||lhe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",wB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&SB.flowIndentCheck(n.indent,f,i),r.atKey=!1,uhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=vB.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var fhe=es(),phe=Df(),mhe=nO();function hhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??fhe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=phe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&mhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}kB.resolveBlockSeq=hhe});var ll=v(AB=>{"use strict";function ghe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}AB.resolveEnd=ghe});var IB=v(RB=>{"use strict";var yhe=De(),_he=Yo(),TB=Qo(),bhe=es(),vhe=ll(),OB=Df(),She=y_(),whe=iO(),oO="Block collections are not allowed within flow collections",sO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function xhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?TB.YAMLMap:bhe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g{"use strict";function ohe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}mB.resolveProps=ohe});var y_=v(hB=>{"use strict";function rO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(rO(e.key)||rO(e.value))return!0}return!1;default:return!0}}hB.containsNewline=rO});var nO=v(gB=>{"use strict";var she=y_();function ahe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&she.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gB.flowIndentCheck=ahe});var iO=v(_B=>{"use strict";var yB=De();function che(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||yB.isScalar(o)&&yB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}_B.mapIncludes=che});var $B=v(xB=>{"use strict";var bB=Yo(),lhe=Qo(),vB=Df(),uhe=y_(),SB=nO(),dhe=iO(),wB="All mapping items must start at the same column";function fhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??lhe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=vB.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",wB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||uhe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",wB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&SB.flowIndentCheck(n.indent,f,i),r.atKey=!1,dhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=vB.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var phe=es(),mhe=Df(),hhe=nO();function ghe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??phe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=mhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&hhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}kB.resolveBlockSeq=ghe});var ll=v(AB=>{"use strict";function yhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}AB.resolveEnd=yhe});var IB=v(RB=>{"use strict";var _he=De(),bhe=Yo(),TB=Qo(),vhe=es(),She=ll(),OB=Df(),whe=y_(),xhe=iO(),oO="Block collections are not allowed within flow collections",sO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function $he({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?TB.YAMLMap:vhe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=vhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}RB.resolveFlowCollection=xhe});var CB=v(PB=>{"use strict";var $he=De(),khe=Dt(),Ehe=Qo(),Ahe=es(),The=$B(),Ohe=EB(),Rhe=IB();function aO(t,e,r,n,i,o){let s=r.type==="block-map"?The.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Ohe.resolveBlockSeq(t,e,r,n,o):Rhe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Ihe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),aO(t,e,r,i,s)}let l=aO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=$he.isNode(u)?u:new khe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}PB.composeCollection=Ihe});var lO=v(DB=>{"use strict";var cO=Dt();function Phe(t,e,r){let n=e.offset,i=Che(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?cO.Scalar.BLOCK_FOLDED:cO.Scalar.BLOCK_LITERAL,s=e.source?Dhe(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`+D.comment:A.comment=D.comment);let re=new bhe.Pair(A,$);if(r.options.keepSourceTokens&&(re.srcToken=b),s){let K=l;xhe.mapIncludes(r,K.items,A)&&i(T,"DUPLICATE_KEY","Map keys must be unique"),K.items.push(re)}else{let K=new TB.YAMLMap(r.schema);K.flow=!0,K.items.push(re);let xe=($??A).range;K.range=[A.range[0],xe[1],xe[2]],l.items.push(K)}d=$?$.range[2]:D.end}}let f=s?"}":"]",[p,...m]=n.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let g=a[0].toUpperCase()+a.substring(1),b=u?`${g} must end with a ${f}`:`${g} in block collection must be sufficiently indented and end with a ${f}`;i(d,u?"MISSING_CHAR":"BAD_INDENT",b),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){let g=She.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}RB.resolveFlowCollection=$he});var CB=v(PB=>{"use strict";var khe=De(),Ehe=Dt(),Ahe=Qo(),The=es(),Ohe=$B(),Rhe=EB(),Ihe=IB();function aO(t,e,r,n,i,o){let s=r.type==="block-map"?Ohe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Rhe.resolveBlockSeq(t,e,r,n,o):Ihe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Phe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),aO(t,e,r,i,s)}let l=aO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=khe.isNode(u)?u:new Ehe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}PB.composeCollection=Phe});var lO=v(DB=>{"use strict";var cO=Dt();function Che(t,e,r){let n=e.offset,i=Dhe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?cO.Scalar.BLOCK_FOLDED:cO.Scalar.BLOCK_LITERAL,s=e.source?Nhe(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` @@ -112,41 +112,41 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function Che({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var uO=Dt(),Nhe=ll();function jhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=uO.Scalar.PLAIN,c=Mhe(o,l);break;case"single-quoted-scalar":a=uO.Scalar.QUOTE_SINGLE,c=Fhe(o,l);break;case"double-quoted-scalar":a=uO.Scalar.QUOTE_DOUBLE,c=Lhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=Nhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Mhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),NB(t)}function Fhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),NB(t.slice(1,-1)).replace(/''/g,"'")}function NB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var uO=Dt(),jhe=ll();function Mhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=uO.Scalar.PLAIN,c=Fhe(o,l);break;case"single-quoted-scalar":a=uO.Scalar.QUOTE_SINGLE,c=Lhe(o,l);break;case"double-quoted-scalar":a=uO.Scalar.QUOTE_DOUBLE,c=zhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=jhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Fhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),NB(t)}function Lhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),NB(t.slice(1,-1)).replace(/''/g,"'")}function NB(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function zhe(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Uhe(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Uhe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function qhe(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}jB.resolveFlowScalar=jhe});var LB=v(FB=>{"use strict";var ga=De(),MB=Dt(),Bhe=lO(),Hhe=dO();function Ghe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Bhe.resolveBlockScalar(t,e,n):Hhe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Zhe(t.schema,i,c,r,n):e.type==="scalar"?l=Vhe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new MB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new MB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Zhe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Vhe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}FB.composeScalar=Ghe});var UB=v(zB=>{"use strict";function Whe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}zB.emptyScalarPosition=Whe});var HB=v(pO=>{"use strict";var Khe=mf(),Jhe=De(),Yhe=CB(),qB=LB(),Xhe=ll(),Qhe=UB(),ege={composeNode:BB,composeEmptyNode:fO};function BB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=tge(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=qB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Yhe.composeCollection(ege,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=fO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Jhe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function fO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Qhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=qB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function tge({options:t},{offset:e,source:r,end:n},i){let o=new Khe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Xhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}pO.composeEmptyNode=fO;pO.composeNode=BB});var VB=v(ZB=>{"use strict";var rge=Rf(),GB=HB(),nge=ll(),ige=Df();function oge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new rge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=ige.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?GB.composeNode(l,i,u,s):GB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=nge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}ZB.composeDoc=oge});var hO=v(JB=>{"use strict";var sge=Ge("process"),age=eT(),cge=Rf(),Nf=Cf(),WB=De(),lge=VB(),uge=ll();function jf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function KB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ga=De(),MB=Dt(),Hhe=lO(),Ghe=dO();function Zhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Hhe.resolveBlockScalar(t,e,n):Ghe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Vhe(t.schema,i,c,r,n):e.type==="scalar"?l=Whe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new MB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new MB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Vhe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Whe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}FB.composeScalar=Zhe});var UB=v(zB=>{"use strict";function Khe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}zB.emptyScalarPosition=Khe});var HB=v(pO=>{"use strict";var Jhe=mf(),Yhe=De(),Xhe=CB(),qB=LB(),Qhe=ll(),ege=UB(),tge={composeNode:BB,composeEmptyNode:fO};function BB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=rge(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=qB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Xhe.composeCollection(tge,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=fO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Yhe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function fO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ege.emptyScalarPosition(e,r,n),indent:-1,source:""},d=qB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function rge({options:t},{offset:e,source:r,end:n},i){let o=new Jhe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Qhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}pO.composeEmptyNode=fO;pO.composeNode=BB});var VB=v(ZB=>{"use strict";var nge=Rf(),GB=HB(),ige=ll(),oge=Df();function sge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new nge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=oge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?GB.composeNode(l,i,u,s):GB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=ige.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}ZB.composeDoc=sge});var hO=v(JB=>{"use strict";var age=Ge("process"),cge=eT(),lge=Rf(),Nf=Cf(),WB=De(),uge=VB(),dge=ll();function jf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function KB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=jf(r);o?this.warnings.push(new Nf.YAMLWarning(s,n,i)):this.errors.push(new Nf.YAMLParseError(s,n,i))},this.directives=new age.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=KB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var mO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=jf(r);o?this.warnings.push(new Nf.YAMLWarning(s,n,i)):this.errors.push(new Nf.YAMLParseError(s,n,i))},this.directives=new cge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=KB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} ${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(WB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];WB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=jf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=lge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=uge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new cge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};JB.Composer=mO});var QB=v(__=>{"use strict";var dge=lO(),fge=dO(),pge=Cf(),YB=bf();function mge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new pge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return fge.resolveFlowScalar(t,e,n);case"block-scalar":return dge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function hge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=YB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=jf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=uge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=dge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new lge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};JB.Composer=mO});var QB=v(__=>{"use strict";var fge=lO(),pge=dO(),mge=Cf(),YB=bf();function hge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new mge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return pge.resolveFlowScalar(t,e,n);case"block-scalar":return fge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function gge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=YB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` `,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return XB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function gge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=YB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":yge(t,c);break;case'"':gO(t,c,"double-quoted-scalar");break;case"'":gO(t,c,"single-quoted-scalar");break;default:gO(t,c,"scalar")}}function yge(t,e){let r=e.indexOf(` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function yge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=YB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":_ge(t,c);break;case'"':gO(t,c,"double-quoted-scalar");break;case"'":gO(t,c,"single-quoted-scalar");break;default:gO(t,c,"scalar")}}function _ge(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];XB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` `});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function XB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function gO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}__.createScalarToken=hge;__.resolveAsScalar=mge;__.setScalarValue=gge});var tH=v(eH=>{"use strict";var _ge=t=>"type"in t?v_(t):b_(t);function v_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=v_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=b_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=b_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=b_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function b_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=v_(e)),r)for(let o of r)i+=o.source;return n&&(i+=v_(n)),i}eH.stringify=_ge});var oH=v(iH=>{"use strict";var yO=Symbol("break visit"),bge=Symbol("skip children"),rH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nH(Object.freeze([]),t,e)}ya.BREAK=yO;ya.SKIP=bge;ya.REMOVE=rH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function nH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var _O=QB(),vge=tH(),Sge=oH(),bO="\uFEFF",vO="",SO="",wO="",wge=t=>!!t&&"items"in t,xge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function $ge(t){switch(t){case bO:return"";case vO:return"";case SO:return"";case wO:return"";default:return JSON.stringify(t)}}function kge(t){switch(t){case bO:return"byte-order-mark";case vO:return"doc-mode";case SO:return"flow-error-end";case wO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}__.createScalarToken=gge;__.resolveAsScalar=hge;__.setScalarValue=yge});var tH=v(eH=>{"use strict";var bge=t=>"type"in t?v_(t):b_(t);function v_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=v_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=b_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=b_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=b_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function b_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=v_(e)),r)for(let o of r)i+=o.source;return n&&(i+=v_(n)),i}eH.stringify=bge});var oH=v(iH=>{"use strict";var yO=Symbol("break visit"),vge=Symbol("skip children"),rH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nH(Object.freeze([]),t,e)}ya.BREAK=yO;ya.SKIP=vge;ya.REMOVE=rH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function nH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var _O=QB(),Sge=tH(),wge=oH(),bO="\uFEFF",vO="",SO="",wO="",xge=t=>!!t&&"items"in t,$ge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function kge(t){switch(t){case bO:return"";case vO:return"";case SO:return"";case wO:return"";default:return JSON.stringify(t)}}function Ege(t){switch(t){case bO:return"byte-order-mark";case vO:return"doc-mode";case SO:return"flow-error-end";case wO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}jr.createScalarToken=_O.createScalarToken;jr.resolveAsScalar=_O.resolveAsScalar;jr.setScalarValue=_O.setScalarValue;jr.stringify=vge.stringify;jr.visit=Sge.visit;jr.BOM=bO;jr.DOCUMENT=vO;jr.FLOW_END=SO;jr.SCALAR=wO;jr.isCollection=wge;jr.isScalar=xge;jr.prettyToken=$ge;jr.tokenType=kge});var kO=v(aH=>{"use strict";var Mf=S_();function Xn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var sH=new Set("0123456789ABCDEFabcdef"),Ege=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),w_=new Set(",[]{}"),Age=new Set(` ,[]{} -\r `),xO=t=>!t||Age.has(t),$O=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}jr.createScalarToken=_O.createScalarToken;jr.resolveAsScalar=_O.resolveAsScalar;jr.setScalarValue=_O.setScalarValue;jr.stringify=Sge.stringify;jr.visit=wge.visit;jr.BOM=bO;jr.DOCUMENT=vO;jr.FLOW_END=SO;jr.SCALAR=wO;jr.isCollection=xge;jr.isScalar=$ge;jr.prettyToken=kge;jr.tokenType=Ege});var kO=v(aH=>{"use strict";var Mf=S_();function Xn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var sH=new Set("0123456789ABCDEFabcdef"),Age=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),w_=new Set(",[]{}"),Tge=new Set(` ,[]{} +\r `),xO=t=>!t||Tge.has(t),$O=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` `||!i&&!this.atEnd)return e+n+1}return r===` @@ -161,43 +161,43 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Mf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Xn(o)||e&&w_.has(o))break;r=n}else if(Xn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` `,o=this.buffer[n+1]):r=n),o==="#"||e&&w_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&w_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Mf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(xO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Xn(n)||r&&w_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Xn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Ege.has(r))r=this.buffer[++e];else if(r==="%"&&sH.has(this.buffer[e+1])&&sH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&w_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Mf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(xO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Xn(n)||r&&w_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Xn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Age.has(r))r=this.buffer[++e];else if(r==="%"&&sH.has(this.buffer[e+1])&&sH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};aH.Lexer=$O});var AO=v(cH=>{"use strict";var EO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Tge=Ge("process"),lH=S_(),Oge=kO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function $_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&dH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&uH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};aH.Lexer=$O});var AO=v(cH=>{"use strict";var EO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Oge=Ge("process"),lH=S_(),Rge=kO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function $_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&dH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&uH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ts(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(fH(r.key)&&!ts(r.sep,"newline")){let s=ul(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ul(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ts(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!ts(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){$_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||ts(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=x_(n),o=ul(i);dH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};pH.Parser=TO});var _H=v(Lf=>{"use strict";var mH=hO(),Rge=Rf(),Ff=Cf(),Ige=pT(),Pge=De(),Cge=AO(),hH=OO();function gH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Cge.LineCounter||null,prettyErrors:e}}function Dge(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ff.prettifyError(t,r)),a.warnings.forEach(Ff.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yH(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ff.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ff.prettifyError(t,r)),s.warnings.forEach(Ff.prettifyError(t,r))),s}function Nge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=yH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Ige.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function jge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Pge.isDocument(t)&&!n?t.toString(r):new Rge.Document(t,n,r).toString(r)}Lf.parse=Nge;Lf.parseAllDocuments=Dge;Lf.parseDocument=yH;Lf.stringify=jge});var er=v(Ze=>{"use strict";var Mge=hO(),Fge=Rf(),Lge=KT(),RO=Cf(),zge=mf(),rs=De(),Uge=Yo(),qge=Dt(),Bge=Qo(),Hge=es(),Gge=S_(),Zge=kO(),Vge=AO(),Wge=OO(),k_=_H(),bH=uf();Ze.Composer=Mge.Composer;Ze.Document=Fge.Document;Ze.Schema=Lge.Schema;Ze.YAMLError=RO.YAMLError;Ze.YAMLParseError=RO.YAMLParseError;Ze.YAMLWarning=RO.YAMLWarning;Ze.Alias=zge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=Uge.Pair;Ze.Scalar=qge.Scalar;Ze.YAMLMap=Bge.YAMLMap;Ze.YAMLSeq=Hge.YAMLSeq;Ze.CST=Gge;Ze.Lexer=Zge.Lexer;Ze.LineCounter=Vge.LineCounter;Ze.Parser=Wge.Parser;Ze.parse=k_.parse;Ze.parseAllDocuments=k_.parseAllDocuments;Ze.parseDocument=k_.parseDocument;Ze.stringify=k_.stringify;Ze.visit=bH.visit;Ze.visitAsync=bH.visitAsync});import{execFileSync as IO}from"node:child_process";import{existsSync as E_}from"node:fs";import{join as A_,resolve as Kge}from"node:path";function Jge(t){try{let e=IO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Kge(t,e):null}catch{return null}}function PO(t){let e=Jge(t);if(!e)return null;try{if(E_(A_(e,"MERGE_HEAD")))return"merge";if(E_(A_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(E_(A_(e,"rebase-merge"))||E_(A_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return PO(t)!==null}function zf(t,e){try{let r=IO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function T_(t,e){return zf(t,e)!==null}function vH(t,e){try{let r=IO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Yge}from"node:child_process";import{existsSync as Xge,readFileSync as Qge}from"node:fs";import{join as wH}from"node:path";function pl(t,e){return Yge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=pl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){xH(t,e);let r=pl(t,["rev-parse","HEAD"]).trim(),n=eye(t,e);return{groups:tye(t,n),head:r,inventory:{after:SH(Uf(t,"spec.yaml")),before:SH(R_(t,e,"spec.yaml"))},since:e,unsharded_commits:oye(t,e)}}function CO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function xH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!T_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function eye(t,e){let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!O_(c)&&!O_(a)))if(s.startsWith("A")){let l=fl(Uf(t,c));if(!l)continue;l.status==="done"?n.push(dl(l,"added-as-done")):l.status==="archived"&&n.push(dl(l,"archived"))}else if(s.startsWith("D")){let l=fl(R_(t,e,a));l&&n.push(dl(l,"archived"))}else{let l=fl(Uf(t,c));if(!l)continue;let d=fl(R_(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(dl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(dl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(dl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function O_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function $H(t,e){xH(t,e);let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!O_(c)&&!O_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?fl(Uf(t,c)):null,f=l?null:fl(R_(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function dl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>CO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function fl(t){if(t===null)return null;let e;try{e=(0,I_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function Uf(t,e){let r=wH(t,e);if(!Xge(r))return null;try{return Qge(r,"utf8")}catch{return null}}function R_(t,e,r){try{return pl(t,["show",`${e}:${r}`])}catch{return null}}function tye(t,e){let r=rye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function rye(t){let e=Uf(t,wH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,I_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function SH(t){let e={};if(t!==null)try{let n=(0,I_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function oye(t,e){let r=pl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);nye.test(a)&&(iye.test(a)||n.push({hash:s,subject:a}))}return n}var I_,nye,iye,ml=y(()=>{"use strict";I_=St(er(),1);ba();nye=/^(feat|fix)(\([^)]*\))?!?:/,iye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as kH}from"node:child_process";import{appendFileSync as sye,existsSync as DO,mkdirSync as aye,readFileSync as cye,renameSync as lye,statSync as uye}from"node:fs";import{userInfo as dye}from"node:os";import{dirname as fye,join as jO}from"node:path";function MO(t){return jO(t,EH,pye)}function tn(t,e){let r=MO(t),n=fye(r);DO(n)||aye(n,{recursive:!0});try{DO(r)&&uye(r).size>mye&&lye(r,jO(n,AH))}catch{}sye(r,`${JSON.stringify(e)} -`,"utf8")}function NO(t){if(!DO(t))return[];let e=cye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return NO(MO(t))}function P_(t){return[...NO(jO(t,EH,AH)),...NO(MO(t))]}function rn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function hye(t){let e;try{e=kH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=dye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function gye(t){try{return kH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function qf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=gye(t),i=hye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=qf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}tn(t,rn(e,o))}catch{}}var EH,pye,AH,mye,Mr=y(()=>{"use strict";EH=".cladding",pye="events.log.jsonl",AH="events.log.1.jsonl",mye=5*1024*1024});import{execFileSync as yye}from"node:child_process";import{existsSync as TH,readdirSync as _ye,readFileSync as bye,statSync as OH}from"node:fs";import{createHash as vye}from"node:crypto";import{join as FO}from"node:path";function Sa(t){try{return yye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function LO(t){let e=[],r=FO(t,"spec.yaml");TH(r)&&OH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=FO(t,"spec",i);if(!(!TH(o)||!OH(o).isDirectory()))for(let s of _ye(o))s.endsWith(".yaml")&&e.push(FO(o,s))}e.sort();let n=vye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(bye(i)),n.update("\0")}return n.digest("hex")}function C_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:LO(t),timestamp:new Date().toISOString()};return tn(t,rn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function D_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function N_(t,e,r,n){let i=rn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return tn(t,i),i}var Bf=y(()=>{"use strict";Mr()});import{readFileSync as Sye,statSync as wye}from"node:fs";import{extname as xye,resolve as zO,sep as $ye}from"node:path";function nn(t){return Math.ceil(t.length/4)}function Aye(t,e){let r=zO(e),n=zO(r,t);return n===r||n.startsWith(r+$ye)}function IH(t,e,r,n){if(!Aye(t,e))return{path:t,omitted:"unsafe-path"};if(!kye.has(xye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>RH)return{path:t,omitted:"too-large",bytes:o}}else{let l=zO(e,t);try{o=wye(l).size}catch{return{path:t,omitted:"missing"}}if(o>RH)return{path:t,omitted:"too-large",bytes:o};try{i=Sye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Eye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};pH.Parser=TO});var _H=v(Lf=>{"use strict";var mH=hO(),Ige=Rf(),Ff=Cf(),Pge=pT(),Cge=De(),Dge=AO(),hH=OO();function gH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Dge.LineCounter||null,prettyErrors:e}}function Nge(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ff.prettifyError(t,r)),a.warnings.forEach(Ff.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yH(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ff.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ff.prettifyError(t,r)),s.warnings.forEach(Ff.prettifyError(t,r))),s}function jge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=yH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Pge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Mge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Cge.isDocument(t)&&!n?t.toString(r):new Ige.Document(t,n,r).toString(r)}Lf.parse=jge;Lf.parseAllDocuments=Nge;Lf.parseDocument=yH;Lf.stringify=Mge});var er=v(Ze=>{"use strict";var Fge=hO(),Lge=Rf(),zge=KT(),RO=Cf(),Uge=mf(),rs=De(),qge=Yo(),Bge=Dt(),Hge=Qo(),Gge=es(),Zge=S_(),Vge=kO(),Wge=AO(),Kge=OO(),k_=_H(),bH=uf();Ze.Composer=Fge.Composer;Ze.Document=Lge.Document;Ze.Schema=zge.Schema;Ze.YAMLError=RO.YAMLError;Ze.YAMLParseError=RO.YAMLParseError;Ze.YAMLWarning=RO.YAMLWarning;Ze.Alias=Uge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=qge.Pair;Ze.Scalar=Bge.Scalar;Ze.YAMLMap=Hge.YAMLMap;Ze.YAMLSeq=Gge.YAMLSeq;Ze.CST=Zge;Ze.Lexer=Vge.Lexer;Ze.LineCounter=Wge.LineCounter;Ze.Parser=Kge.Parser;Ze.parse=k_.parse;Ze.parseAllDocuments=k_.parseAllDocuments;Ze.parseDocument=k_.parseDocument;Ze.stringify=k_.stringify;Ze.visit=bH.visit;Ze.visitAsync=bH.visitAsync});import{execFileSync as IO}from"node:child_process";import{existsSync as E_}from"node:fs";import{join as A_,resolve as Jge}from"node:path";function Yge(t){try{let e=IO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Jge(t,e):null}catch{return null}}function PO(t){let e=Yge(t);if(!e)return null;try{if(E_(A_(e,"MERGE_HEAD")))return"merge";if(E_(A_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(E_(A_(e,"rebase-merge"))||E_(A_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return PO(t)!==null}function zf(t,e){try{let r=IO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function T_(t,e){return zf(t,e)!==null}function vH(t,e){try{let r=IO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Xge}from"node:child_process";import{existsSync as Qge,readFileSync as eye}from"node:fs";import{join as wH}from"node:path";function pl(t,e){return Xge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=pl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){xH(t,e);let r=pl(t,["rev-parse","HEAD"]).trim(),n=tye(t,e);return{groups:rye(t,n),head:r,inventory:{after:SH(R_(t,"spec.yaml")),before:SH(Uf(t,e,"spec.yaml"))},since:e,unsharded_commits:sye(t,e)}}function CO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function xH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!T_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function tye(t,e){let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!O_(c)&&!O_(a)))if(s.startsWith("A")){let l=fl(R_(t,c));if(!l)continue;l.status==="done"?n.push(dl(l,"added-as-done")):l.status==="archived"&&n.push(dl(l,"archived"))}else if(s.startsWith("D")){let l=fl(Uf(t,e,a));l&&n.push(dl(l,"archived"))}else{let l=fl(R_(t,c));if(!l)continue;let d=fl(Uf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(dl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(dl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(dl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function O_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function $H(t,e){xH(t,e);let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!O_(c)&&!O_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?fl(Uf(t,"HEAD",c)):null,f=l?null:fl(Uf(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function dl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>CO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function fl(t){if(t===null)return null;let e;try{e=(0,I_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function R_(t,e){let r=wH(t,e);if(!Qge(r))return null;try{return eye(r,"utf8")}catch{return null}}function Uf(t,e,r){try{return pl(t,["show",`${e}:${r}`])}catch{return null}}function rye(t,e){let r=nye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function nye(t){let e=R_(t,wH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,I_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function SH(t){let e={};if(t!==null)try{let n=(0,I_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function sye(t,e){let r=pl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);iye.test(a)&&(oye.test(a)||n.push({hash:s,subject:a}))}return n}var I_,iye,oye,ml=y(()=>{"use strict";I_=St(er(),1);ba();iye=/^(feat|fix)(\([^)]*\))?!?:/,oye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as kH}from"node:child_process";import{appendFileSync as aye,existsSync as DO,mkdirSync as cye,readFileSync as lye,renameSync as uye,statSync as dye}from"node:fs";import{userInfo as fye}from"node:os";import{dirname as pye,join as jO}from"node:path";function MO(t){return jO(t,EH,mye)}function tn(t,e){let r=MO(t),n=pye(r);DO(n)||cye(n,{recursive:!0});try{DO(r)&&dye(r).size>hye&&uye(r,jO(n,AH))}catch{}aye(r,`${JSON.stringify(e)} +`,"utf8")}function NO(t){if(!DO(t))return[];let e=lye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return NO(MO(t))}function P_(t){return[...NO(jO(t,EH,AH)),...NO(MO(t))]}function rn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function gye(t){let e;try{e=kH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=fye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function yye(t){try{return kH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function qf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=yye(t),i=gye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=qf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}tn(t,rn(e,o))}catch{}}var EH,mye,AH,hye,Mr=y(()=>{"use strict";EH=".cladding",mye="events.log.jsonl",AH="events.log.1.jsonl",hye=5*1024*1024});import{execFileSync as _ye}from"node:child_process";import{existsSync as TH,readdirSync as bye,readFileSync as vye,statSync as OH}from"node:fs";import{createHash as Sye}from"node:crypto";import{join as FO}from"node:path";function Sa(t){try{return _ye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function LO(t){let e=[],r=FO(t,"spec.yaml");TH(r)&&OH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=FO(t,"spec",i);if(!(!TH(o)||!OH(o).isDirectory()))for(let s of bye(o))s.endsWith(".yaml")&&e.push(FO(o,s))}e.sort();let n=Sye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(vye(i)),n.update("\0")}return n.digest("hex")}function C_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:LO(t),timestamp:new Date().toISOString()};return tn(t,rn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function D_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function N_(t,e,r,n){let i=rn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return tn(t,i),i}var Bf=y(()=>{"use strict";Mr()});import{readFileSync as wye,statSync as xye}from"node:fs";import{extname as $ye,resolve as zO,sep as kye}from"node:path";function nn(t){return Math.ceil(t.length/4)}function Tye(t,e){let r=zO(e),n=zO(r,t);return n===r||n.startsWith(r+kye)}function IH(t,e,r,n){if(!Tye(t,e))return{path:t,omitted:"unsafe-path"};if(!Eye.has($ye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>RH)return{path:t,omitted:"too-large",bytes:o}}else{let l=zO(e,t);try{o=xye(l).size}catch{return{path:t,omitted:"missing"}}if(o>RH)return{path:t,omitted:"too-large",bytes:o};try{i=wye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Aye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var kye,RH,Eye,j_=y(()=>{"use strict";kye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),RH=2e6,Eye="\0"});function Hf(t){for(let i of Tye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function UO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Oye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])UO(e,s,o);for(let s of i.modules??[])UO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Hf(a);c&&UO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Rn(t){let e=PH.get(t);return e||(e=Oye(t),PH.set(t,e)),e}var Tye,PH,os=y(()=>{"use strict";Tye=["derived:","fixture:","script:","self-dogfood:"];PH=new WeakMap});function qO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=Rn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Rye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=qO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:BO(i)}}var wa=y(()=>{"use strict";os()});function CH(t){return t.impacted.length}function F_(t,e,r={}){let n=r.initialDepth??M_.initialDepth,i=r.maxDepth??M_.maxDepth,o=r.coverageThreshold??M_.coverageThreshold,s=r.marginYieldThreshold??M_.marginYieldThreshold,a=Rn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=qO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=CH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var M_,HO=y(()=>{"use strict";wa();os();M_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Iye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function DH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Iye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var NH=y(()=>{"use strict"});function Pye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function hl(t,e){let r=Pye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=DH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var L_=y(()=>{"use strict";NH()});import{existsSync as MH,readdirSync as Cye,readFileSync as Dye}from"node:fs";import{join as ZO}from"node:path";function VO(t,e=jye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Mye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:VO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:VO(`done reverted \u2014 pre-push strict gate red${r}`)}}function jH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Fye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return VO(n)}function Lye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>jH(m)-jH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-Nye).map(Mye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Fye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function GO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function zye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function Uye(t,e,r){let n=GO(t,/_Rolled back at_\s*`([^`]+)`/),i=GO(t,/Last failed gate:\s*`([^`]+)`/),o=GO(t,/Retry attempts:\s*(\d+)/),s=zye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function qye(t,e){let r=ZO(t,".cladding","post-mortems");if(!MH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Cye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Uye(Dye(ZO(r,o),"utf8"),e,o))}catch{}return i}function FH(t,e){try{let r=P_(t),n=qye(t,e),i=MH(ZO(t,".cladding","events.log.1.jsonl"));return Lye(r,n,e,{truncated:i})}catch{return}}var Nye,jye,LH=y(()=>{"use strict";Mr();Nye=5,jye=120});function z_(t,e,r){return nn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Bye,o=e,s,a=Rn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=hl(t,o);if("not_found"in c)return c;let l=c.focus,u=FH(n,l.id),d=a&&a.size>0?e:l.id,f=F_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Hye&&z_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],uo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return nn(JSON.stringify(uo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],uo=0;for(;Xt.length>Ce.size&&$(Xt,K,uo,0);)Xt=Xt.slice(0,-1),uo++;let ki=[...h],en=0;for(;$(Xt,ki,uo,en);){let de=-1;for(let fo=ki.length-1;fo>=0;fo--)if(!Kt.has(ki[fo])){de=fo;break}if(de<0)break;ki.splice(de,1),en++}re=Xt,K=ki,uo+en>0&&x.push(`breaks: omitted ${uo} feature(s) / ${en} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};nn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Cr=nn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Cr,truncated:x}}}var Bye,Hye,U_=y(()=>{"use strict";j_();L_();HO();LH();wa();os();Bye=3e3,Hye=3});function Qn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Gye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function zH(t,e,r="."){let n=Rn(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=F_(t,f.id),g=!("not_found"in h),b=nn(JSON.stringify(p)),_="not_found"in m?b:nn(JSON.stringify(m)),S=nn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=nn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Qn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Qn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Qn(a(c))*10)/10,medianShrinkTruncated:Math.round(Qn(a(l))*10)/10,medianStructuralRatio:Math.round(Qn(u)*100)/100,medianSliceTokens:Math.round(Qn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Qn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Qn(o.map(f=>f.searchDepth)),p95Depth:Gye(o.map(f=>f.searchDepth),95),medianEdges:Qn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Qn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Qn(o.map(f=>f.regressionTests))},features:o}}var gl,q_=y(()=>{"use strict";j_();HO();U_();os();gl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Zye,existsSync as WO,mkdirSync as Vye,readFileSync as UH}from"node:fs";import{dirname as Wye,join as Kye}from"node:path";function KO(t){return Kye(t,Jye,Yye)}function Xye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:LO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function qH(t,e){try{let r=Xye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=JO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=KO(t),s=Wye(o);return WO(s)||Vye(s,{recursive:!0}),Zye(o,`${JSON.stringify(r)} +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var Eye,RH,Aye,j_=y(()=>{"use strict";Eye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),RH=2e6,Aye="\0"});function Hf(t){for(let i of Oye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function UO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Rye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])UO(e,s,o);for(let s of i.modules??[])UO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Hf(a);c&&UO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Rn(t){let e=PH.get(t);return e||(e=Rye(t),PH.set(t,e)),e}var Oye,PH,os=y(()=>{"use strict";Oye=["derived:","fixture:","script:","self-dogfood:"];PH=new WeakMap});function qO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=Rn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Iye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=qO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:BO(i)}}var wa=y(()=>{"use strict";os()});function CH(t){return t.impacted.length}function F_(t,e,r={}){let n=r.initialDepth??M_.initialDepth,i=r.maxDepth??M_.maxDepth,o=r.coverageThreshold??M_.coverageThreshold,s=r.marginYieldThreshold??M_.marginYieldThreshold,a=Rn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=qO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=CH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var M_,HO=y(()=>{"use strict";wa();os();M_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Pye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function DH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Pye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var NH=y(()=>{"use strict"});function Cye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function hl(t,e){let r=Cye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=DH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var L_=y(()=>{"use strict";NH()});import{existsSync as MH,readdirSync as Dye,readFileSync as Nye}from"node:fs";import{join as ZO}from"node:path";function VO(t,e=Mye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Fye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:VO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:VO(`done reverted \u2014 pre-push strict gate red${r}`)}}function jH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Lye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return VO(n)}function zye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>jH(m)-jH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-jye).map(Fye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Lye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function GO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Uye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function qye(t,e,r){let n=GO(t,/_Rolled back at_\s*`([^`]+)`/),i=GO(t,/Last failed gate:\s*`([^`]+)`/),o=GO(t,/Retry attempts:\s*(\d+)/),s=Uye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Bye(t,e){let r=ZO(t,".cladding","post-mortems");if(!MH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Dye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(qye(Nye(ZO(r,o),"utf8"),e,o))}catch{}return i}function FH(t,e){try{let r=P_(t),n=Bye(t,e),i=MH(ZO(t,".cladding","events.log.1.jsonl"));return zye(r,n,e,{truncated:i})}catch{return}}var jye,Mye,LH=y(()=>{"use strict";Mr();jye=5,Mye=120});function z_(t,e,r){return nn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Hye,o=e,s,a=Rn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=hl(t,o);if("not_found"in c)return c;let l=c.focus,u=FH(n,l.id),d=a&&a.size>0?e:l.id,f=F_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Gye&&z_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],uo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return nn(JSON.stringify(uo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],uo=0;for(;Xt.length>Ce.size&&$(Xt,K,uo,0);)Xt=Xt.slice(0,-1),uo++;let ki=[...h],en=0;for(;$(Xt,ki,uo,en);){let de=-1;for(let fo=ki.length-1;fo>=0;fo--)if(!Kt.has(ki[fo])){de=fo;break}if(de<0)break;ki.splice(de,1),en++}re=Xt,K=ki,uo+en>0&&x.push(`breaks: omitted ${uo} feature(s) / ${en} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};nn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Cr=nn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Cr,truncated:x}}}var Hye,Gye,U_=y(()=>{"use strict";j_();L_();HO();LH();wa();os();Hye=3e3,Gye=3});function Qn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Zye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function zH(t,e,r="."){let n=Rn(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=F_(t,f.id),g=!("not_found"in h),b=nn(JSON.stringify(p)),_="not_found"in m?b:nn(JSON.stringify(m)),S=nn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=nn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Qn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Qn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Qn(a(c))*10)/10,medianShrinkTruncated:Math.round(Qn(a(l))*10)/10,medianStructuralRatio:Math.round(Qn(u)*100)/100,medianSliceTokens:Math.round(Qn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Qn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Qn(o.map(f=>f.searchDepth)),p95Depth:Zye(o.map(f=>f.searchDepth),95),medianEdges:Qn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Qn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Qn(o.map(f=>f.regressionTests))},features:o}}var gl,q_=y(()=>{"use strict";j_();HO();U_();os();gl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Vye,existsSync as WO,mkdirSync as Wye,readFileSync as UH}from"node:fs";import{dirname as Kye,join as Jye}from"node:path";function KO(t){return Jye(t,Yye,Xye)}function Qye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:LO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function qH(t,e){try{let r=Qye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=JO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=KO(t),s=Kye(o);return WO(s)||Wye(s,{recursive:!0}),Vye(o,`${JSON.stringify(r)} `,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function BH(t){let e=[];for(let r of t.split(` `)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function JO(t,e){let r=KO(t);if(!WO(r))return[];let n;try{n=UH(r,"utf8")}catch{return[]}let i=BH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function HH(t){let e=KO(t);if(!WO(e))return{snapshots:[],unreadable:!1};let r;try{r=UH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=BH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Gf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function GH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Gf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${gl}`),i.join(` -`)}var Jye,Yye,Zf=y(()=>{"use strict";Bf();q_();Jye=".cladding",Yye="measure.jsonl"});import{existsSync as Qye}from"node:fs";import{join as e_e}from"node:path";function yl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${t_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}var Yye,Xye,Zf=y(()=>{"use strict";Bf();q_();Yye=".cladding",Xye="measure.jsonl"});import{existsSync as e_e}from"node:fs";import{join as t_e}from"node:path";function yl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${r_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` `)}function VH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` `);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Gf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Gf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Gf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",gl),r.join(` -`)}function _l(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${n_e(l,r)} |`)}return n.join(` -`)}function n_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of r_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Qye(e_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function bl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),ZH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)ZH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function ZH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=CO(r);n&&t.push(`- ${n}`)}t.push("")}var t_e,r_e,B_=y(()=>{"use strict";Zf();q_();ml();t_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};r_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as i_e}from"node:fs";function Ri(t="./spec.yaml"){let e=i_e(t,"utf8");return(0,WH.parse)(e)}var WH,H_=y(()=>{"use strict";WH=St(er(),1)});var ss=v((Fr,eR)=>{"use strict";var YO=Fr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+JH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};YO.prototype.toString=function(){return this.property+" "+this.message};var G_=Fr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};G_.prototype.addError=function(e){var r;if(typeof e=="string")r=new YO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new YO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};G_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function o_e(t,e){return e+": "+t.toString()+` -`}G_.prototype.toString=function(e){return this.errors.map(o_e).join("")};Object.defineProperty(G_.prototype,"valid",{get:function(){return!this.errors.length}});eR.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var KH=Fr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};KH.prototype=Object.create(Error.prototype,{constructor:{value:KH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XO=Fr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+JH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XO.prototype.resolve=function(e){return YH(this.base,e)};XO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=YH(this.base,i||"");var s=new XO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ei=Fr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ei.regexp=ei.regex;ei.pattern=ei.regex;ei.ipv4=ei["ip-address"];Fr.isFormat=function(e,r,n){if(typeof e=="string"&&ei[r]!==void 0){if(ei[r]instanceof RegExp)return ei[r].test(e);if(typeof ei[r]=="function")return ei[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var JH=Fr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Fr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function s_e(t,e,r,n){typeof r=="object"?e[n]=QO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function a_e(t,e,r){e[r]=t[r]}function c_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QO(t[n],e[n]):r[n]=e[n]}function QO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(s_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(a_e.bind(null,t,n)),Object.keys(e).forEach(c_e.bind(null,t,e,n))),n}eR.exports.deepMerge=QO;Fr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function l_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Fr.encodePath=function(e){return e.map(l_e).join("")};Fr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Fr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var YH=Fr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var tG=v((z7e,eG)=>{"use strict";var on=ss(),Le=on.ValidatorResult,as=on.SchemaError,tR={};tR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=tR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function rR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(rR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(rR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!on.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!on.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!on.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function nR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!on.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function XH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&XH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)XH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!on.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function u_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iR=ss();oR.exports.SchemaScanResult=rG;function rG(t,e){this.id=t,this.ref=e}oR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var nG=tG(),cs=ss(),iG=Z_().scan,oG=cs.ValidatorResult,d_e=cs.ValidatorResultError,Vf=cs.SchemaError,sG=cs.SchemaContext,f_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(nG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=iG(r||f_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Vf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Vf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Jt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};cG.exports=Jt});var uG=v((B7e,go)=>{"use strict";var p_e=go.exports.Validator=lG();go.exports.ValidatorResult=ss().ValidatorResult;go.exports.ValidatorResultError=ss().ValidatorResultError;go.exports.ValidationError=ss().ValidationError;go.exports.SchemaError=ss().SchemaError;go.exports.SchemaScanResult=Z_().SchemaScanResult;go.exports.scan=Z_().scan;go.exports.validate=function(t,e,r){var n=new p_e;return n.validate(t,e,r)}});import{readFileSync as m_e}from"node:fs";import{dirname as h_e,join as g_e}from"node:path";import{fileURLToPath as y_e}from"node:url";function w_e(t){let e=S_e.validate(t,v_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function fG(t){let e=w_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`)}function _l(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${i_e(l,r)} |`)}return n.join(` +`)}function i_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of n_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${e_e(t_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function bl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),ZH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)ZH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function ZH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=CO(r);n&&t.push(`- ${n}`)}t.push("")}var r_e,n_e,B_=y(()=>{"use strict";Zf();q_();ml();r_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};n_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as o_e}from"node:fs";function Ri(t="./spec.yaml"){let e=o_e(t,"utf8");return(0,WH.parse)(e)}var WH,H_=y(()=>{"use strict";WH=St(er(),1)});var ss=v((Fr,eR)=>{"use strict";var YO=Fr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+JH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};YO.prototype.toString=function(){return this.property+" "+this.message};var G_=Fr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};G_.prototype.addError=function(e){var r;if(typeof e=="string")r=new YO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new YO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};G_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function s_e(t,e){return e+": "+t.toString()+` +`}G_.prototype.toString=function(e){return this.errors.map(s_e).join("")};Object.defineProperty(G_.prototype,"valid",{get:function(){return!this.errors.length}});eR.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var KH=Fr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};KH.prototype=Object.create(Error.prototype,{constructor:{value:KH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XO=Fr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+JH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XO.prototype.resolve=function(e){return YH(this.base,e)};XO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=YH(this.base,i||"");var s=new XO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ei=Fr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ei.regexp=ei.regex;ei.pattern=ei.regex;ei.ipv4=ei["ip-address"];Fr.isFormat=function(e,r,n){if(typeof e=="string"&&ei[r]!==void 0){if(ei[r]instanceof RegExp)return ei[r].test(e);if(typeof ei[r]=="function")return ei[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var JH=Fr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Fr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function a_e(t,e,r,n){typeof r=="object"?e[n]=QO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function c_e(t,e,r){e[r]=t[r]}function l_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QO(t[n],e[n]):r[n]=e[n]}function QO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(a_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(c_e.bind(null,t,n)),Object.keys(e).forEach(l_e.bind(null,t,e,n))),n}eR.exports.deepMerge=QO;Fr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function u_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Fr.encodePath=function(e){return e.map(u_e).join("")};Fr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Fr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var YH=Fr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var tG=v((G7e,eG)=>{"use strict";var on=ss(),Le=on.ValidatorResult,as=on.SchemaError,tR={};tR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=tR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function rR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(rR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(rR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!on.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!on.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!on.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function nR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!on.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function XH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&XH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)XH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!on.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function d_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iR=ss();oR.exports.SchemaScanResult=rG;function rG(t,e){this.id=t,this.ref=e}oR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var nG=tG(),cs=ss(),iG=Z_().scan,oG=cs.ValidatorResult,f_e=cs.ValidatorResultError,Vf=cs.SchemaError,sG=cs.SchemaContext,p_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(nG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=iG(r||p_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Vf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Vf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Jt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};cG.exports=Jt});var uG=v((W7e,go)=>{"use strict";var m_e=go.exports.Validator=lG();go.exports.ValidatorResult=ss().ValidatorResult;go.exports.ValidatorResultError=ss().ValidatorResultError;go.exports.ValidationError=ss().ValidationError;go.exports.SchemaError=ss().SchemaError;go.exports.SchemaScanResult=Z_().SchemaScanResult;go.exports.scan=Z_().scan;go.exports.validate=function(t,e,r){var n=new m_e;return n.validate(t,e,r)}});import{readFileSync as h_e}from"node:fs";import{dirname as g_e,join as y_e}from"node:path";import{fileURLToPath as __e}from"node:url";function x_e(t){let e=w_e.validate(t,S_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function fG(t){let e=x_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var dG,__e,b_e,v_e,S_e,pG=y(()=>{"use strict";dG=St(uG(),1),__e=h_e(y_e(import.meta.url)),b_e=g_e(__e,"schema.json"),v_e=JSON.parse(m_e(b_e,"utf8")),S_e=new dG.Validator});import{existsSync as sR,readdirSync as x_e}from"node:fs";import{dirname as $_e,join as ka,resolve as hG}from"node:path";function mG(t){return sR(t)?x_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(ka(t,r))):[]}function Ea(t,e){V_=e?{cwd:hG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return V_&&e==="spec.yaml"&&hG(t)===V_.cwd?V_.spec:k_e(t,e)}function k_e(t,e){let r=ka(t,e),n=Ri(r),i=ka(t,$_e(e),"spec");if(!n.features||n.features.length===0){let o=mG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=mG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");sR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(sR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return fG(n),n}var V_,Ue=y(()=>{"use strict";H_();pG();V_=null});import vl from"node:process";function lR(){return!!vl.stdout.isTTY}function L(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${aR[t]}${n}${cR} ${e}${i} + `)}`)}var dG,b_e,v_e,S_e,w_e,pG=y(()=>{"use strict";dG=St(uG(),1),b_e=g_e(__e(import.meta.url)),v_e=y_e(b_e,"schema.json"),S_e=JSON.parse(h_e(v_e,"utf8")),w_e=new dG.Validator});import{existsSync as sR,readdirSync as $_e}from"node:fs";import{dirname as k_e,join as ka,resolve as hG}from"node:path";function mG(t){return sR(t)?$_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(ka(t,r))):[]}function Ea(t,e){V_=e?{cwd:hG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return V_&&e==="spec.yaml"&&hG(t)===V_.cwd?V_.spec:E_e(t,e)}function E_e(t,e){let r=ka(t,e),n=Ri(r),i=ka(t,k_e(e),"spec");if(!n.features||n.features.length===0){let o=mG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=mG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");sR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(sR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return fG(n),n}var V_,Ue=y(()=>{"use strict";H_();pG();V_=null});import vl from"node:process";function lR(){return!!vl.stdout.isTTY}function L(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${aR[t]}${n}${cR} ${e}${i} `):vl.stdout.write(`${n} ${e}${i} `)}function Wf(t,e,r=""){if(!lR())return;let n=r?` ${r}`:"";vl.stdout.write(`${yG}${aR.start}\xB7${cR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${yG}${aR[t]}${n}${cR} ${e}${i} `):vl.stdout.write(`${n} ${e}${i} -`)}var gG,aR,cR,yG,Pi=y(()=>{"use strict";gG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cR="\x1B[0m",yG="\r\x1B[K"});import{createHash as qG}from"node:crypto";import{existsSync as lbe,readFileSync as fR,writeFileSync as ube}from"node:fs";import{join as W_}from"node:path";function dbe(t,e){let r=qG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(fR(W_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function HG(t,e){let r=qG("sha256");try{r.update(fR(W_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=W_(t,...BG);if(!lbe(e))return null;let r;try{r=fR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function K_(t){return t.features?.size??t.v1?.size??0}function J_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==HG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===dbe(e,n)?{state:"fresh"}:{state:"stale"}}function GG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${HG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=fbe+`attested_modules: +`)}var gG,aR,cR,yG,Pi=y(()=>{"use strict";gG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cR="\x1B[0m",yG="\r\x1B[K"});import{createHash as qG}from"node:crypto";import{existsSync as ube,readFileSync as fR,writeFileSync as dbe}from"node:fs";import{join as W_}from"node:path";function fbe(t,e){let r=qG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(fR(W_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function HG(t,e){let r=qG("sha256");try{r.update(fR(W_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=W_(t,...BG);if(!ube(e))return null;let r;try{r=fR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function K_(t){return t.features?.size??t.v1?.size??0}function J_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==HG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===fbe(e,n)?{state:"fresh"}:{state:"stale"}}function GG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${HG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=pbe+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return ube(W_(t,...BG),s,"utf8"),!0}var BG,fbe,xl=y(()=>{"use strict";BG=["spec","attestation.yaml"];fbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return dbe(W_(t,...BG),s,"utf8"),!0}var BG,pbe,xl=y(()=>{"use strict";BG=["spec","attestation.yaml"];pbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN # \`clad check --tier=pre-push --strict\` gate \u2014 the file's one honest author. # Do not edit by hand. # @@ -212,53 +212,53 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as pR}from"node:path";function Y_(t){us={cwd:pR(t),results:new Map}}function ZG(t,e,r){!us||us.cwd!==pR(e)||us.results.set(t,r)}function X_(t,e){return!us||us.cwd!==pR(e)?null:us.results.get(t)??null}function Q_(){us=null}var us,$l=y(()=>{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var _o=y(()=>{});import{fileURLToPath as pbe}from"node:url";var kl,mbe,mR,hR,El=y(()=>{kl=(t,e)=>{let r=hR(mbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},mbe=t=>mR(t)?t.toString():t,mR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,hR=t=>t instanceof URL?pbe(t):t});var eb,gR=y(()=>{_o();El();eb=(t,e=[],r={})=>{let n=kl(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as hbe}from"node:string_decoder";var VG,WG,qt,bo,gbe,KG,ybe,tb,JG,_be,Jf,bbe,yR,vbe,sn=y(()=>{({toString:VG}=Object.prototype),WG=t=>VG.call(t)==="[object ArrayBuffer]",qt=t=>VG.call(t)==="[object Uint8Array]",bo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),gbe=new TextEncoder,KG=t=>gbe.encode(t),ybe=new TextDecoder,tb=t=>ybe.decode(t),JG=(t,e)=>_be(t,e).join(""),_be=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new hbe(e),n=t.map(o=>typeof o=="string"?KG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Jf=t=>t.length===1&&qt(t[0])?t[0]:yR(bbe(t)),bbe=t=>t.map(e=>typeof e=="string"?KG(e):e),yR=t=>{let e=new Uint8Array(vbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},vbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Sbe}from"node:child_process";var eZ,tZ,wbe,xbe,YG,$be,XG,QG,kbe,rZ=y(()=>{_o();sn();eZ=t=>Array.isArray(t)&&Array.isArray(t.raw),tZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=wbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},wbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=xbe(i,t.raw[n]),c=XG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>QG(d)):[QG(l)];return XG(c,u,a)},xbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=YG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],QG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return kbe(t);throw t instanceof Sbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},kbe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return tb(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import _R from"node:process";var ti,rb,In,nb,vo=y(()=>{ti=t=>rb.includes(t),rb=[_R.stdin,_R.stdout,_R.stderr],In=["stdin","stdout","stderr"],nb=t=>In[t]??`stdio[${t}]`});import{debuglog as Ebe}from"node:util";var iZ,bR,Abe,Tbe,Obe,Rbe,nZ,Ibe,vR,Pbe,Cbe,Dbe,Nbe,SR,So,wo=y(()=>{_o();vo();iZ=t=>{let e={...t};for(let r of SR)e[r]=bR(t,r);return e},bR=(t,e)=>{let r=Array.from({length:Abe(t)+1}),n=Tbe(t[e],r,e);return Cbe(n,e)},Abe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,In.length):In.length,Tbe=(t,e,r)=>Ot(t)?Obe(t,e,r):e.fill(t),Obe=(t,e,r)=>{for(let n of Object.keys(t).sort(Rbe))for(let i of Ibe(n,r,e))e[i]=t[n];return e},Rbe=(t,e)=>nZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Ibe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=vR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as pR}from"node:path";function Y_(t){us={cwd:pR(t),results:new Map}}function ZG(t,e,r){!us||us.cwd!==pR(e)||us.results.set(t,r)}function X_(t,e){return!us||us.cwd!==pR(e)?null:us.results.get(t)??null}function Q_(){us=null}var us,$l=y(()=>{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var _o=y(()=>{});import{fileURLToPath as mbe}from"node:url";var kl,hbe,mR,hR,El=y(()=>{kl=(t,e)=>{let r=hR(hbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},hbe=t=>mR(t)?t.toString():t,mR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,hR=t=>t instanceof URL?mbe(t):t});var eb,gR=y(()=>{_o();El();eb=(t,e=[],r={})=>{let n=kl(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as gbe}from"node:string_decoder";var VG,WG,qt,bo,ybe,KG,_be,tb,JG,bbe,Jf,vbe,yR,Sbe,sn=y(()=>{({toString:VG}=Object.prototype),WG=t=>VG.call(t)==="[object ArrayBuffer]",qt=t=>VG.call(t)==="[object Uint8Array]",bo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ybe=new TextEncoder,KG=t=>ybe.encode(t),_be=new TextDecoder,tb=t=>_be.decode(t),JG=(t,e)=>bbe(t,e).join(""),bbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new gbe(e),n=t.map(o=>typeof o=="string"?KG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Jf=t=>t.length===1&&qt(t[0])?t[0]:yR(vbe(t)),vbe=t=>t.map(e=>typeof e=="string"?KG(e):e),yR=t=>{let e=new Uint8Array(Sbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Sbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as wbe}from"node:child_process";var eZ,tZ,xbe,$be,YG,kbe,XG,QG,Ebe,rZ=y(()=>{_o();sn();eZ=t=>Array.isArray(t)&&Array.isArray(t.raw),tZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=xbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},xbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=$be(i,t.raw[n]),c=XG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>QG(d)):[QG(l)];return XG(c,u,a)},$be=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=YG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],QG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return Ebe(t);throw t instanceof wbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Ebe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return tb(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import _R from"node:process";var ti,rb,In,nb,vo=y(()=>{ti=t=>rb.includes(t),rb=[_R.stdin,_R.stdout,_R.stderr],In=["stdin","stdout","stderr"],nb=t=>In[t]??`stdio[${t}]`});import{debuglog as Abe}from"node:util";var iZ,bR,Tbe,Obe,Rbe,Ibe,nZ,Pbe,vR,Cbe,Dbe,Nbe,jbe,SR,So,wo=y(()=>{_o();vo();iZ=t=>{let e={...t};for(let r of SR)e[r]=bR(t,r);return e},bR=(t,e)=>{let r=Array.from({length:Tbe(t)+1}),n=Obe(t[e],r,e);return Dbe(n,e)},Tbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,In.length):In.length,Obe=(t,e,r)=>Ot(t)?Rbe(t,e,r):e.fill(t),Rbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Ibe))for(let i of Pbe(n,r,e))e[i]=t[n];return e},Ibe=(t,e)=>nZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Pbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=vR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},vR=t=>{if(t==="all")return t;if(In.includes(t))return In.indexOf(t);let e=Pbe.exec(t);if(e!==null)return Number(e[1])},Pbe=/^fd(\d+)$/,Cbe=(t,e)=>t.map(r=>r===void 0?Nbe[e]:r),Dbe=Ebe("execa").enabled?"full":"none",Nbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Dbe,stripFinalNewline:!0},SR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],So=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Al,Tl,oZ,wR,jbe,ib,ob,ds=y(()=>{wo();Al=({verbose:t},e)=>wR(t,e)!=="none",Tl=({verbose:t},e)=>!["none","short"].includes(wR(t,e)),oZ=({verbose:t},e)=>{let r=wR(t,e);return ib(r)?r:void 0},wR=(t,e)=>e===void 0?jbe(t):So(t,e),jbe=t=>t.find(e=>ib(e))??ob.findLast(e=>t.includes(e)),ib=t=>typeof t=="function",ob=["none","short","full"]});import{platform as Mbe}from"node:process";import{stripVTControlCharacters as Fbe}from"node:util";var sZ,Yf,aZ,Lbe,zbe,Ube,qbe,Bbe,Hbe,Gbe,sb=y(()=>{sZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Hbe(aZ(o))).join(" ");return{command:n,escapedCommand:i}},Yf=t=>Fbe(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},vR=t=>{if(t==="all")return t;if(In.includes(t))return In.indexOf(t);let e=Cbe.exec(t);if(e!==null)return Number(e[1])},Cbe=/^fd(\d+)$/,Dbe=(t,e)=>t.map(r=>r===void 0?jbe[e]:r),Nbe=Abe("execa").enabled?"full":"none",jbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Nbe,stripFinalNewline:!0},SR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],So=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Al,Tl,oZ,wR,Mbe,ib,ob,ds=y(()=>{wo();Al=({verbose:t},e)=>wR(t,e)!=="none",Tl=({verbose:t},e)=>!["none","short"].includes(wR(t,e)),oZ=({verbose:t},e)=>{let r=wR(t,e);return ib(r)?r:void 0},wR=(t,e)=>e===void 0?Mbe(t):So(t,e),Mbe=t=>t.find(e=>ib(e))??ob.findLast(e=>t.includes(e)),ib=t=>typeof t=="function",ob=["none","short","full"]});import{platform as Fbe}from"node:process";import{stripVTControlCharacters as Lbe}from"node:util";var sZ,Yf,aZ,zbe,Ube,qbe,Bbe,Hbe,Gbe,Zbe,sb=y(()=>{sZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Gbe(aZ(o))).join(" ");return{command:n,escapedCommand:i}},Yf=t=>Lbe(t).split(` `).map(e=>aZ(e)).join(` -`),aZ=t=>t.replaceAll(Ube,e=>Lbe(e)),Lbe=t=>{let e=qbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Bbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},zbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ube=zbe(),qbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Bbe=65535,Hbe=t=>Gbe.test(t)?t:Mbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Gbe=/^[\w./-]+$/});import cZ from"node:process";function xR(){let{env:t}=cZ,{TERM:e,TERM_PROGRAM:r}=t;return cZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var lZ=y(()=>{});var uZ,dZ,Zbe,Vbe,Wbe,Kbe,Jbe,ab,JQe,fZ=y(()=>{lZ();uZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},dZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Zbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Vbe={...uZ,...dZ},Wbe={...uZ,...Zbe},Kbe=xR(),Jbe=Kbe?Vbe:Wbe,ab=Jbe,JQe=Object.entries(dZ)});import Ybe from"node:tty";var Xbe,be,QQe,pZ,eet,tet,ret,net,iet,oet,set,aet,cet,uet,det,fet,pet,met,het,cb,get,yet,_et,bet,vet,wet,xet,$et,ket,mZ,Eet,hZ,Aet,Tet,Oet,Ret,Iet,Pet,Cet,Det,Net,jet,Met,$R=y(()=>{Xbe=Ybe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Xbe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},QQe=be(0,0),pZ=be(1,22),eet=be(2,22),tet=be(3,23),ret=be(4,24),net=be(53,55),iet=be(7,27),oet=be(8,28),set=be(9,29),aet=be(30,39),cet=be(31,39),uet=be(32,39),det=be(33,39),fet=be(34,39),pet=be(35,39),met=be(36,39),het=be(37,39),cb=be(90,39),get=be(40,49),yet=be(41,49),_et=be(42,49),bet=be(43,49),vet=be(44,49),wet=be(45,49),xet=be(46,49),$et=be(47,49),ket=be(100,49),mZ=be(91,39),Eet=be(92,39),hZ=be(93,39),Aet=be(94,39),Tet=be(95,39),Oet=be(96,39),Ret=be(97,39),Iet=be(101,49),Pet=be(102,49),Cet=be(103,49),Det=be(104,49),Net=be(105,49),jet=be(106,49),Met=be(107,49)});var gZ=y(()=>{$R();$R()});var bZ,eve,lb,yZ,tve,_Z,rve,vZ=y(()=>{fZ();gZ();bZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=eve(r),c=tve[t]({failed:o,reject:s,piped:n}),l=rve[t]({reject:s});return`${cb(`[${a}]`)} ${cb(`[${i}]`)} ${l(c)} ${l(e)}`},eve=t=>`${lb(t.getHours(),2)}:${lb(t.getMinutes(),2)}:${lb(t.getSeconds(),2)}.${lb(t.getMilliseconds(),3)}`,lb=(t,e)=>String(t).padStart(e,"0"),yZ=({failed:t,reject:e})=>t?e?ab.cross:ab.warning:ab.tick,tve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:yZ,duration:yZ},_Z=t=>t,rve={command:()=>pZ,output:()=>_Z,ipc:()=>_Z,error:({reject:t})=>t?mZ:hZ,duration:()=>cb}});var SZ,nve,ive,wZ=y(()=>{ds();SZ=(t,e,r)=>{let n=oZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>nve(i,o,n)).filter(i=>i!==void 0).map(i=>ive(i)).join("")},nve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ive=t=>t.endsWith(` +`),aZ=t=>t.replaceAll(qbe,e=>zbe(e)),zbe=t=>{let e=Bbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Hbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Ube=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},qbe=Ube(),Bbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Hbe=65535,Gbe=t=>Zbe.test(t)?t:Fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Zbe=/^[\w./-]+$/});import cZ from"node:process";function xR(){let{env:t}=cZ,{TERM:e,TERM_PROGRAM:r}=t;return cZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var lZ=y(()=>{});var uZ,dZ,Vbe,Wbe,Kbe,Jbe,Ybe,ab,tet,fZ=y(()=>{lZ();uZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},dZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Vbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Wbe={...uZ,...dZ},Kbe={...uZ,...Vbe},Jbe=xR(),Ybe=Jbe?Wbe:Kbe,ab=Ybe,tet=Object.entries(dZ)});import Xbe from"node:tty";var Qbe,be,iet,pZ,oet,set,aet,cet,uet,det,fet,pet,met,het,get,yet,_et,bet,vet,cb,wet,xet,$et,ket,Eet,Aet,Tet,Oet,Ret,mZ,Iet,hZ,Pet,Cet,Det,Net,jet,Met,Fet,Let,zet,Uet,qet,$R=y(()=>{Qbe=Xbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Qbe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},iet=be(0,0),pZ=be(1,22),oet=be(2,22),set=be(3,23),aet=be(4,24),cet=be(53,55),uet=be(7,27),det=be(8,28),fet=be(9,29),pet=be(30,39),met=be(31,39),het=be(32,39),get=be(33,39),yet=be(34,39),_et=be(35,39),bet=be(36,39),vet=be(37,39),cb=be(90,39),wet=be(40,49),xet=be(41,49),$et=be(42,49),ket=be(43,49),Eet=be(44,49),Aet=be(45,49),Tet=be(46,49),Oet=be(47,49),Ret=be(100,49),mZ=be(91,39),Iet=be(92,39),hZ=be(93,39),Pet=be(94,39),Cet=be(95,39),Det=be(96,39),Net=be(97,39),jet=be(101,49),Met=be(102,49),Fet=be(103,49),Let=be(104,49),zet=be(105,49),Uet=be(106,49),qet=be(107,49)});var gZ=y(()=>{$R();$R()});var bZ,tve,lb,yZ,rve,_Z,nve,vZ=y(()=>{fZ();gZ();bZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=tve(r),c=rve[t]({failed:o,reject:s,piped:n}),l=nve[t]({reject:s});return`${cb(`[${a}]`)} ${cb(`[${i}]`)} ${l(c)} ${l(e)}`},tve=t=>`${lb(t.getHours(),2)}:${lb(t.getMinutes(),2)}:${lb(t.getSeconds(),2)}.${lb(t.getMilliseconds(),3)}`,lb=(t,e)=>String(t).padStart(e,"0"),yZ=({failed:t,reject:e})=>t?e?ab.cross:ab.warning:ab.tick,rve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:yZ,duration:yZ},_Z=t=>t,nve={command:()=>pZ,output:()=>_Z,ipc:()=>_Z,error:({reject:t})=>t?mZ:hZ,duration:()=>cb}});var SZ,ive,ove,wZ=y(()=>{ds();SZ=(t,e,r)=>{let n=oZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>ive(i,o,n)).filter(i=>i!==void 0).map(i=>ove(i)).join("")},ive=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ove=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as ove}from"node:util";var Ci,sve,ave,cve,ub,lve,Ol=y(()=>{sb();vZ();wZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=sve({type:t,result:i,verboseInfo:n}),s=ave(e,o),a=SZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},sve=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),ave=(t,e)=>t.split(` -`).map(r=>cve({...e,message:r})),cve=t=>({verboseLine:bZ(t),verboseObject:t}),ub=t=>{let e=typeof t=="string"?t:ove(t);return Yf(e).replaceAll(" "," ".repeat(lve))},lve=2});var xZ,$Z=y(()=>{ds();Ol();xZ=(t,e)=>{Al(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var kZ,uve,dve,fve,EZ=y(()=>{ds();kZ=(t,e,r)=>{fve(t);let n=uve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},uve=t=>Al({verbose:t})?dve++:void 0,dve=0n,fve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ob.includes(e)&&!ib(e)){let r=ob.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as AZ}from"node:process";var db,kR,fb=y(()=>{db=()=>AZ.bigint(),kR=t=>Number(AZ.bigint()-t)/1e6});var pb,ER=y(()=>{$Z();EZ();fb();sb();wo();pb=(t,e,r)=>{let n=db(),{command:i,escapedCommand:o}=sZ(t,e),s=bR(r,"verbose"),a=kZ(s,o,{...r});return xZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var PZ=v((ltt,IZ)=>{IZ.exports=RZ;RZ.sync=mve;var TZ=Ge("fs");function pve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{jZ.exports=DZ;DZ.sync=hve;var CZ=Ge("fs");function DZ(t,e,r){CZ.stat(t,function(n,i){r(n,n?!1:NZ(i,e))})}function hve(t,e){return NZ(CZ.statSync(t),e)}function NZ(t,e){return t.isFile()&&gve(t,e)}function gve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var LZ=v((ftt,FZ)=>{var dtt=Ge("fs"),mb;process.platform==="win32"||global.TESTING_WINDOWS?mb=PZ():mb=MZ();FZ.exports=AR;AR.sync=yve;function AR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){AR(t,e||{},function(o,s){o?i(o):n(s)})})}mb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function yve(t,e){try{return mb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var ZZ=v((ptt,GZ)=>{var Rl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zZ=Ge("path"),_ve=Rl?";":":",UZ=LZ(),qZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),BZ=(t,e)=>{let r=e.colon||_ve,n=t.match(/\//)||Rl&&t.match(/\\/)?[""]:[...Rl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Rl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Rl?i.split(r):[""];return Rl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},HZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=BZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(qZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=zZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];UZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},bve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=BZ(t,e),o=[];for(let s=0;s{"use strict";var VZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TR.exports=VZ;TR.exports.default=VZ});var XZ=v((htt,YZ)=>{"use strict";var KZ=Ge("path"),vve=ZZ(),Sve=WZ();function JZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=vve.sync(t.command,{path:r[Sve({env:r})],pathExt:e?KZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=KZ.resolve(i?t.options.cwd:"",s)),s}function wve(t){return JZ(t)||JZ(t,!0)}YZ.exports=wve});var QZ=v((gtt,RR)=>{"use strict";var OR=/([()\][%!^"`<>&|;, *?])/g;function xve(t){return t=t.replace(OR,"^$1"),t}function $ve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OR,"^$1"),e&&(t=t.replace(OR,"^$1")),t}RR.exports.command=xve;RR.exports.argument=$ve});var t9=v((ytt,e9)=>{"use strict";e9.exports=/^#!(.*)/});var n9=v((_tt,r9)=>{"use strict";var kve=t9();r9.exports=(t="")=>{let e=t.match(kve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var o9=v((btt,i9)=>{"use strict";var IR=Ge("fs"),Eve=n9();function Ave(t){let r=Buffer.alloc(150),n;try{n=IR.openSync(t,"r"),IR.readSync(n,r,0,150,0),IR.closeSync(n)}catch{}return Eve(r.toString())}i9.exports=Ave});var l9=v((vtt,c9)=>{"use strict";var Tve=Ge("path"),s9=XZ(),a9=QZ(),Ove=o9(),Rve=process.platform==="win32",Ive=/\.(?:com|exe)$/i,Pve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Cve(t){t.file=s9(t);let e=t.file&&Ove(t.file);return e?(t.args.unshift(t.file),t.command=e,s9(t)):t.file}function Dve(t){if(!Rve)return t;let e=Cve(t),r=!Ive.test(e);if(t.options.forceShell||r){let n=Pve.test(e);t.command=Tve.normalize(t.command),t.command=a9.command(t.command),t.args=t.args.map(o=>a9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Nve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Dve(n)}c9.exports=Nve});var f9=v((Stt,d9)=>{"use strict";var PR=process.platform==="win32";function CR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function jve(t,e){if(!PR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=u9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function u9(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawn"):null}function Mve(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawnSync"):null}d9.exports={hookChildProcess:jve,verifyENOENT:u9,verifyENOENTSync:Mve,notFoundError:CR}});var h9=v((wtt,Il)=>{"use strict";var p9=Ge("child_process"),DR=l9(),NR=f9();function m9(t,e,r){let n=DR(t,e,r),i=p9.spawn(n.command,n.args,n.options);return NR.hookChildProcess(i,n),i}function Fve(t,e,r){let n=DR(t,e,r),i=p9.spawnSync(n.command,n.args,n.options);return i.error=i.error||NR.verifyENOENTSync(i.status,n),i}Il.exports=m9;Il.exports.spawn=m9;Il.exports.sync=Fve;Il.exports._parse=DR;Il.exports._enoent=NR});function hb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var g9=y(()=>{});var y9=y(()=>{});import{promisify as Lve}from"node:util";import{execFile as zve,execFileSync as Att}from"node:child_process";import _9 from"node:path";import{fileURLToPath as Uve}from"node:url";function gb(t){return t instanceof URL?Uve(t):t}function b9(t){return{*[Symbol.iterator](){let e=_9.resolve(gb(t)),r;for(;r!==e;)yield e,r=e,e=_9.resolve(e,"..")}}}var Rtt,Itt,v9=y(()=>{y9();Rtt=Lve(zve);Itt=10*1024*1024});import yb from"node:process";import Ra from"node:path";var qve,Bve,Hve,S9,w9=y(()=>{g9();v9();qve=({cwd:t=yb.cwd(),path:e=yb.env[hb()],preferLocal:r=!0,execPath:n=yb.execPath,addExecPath:i=!0}={})=>{let o=Ra.resolve(gb(t)),s=[],a=e.split(Ra.delimiter);return r&&Bve(s,a,o),i&&Hve(s,a,n,o),e===""||e===Ra.delimiter?`${s.join(Ra.delimiter)}${e}`:[...s,e].join(Ra.delimiter)},Bve=(t,e,r)=>{for(let n of b9(r)){let i=Ra.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Hve=(t,e,r,n)=>{let i=Ra.resolve(n,gb(r),"..");e.includes(i)||t.push(i)},S9=({env:t=yb.env,...e}={})=>{t={...t};let r=hb({env:t});return e.path=t[r],t[r]=qve(e),t}});var x9,ri,$9,k9,E9,_b,Xf,Qf,Ia=y(()=>{x9=(t,e,r)=>{let n=r?Qf:Xf,i=t instanceof ri?{}:{cause:t};return new n(e,i)},ri=class extends Error{},$9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,E9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},k9=t=>_b(t)&&E9 in t,E9=Symbol("isExecaError"),_b=t=>Object.prototype.toString.call(t)==="[object Error]",Xf=class extends Error{};$9(Xf,Xf.name);Qf=class extends Error{};$9(Qf,Qf.name)});var A9,Gve,T9,O9,R9=y(()=>{A9=()=>{let t=O9-T9+1;return Array.from({length:t},Gve)},Gve=(t,e)=>({name:`SIGRT${e+1}`,number:T9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),T9=34,O9=64});var I9,P9=y(()=>{I9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Zve}from"node:os";var jR,Vve,C9=y(()=>{P9();R9();jR=()=>{let t=A9();return[...I9,...t].map(Vve)},Vve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Zve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Wve}from"node:os";var Kve,Jve,D9,Yve,Xve,Qve,Wtt,N9=y(()=>{C9();Kve=()=>{let t=jR();return Object.fromEntries(t.map(Jve))},Jve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],D9=Kve(),Yve=()=>{let t=jR(),e=65,r=Array.from({length:e},(n,i)=>Xve(i,t));return Object.assign({},...r)},Xve=(t,e)=>{let r=Qve(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},Qve=(t,e)=>{let r=e.find(({name:n})=>Wve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Wtt=Yve()});import{constants as ep}from"node:os";var M9,F9,L9,eSe,tSe,j9,rSe,MR,nSe,iSe,bb,tp=y(()=>{N9();M9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return L9(t,e)},F9=t=>t===0?t:L9(t,"`subprocess.kill()`'s argument"),L9=(t,e)=>{if(Number.isInteger(t))return eSe(t,e);if(typeof t=="string")return rSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${MR()}`)},eSe=(t,e)=>{if(j9.has(t))return j9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${MR()}`)},tSe=()=>new Map(Object.entries(ep.signals).reverse().map(([t,e])=>[e,t])),j9=tSe(),rSe=(t,e)=>{if(t in ep.signals)return t;throw t.toUpperCase()in ep.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${MR()}`)},MR=()=>`Available signal names: ${nSe()}. -Available signal numbers: ${iSe()}.`,nSe=()=>Object.keys(ep.signals).sort().map(t=>`'${t}'`).join(", "),iSe=()=>[...new Set(Object.values(ep.signals).sort((t,e)=>t-e))].join(", "),bb=t=>D9[t].description});import{setTimeout as oSe}from"node:timers/promises";var z9,sSe,U9,aSe,cSe,lSe,FR,vb=y(()=>{Ia();tp();z9=t=>{if(t===!1)return t;if(t===!0)return sSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},sSe=1e3*5,U9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=aSe(s,a,r);cSe(l,n);let u=t(c);return lSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},aSe=(t,e,r)=>{let[n=r,i]=_b(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!_b(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:F9(n),error:i}},cSe=(t,e)=>{t!==void 0&&e.reject(t)},lSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await oSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as uSe}from"node:events";var Sb,LR=y(()=>{Sb=async(t,e)=>{t.aborted||await uSe(t,"abort",{signal:e})}});var q9,B9,dSe,zR=y(()=>{LR();q9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},B9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[dSe(t,e,n,i)],dSe=async(t,e,r,{signal:n})=>{throw await Sb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Pl,fSe,UR,H9,G9,wb,Z9,V9,W9,K9,J9,Y9,pSe,mSe,hSe,ni,gSe,fs,Cl,Dl=y(()=>{Pl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{fSe(t,e,r),UR(t,e,n)},fSe=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},UR=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},H9=t=>{throw new Error(`${ni("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},G9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as sve}from"node:util";var Ci,ave,cve,lve,ub,uve,Ol=y(()=>{sb();vZ();wZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ave({type:t,result:i,verboseInfo:n}),s=cve(e,o),a=SZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ave=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),cve=(t,e)=>t.split(` +`).map(r=>lve({...e,message:r})),lve=t=>({verboseLine:bZ(t),verboseObject:t}),ub=t=>{let e=typeof t=="string"?t:sve(t);return Yf(e).replaceAll(" "," ".repeat(uve))},uve=2});var xZ,$Z=y(()=>{ds();Ol();xZ=(t,e)=>{Al(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var kZ,dve,fve,pve,EZ=y(()=>{ds();kZ=(t,e,r)=>{pve(t);let n=dve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},dve=t=>Al({verbose:t})?fve++:void 0,fve=0n,pve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ob.includes(e)&&!ib(e)){let r=ob.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as AZ}from"node:process";var db,kR,fb=y(()=>{db=()=>AZ.bigint(),kR=t=>Number(AZ.bigint()-t)/1e6});var pb,ER=y(()=>{$Z();EZ();fb();sb();wo();pb=(t,e,r)=>{let n=db(),{command:i,escapedCommand:o}=sZ(t,e),s=bR(r,"verbose"),a=kZ(s,o,{...r});return xZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var PZ=v((mtt,IZ)=>{IZ.exports=RZ;RZ.sync=hve;var TZ=Ge("fs");function mve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{jZ.exports=DZ;DZ.sync=gve;var CZ=Ge("fs");function DZ(t,e,r){CZ.stat(t,function(n,i){r(n,n?!1:NZ(i,e))})}function gve(t,e){return NZ(CZ.statSync(t),e)}function NZ(t,e){return t.isFile()&&yve(t,e)}function yve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var LZ=v((ytt,FZ)=>{var gtt=Ge("fs"),mb;process.platform==="win32"||global.TESTING_WINDOWS?mb=PZ():mb=MZ();FZ.exports=AR;AR.sync=_ve;function AR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){AR(t,e||{},function(o,s){o?i(o):n(s)})})}mb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function _ve(t,e){try{return mb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var ZZ=v((_tt,GZ)=>{var Rl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zZ=Ge("path"),bve=Rl?";":":",UZ=LZ(),qZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),BZ=(t,e)=>{let r=e.colon||bve,n=t.match(/\//)||Rl&&t.match(/\\/)?[""]:[...Rl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Rl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Rl?i.split(r):[""];return Rl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},HZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=BZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(qZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=zZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];UZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},vve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=BZ(t,e),o=[];for(let s=0;s{"use strict";var VZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TR.exports=VZ;TR.exports.default=VZ});var XZ=v((vtt,YZ)=>{"use strict";var KZ=Ge("path"),Sve=ZZ(),wve=WZ();function JZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Sve.sync(t.command,{path:r[wve({env:r})],pathExt:e?KZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=KZ.resolve(i?t.options.cwd:"",s)),s}function xve(t){return JZ(t)||JZ(t,!0)}YZ.exports=xve});var QZ=v((Stt,RR)=>{"use strict";var OR=/([()\][%!^"`<>&|;, *?])/g;function $ve(t){return t=t.replace(OR,"^$1"),t}function kve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OR,"^$1"),e&&(t=t.replace(OR,"^$1")),t}RR.exports.command=$ve;RR.exports.argument=kve});var t9=v((wtt,e9)=>{"use strict";e9.exports=/^#!(.*)/});var n9=v((xtt,r9)=>{"use strict";var Eve=t9();r9.exports=(t="")=>{let e=t.match(Eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var o9=v(($tt,i9)=>{"use strict";var IR=Ge("fs"),Ave=n9();function Tve(t){let r=Buffer.alloc(150),n;try{n=IR.openSync(t,"r"),IR.readSync(n,r,0,150,0),IR.closeSync(n)}catch{}return Ave(r.toString())}i9.exports=Tve});var l9=v((ktt,c9)=>{"use strict";var Ove=Ge("path"),s9=XZ(),a9=QZ(),Rve=o9(),Ive=process.platform==="win32",Pve=/\.(?:com|exe)$/i,Cve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Dve(t){t.file=s9(t);let e=t.file&&Rve(t.file);return e?(t.args.unshift(t.file),t.command=e,s9(t)):t.file}function Nve(t){if(!Ive)return t;let e=Dve(t),r=!Pve.test(e);if(t.options.forceShell||r){let n=Cve.test(e);t.command=Ove.normalize(t.command),t.command=a9.command(t.command),t.args=t.args.map(o=>a9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function jve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Nve(n)}c9.exports=jve});var f9=v((Ett,d9)=>{"use strict";var PR=process.platform==="win32";function CR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Mve(t,e){if(!PR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=u9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function u9(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawn"):null}function Fve(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawnSync"):null}d9.exports={hookChildProcess:Mve,verifyENOENT:u9,verifyENOENTSync:Fve,notFoundError:CR}});var h9=v((Att,Il)=>{"use strict";var p9=Ge("child_process"),DR=l9(),NR=f9();function m9(t,e,r){let n=DR(t,e,r),i=p9.spawn(n.command,n.args,n.options);return NR.hookChildProcess(i,n),i}function Lve(t,e,r){let n=DR(t,e,r),i=p9.spawnSync(n.command,n.args,n.options);return i.error=i.error||NR.verifyENOENTSync(i.status,n),i}Il.exports=m9;Il.exports.spawn=m9;Il.exports.sync=Lve;Il.exports._parse=DR;Il.exports._enoent=NR});function hb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var g9=y(()=>{});var y9=y(()=>{});import{promisify as zve}from"node:util";import{execFile as Uve,execFileSync as Ptt}from"node:child_process";import _9 from"node:path";import{fileURLToPath as qve}from"node:url";function gb(t){return t instanceof URL?qve(t):t}function b9(t){return{*[Symbol.iterator](){let e=_9.resolve(gb(t)),r;for(;r!==e;)yield e,r=e,e=_9.resolve(e,"..")}}}var Ntt,jtt,v9=y(()=>{y9();Ntt=zve(Uve);jtt=10*1024*1024});import yb from"node:process";import Ra from"node:path";var Bve,Hve,Gve,S9,w9=y(()=>{g9();v9();Bve=({cwd:t=yb.cwd(),path:e=yb.env[hb()],preferLocal:r=!0,execPath:n=yb.execPath,addExecPath:i=!0}={})=>{let o=Ra.resolve(gb(t)),s=[],a=e.split(Ra.delimiter);return r&&Hve(s,a,o),i&&Gve(s,a,n,o),e===""||e===Ra.delimiter?`${s.join(Ra.delimiter)}${e}`:[...s,e].join(Ra.delimiter)},Hve=(t,e,r)=>{for(let n of b9(r)){let i=Ra.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Gve=(t,e,r,n)=>{let i=Ra.resolve(n,gb(r),"..");e.includes(i)||t.push(i)},S9=({env:t=yb.env,...e}={})=>{t={...t};let r=hb({env:t});return e.path=t[r],t[r]=Bve(e),t}});var x9,ri,$9,k9,E9,_b,Xf,Qf,Ia=y(()=>{x9=(t,e,r)=>{let n=r?Qf:Xf,i=t instanceof ri?{}:{cause:t};return new n(e,i)},ri=class extends Error{},$9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,E9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},k9=t=>_b(t)&&E9 in t,E9=Symbol("isExecaError"),_b=t=>Object.prototype.toString.call(t)==="[object Error]",Xf=class extends Error{};$9(Xf,Xf.name);Qf=class extends Error{};$9(Qf,Qf.name)});var A9,Zve,T9,O9,R9=y(()=>{A9=()=>{let t=O9-T9+1;return Array.from({length:t},Zve)},Zve=(t,e)=>({name:`SIGRT${e+1}`,number:T9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),T9=34,O9=64});var I9,P9=y(()=>{I9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Vve}from"node:os";var jR,Wve,C9=y(()=>{P9();R9();jR=()=>{let t=A9();return[...I9,...t].map(Wve)},Wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Vve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Kve}from"node:os";var Jve,Yve,D9,Xve,Qve,eSe,Qtt,N9=y(()=>{C9();Jve=()=>{let t=jR();return Object.fromEntries(t.map(Yve))},Yve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],D9=Jve(),Xve=()=>{let t=jR(),e=65,r=Array.from({length:e},(n,i)=>Qve(i,t));return Object.assign({},...r)},Qve=(t,e)=>{let r=eSe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},eSe=(t,e)=>{let r=e.find(({name:n})=>Kve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Qtt=Xve()});import{constants as ep}from"node:os";var M9,F9,L9,tSe,rSe,j9,nSe,MR,iSe,oSe,bb,tp=y(()=>{N9();M9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return L9(t,e)},F9=t=>t===0?t:L9(t,"`subprocess.kill()`'s argument"),L9=(t,e)=>{if(Number.isInteger(t))return tSe(t,e);if(typeof t=="string")return nSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${MR()}`)},tSe=(t,e)=>{if(j9.has(t))return j9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${MR()}`)},rSe=()=>new Map(Object.entries(ep.signals).reverse().map(([t,e])=>[e,t])),j9=rSe(),nSe=(t,e)=>{if(t in ep.signals)return t;throw t.toUpperCase()in ep.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${MR()}`)},MR=()=>`Available signal names: ${iSe()}. +Available signal numbers: ${oSe()}.`,iSe=()=>Object.keys(ep.signals).sort().map(t=>`'${t}'`).join(", "),oSe=()=>[...new Set(Object.values(ep.signals).sort((t,e)=>t-e))].join(", "),bb=t=>D9[t].description});import{setTimeout as sSe}from"node:timers/promises";var z9,aSe,U9,cSe,lSe,uSe,FR,vb=y(()=>{Ia();tp();z9=t=>{if(t===!1)return t;if(t===!0)return aSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},aSe=1e3*5,U9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=cSe(s,a,r);lSe(l,n);let u=t(c);return uSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},cSe=(t,e,r)=>{let[n=r,i]=_b(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!_b(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:F9(n),error:i}},lSe=(t,e)=>{t!==void 0&&e.reject(t)},uSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await sSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as dSe}from"node:events";var Sb,LR=y(()=>{Sb=async(t,e)=>{t.aborted||await dSe(t,"abort",{signal:e})}});var q9,B9,fSe,zR=y(()=>{LR();q9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},B9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[fSe(t,e,n,i)],fSe=async(t,e,r,{signal:n})=>{throw await Sb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Pl,pSe,UR,H9,G9,wb,Z9,V9,W9,K9,J9,Y9,mSe,hSe,gSe,ni,ySe,fs,Cl,Dl=y(()=>{Pl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{pSe(t,e,r),UR(t,e,n)},pSe=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},UR=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},H9=t=>{throw new Error(`${ni("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},G9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${ni("getOneMessage",t)}, ${ni("sendMessage",t,"message, {strict: true}")}, -]);`)},wb=(t,e)=>new Error(`${ni("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),Z9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},V9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},W9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),K9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},J9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ni(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},Y9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(pSe(t))throw new Error(`${ni(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},pSe=({code:t,message:e})=>mSe.has(t)||hSe.some(r=>e.includes(r)),mSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),hSe=["could not be cloned","circular structure","call stack size exceeded"],ni=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${gSe(e)}${t}(${r})`,gSe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Cl=t=>{t.connected&&t.disconnect()}});var Di,Nl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var $b,jl,Ni,X9,ySe,_Se,Q9,bSe,eV,rp,xb,ps=y(()=>{wo();$b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Q9(o,e,n,!0));return s},jl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Q9(o,e,n,!1));return s},Ni=new WeakMap,X9=(t,e,r)=>{let n=ySe(e,r);return _Se(n,e,r,t),n},ySe=(t,e)=>{let r=vR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${rp(e)}" must not be "${t}". +]);`)},wb=(t,e)=>new Error(`${ni("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),Z9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},V9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},W9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),K9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},J9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ni(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},Y9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(mSe(t))throw new Error(`${ni(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},mSe=({code:t,message:e})=>hSe.has(t)||gSe.some(r=>e.includes(r)),hSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),gSe=["could not be cloned","circular structure","call stack size exceeded"],ni=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${ySe(e)}${t}(${r})`,ySe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Cl=t=>{t.connected&&t.disconnect()}});var Di,Nl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var $b,jl,Ni,X9,_Se,bSe,Q9,vSe,eV,rp,xb,ps=y(()=>{wo();$b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Q9(o,e,n,!0));return s},jl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Q9(o,e,n,!1));return s},Ni=new WeakMap,X9=(t,e,r)=>{let n=_Se(e,r);return bSe(n,e,r,t),n},_Se=(t,e)=>{let r=vR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${rp(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},_Se=(t,e,r,n)=>{let i=n[eV(t)];if(i===void 0)throw new TypeError(`"${rp(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Q9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=bSe(t,r);return`The "${i}: ${xb(o)}" option is incompatible with using "${rp(n)}: ${xb(e)}". -Please set this option with "pipe" instead.`},bSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=eV(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},eV=t=>t==="all"?1:t,rp=t=>t?"to":"from",xb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as vSe}from"node:events";var Pa,kb=y(()=>{Pa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),vSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Eb,qR,Ab,BR,tV,rV,np=y(()=>{Eb=(t,e)=>{e&&qR(t)},qR=t=>{t.refCounted()},Ab=(t,e)=>{e&&BR(t)},BR=t=>{t.unrefCounted()},tV=(t,e)=>{e&&(BR(t),BR(t))},rV=(t,e)=>{e&&(qR(t),qR(t))}});import{once as SSe}from"node:events";import{scheduler as wSe}from"node:timers/promises";var nV,iV,Tb,oV=y(()=>{Rb();np();Ob();Ib();nV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(aV(i)||lV(i))return;Tb.has(t)||Tb.set(t,[]);let o=Tb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await cV(t,n,i),await wSe.yield();let s=await sV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},iV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HR();let o=Tb.get(t);for(;o?.length>0;)await SSe(n,"message:done");t.removeListener("message",i),rV(e,r),n.connected=!1,n.emit("disconnect")},Tb=new WeakMap});import{EventEmitter as xSe}from"node:events";var ms,Pb,$Se,Cb,ip=y(()=>{oV();np();ms=(t,e,r)=>{if(Pb.has(t))return Pb.get(t);let n=new xSe;return n.connected=!0,Pb.set(t,n),$Se({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Pb=new WeakMap,$Se=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=nV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",iV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),tV(r,n)},Cb=t=>{let e=Pb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as kSe}from"node:events";var uV,ESe,dV,sV,aV,fV,Db,ASe,Nb,pV,Ob=y(()=>{Nl();kb();Fb();Dl();ip();Rb();uV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=jb(t,o);return{id:ESe++,type:Nb,message:n,hasListeners:s}},ESe=0n,dV=(t,e)=>{if(!(e?.type!==Nb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Db[r].resolve({isDeadlock:!0,hasListeners:!1})},sV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Nb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:pV,message:jb(e,i)};try{await Mb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},aV=t=>{if(t?.type!==pV)return!1;let{id:e,message:r}=t;return Db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},fV=async(t,e,r)=>{if(t?.type!==Nb)return;let n=Di();Db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,ASe(e,r,i)]);o&&G9(r),s||Z9(r)}finally{i.abort(),delete Db[t.id]}},Db={},ASe=async(t,e,{signal:r})=>{Pa(t,1,r),await kSe(t,"disconnect",{signal:r}),V9(e)},Nb="execa:ipc:request",pV="execa:ipc:response"});var mV,hV,cV,op,jb,TSe,Rb=y(()=>{Nl();wo();ps();Ob();mV=(t,e,r)=>{op.has(t)||op.set(t,new Set);let n=op.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},hV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},cV=async(t,e,r)=>{for(;!jb(t,e)&&op.get(t)?.size>0;){let n=[...op.get(t)];dV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},op=new WeakMap,jb=(t,e)=>e.listenerCount("message")>TSe(t),TSe=t=>Ni.has(t)&&!So(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as OSe}from"node:util";var Mb,RSe,ZR,ISe,GR,Fb=y(()=>{Dl();Rb();Ob();Mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Pl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),RSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},RSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=uV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=mV(t,s,o);try{await ZR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Cl(t),c}finally{hV(a)}},ZR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ISe(t);try{await Promise.all([fV(n,t,r),o(n)])}catch(s){throw J9({error:s,methodName:e,isSubprocess:r}),Y9({error:s,methodName:e,isSubprocess:r,message:i}),s}},ISe=t=>{if(GR.has(t))return GR.get(t);let e=OSe(t.send.bind(t));return GR.set(t,e),e},GR=new WeakMap});import{scheduler as PSe}from"node:timers/promises";var yV,_V,CSe,gV,lV,bV,HR,VR,Ib=y(()=>{Fb();ip();Dl();yV=(t,e)=>{let r="cancelSignal";return UR(r,!1,t.connected),ZR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:bV,message:e},message:e})},_V=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await CSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),VR.signal),CSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!gV){if(gV=!0,!n){K9();return}if(e===null){HR();return}ms(t,e,r),await PSe.yield()}},gV=!1,lV=t=>t?.type!==bV?!1:(VR.abort(t.message),!0),bV="execa:ipc:cancel",HR=()=>{VR.abort(W9())},VR=new AbortController});var vV,SV,DSe,NSe,WR=y(()=>{LR();Ib();vb();vV=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},SV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[DSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],DSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Sb(e,i);let o=NSe(e);throw await yV(t,o),FR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},NSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as jSe}from"node:timers/promises";var wV,xV,MSe,KR=y(()=>{Ia();wV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},xV=(t,e,r,n)=>e===0||e===void 0?[]:[MSe(t,e,r,n)],MSe=async(t,e,r,{signal:n})=>{throw await jSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ri}});import{execPath as FSe,execArgv as LSe}from"node:process";import $V from"node:path";var kV,EV,JR=y(()=>{El();kV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},EV=(t,e,{node:r=!1,nodePath:n=FSe,nodeOptions:i=LSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=kl(n,'The "nodePath" option'),l=$V.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if($V.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as zSe}from"node:v8";var AV,USe,qSe,BSe,TV,YR=y(()=>{AV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");BSe[r](t)}},USe=t=>{try{zSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},qSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},BSe={advanced:USe,json:qSe},TV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var RV,HSe,an,XR,GSe,OV,Lb,Ca=y(()=>{RV=({encoding:t})=>{if(XR.has(t))return;let e=GSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. +It is optional and defaults to "${i}".`)},bSe=(t,e,r,n)=>{let i=n[eV(t)];if(i===void 0)throw new TypeError(`"${rp(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Q9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=vSe(t,r);return`The "${i}: ${xb(o)}" option is incompatible with using "${rp(n)}: ${xb(e)}". +Please set this option with "pipe" instead.`},vSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=eV(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},eV=t=>t==="all"?1:t,rp=t=>t?"to":"from",xb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as SSe}from"node:events";var Pa,kb=y(()=>{Pa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),SSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Eb,qR,Ab,BR,tV,rV,np=y(()=>{Eb=(t,e)=>{e&&qR(t)},qR=t=>{t.refCounted()},Ab=(t,e)=>{e&&BR(t)},BR=t=>{t.unrefCounted()},tV=(t,e)=>{e&&(BR(t),BR(t))},rV=(t,e)=>{e&&(qR(t),qR(t))}});import{once as wSe}from"node:events";import{scheduler as xSe}from"node:timers/promises";var nV,iV,Tb,oV=y(()=>{Rb();np();Ob();Ib();nV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(aV(i)||lV(i))return;Tb.has(t)||Tb.set(t,[]);let o=Tb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await cV(t,n,i),await xSe.yield();let s=await sV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},iV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HR();let o=Tb.get(t);for(;o?.length>0;)await wSe(n,"message:done");t.removeListener("message",i),rV(e,r),n.connected=!1,n.emit("disconnect")},Tb=new WeakMap});import{EventEmitter as $Se}from"node:events";var ms,Pb,kSe,Cb,ip=y(()=>{oV();np();ms=(t,e,r)=>{if(Pb.has(t))return Pb.get(t);let n=new $Se;return n.connected=!0,Pb.set(t,n),kSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Pb=new WeakMap,kSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=nV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",iV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),tV(r,n)},Cb=t=>{let e=Pb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as ESe}from"node:events";var uV,ASe,dV,sV,aV,fV,Db,TSe,Nb,pV,Ob=y(()=>{Nl();kb();Fb();Dl();ip();Rb();uV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=jb(t,o);return{id:ASe++,type:Nb,message:n,hasListeners:s}},ASe=0n,dV=(t,e)=>{if(!(e?.type!==Nb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Db[r].resolve({isDeadlock:!0,hasListeners:!1})},sV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Nb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:pV,message:jb(e,i)};try{await Mb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},aV=t=>{if(t?.type!==pV)return!1;let{id:e,message:r}=t;return Db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},fV=async(t,e,r)=>{if(t?.type!==Nb)return;let n=Di();Db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,TSe(e,r,i)]);o&&G9(r),s||Z9(r)}finally{i.abort(),delete Db[t.id]}},Db={},TSe=async(t,e,{signal:r})=>{Pa(t,1,r),await ESe(t,"disconnect",{signal:r}),V9(e)},Nb="execa:ipc:request",pV="execa:ipc:response"});var mV,hV,cV,op,jb,OSe,Rb=y(()=>{Nl();wo();ps();Ob();mV=(t,e,r)=>{op.has(t)||op.set(t,new Set);let n=op.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},hV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},cV=async(t,e,r)=>{for(;!jb(t,e)&&op.get(t)?.size>0;){let n=[...op.get(t)];dV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},op=new WeakMap,jb=(t,e)=>e.listenerCount("message")>OSe(t),OSe=t=>Ni.has(t)&&!So(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as RSe}from"node:util";var Mb,ISe,ZR,PSe,GR,Fb=y(()=>{Dl();Rb();Ob();Mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Pl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),ISe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ISe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=uV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=mV(t,s,o);try{await ZR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Cl(t),c}finally{hV(a)}},ZR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=PSe(t);try{await Promise.all([fV(n,t,r),o(n)])}catch(s){throw J9({error:s,methodName:e,isSubprocess:r}),Y9({error:s,methodName:e,isSubprocess:r,message:i}),s}},PSe=t=>{if(GR.has(t))return GR.get(t);let e=RSe(t.send.bind(t));return GR.set(t,e),e},GR=new WeakMap});import{scheduler as CSe}from"node:timers/promises";var yV,_V,DSe,gV,lV,bV,HR,VR,Ib=y(()=>{Fb();ip();Dl();yV=(t,e)=>{let r="cancelSignal";return UR(r,!1,t.connected),ZR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:bV,message:e},message:e})},_V=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await DSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),VR.signal),DSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!gV){if(gV=!0,!n){K9();return}if(e===null){HR();return}ms(t,e,r),await CSe.yield()}},gV=!1,lV=t=>t?.type!==bV?!1:(VR.abort(t.message),!0),bV="execa:ipc:cancel",HR=()=>{VR.abort(W9())},VR=new AbortController});var vV,SV,NSe,jSe,WR=y(()=>{LR();Ib();vb();vV=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},SV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[NSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],NSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Sb(e,i);let o=jSe(e);throw await yV(t,o),FR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},jSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as MSe}from"node:timers/promises";var wV,xV,FSe,KR=y(()=>{Ia();wV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},xV=(t,e,r,n)=>e===0||e===void 0?[]:[FSe(t,e,r,n)],FSe=async(t,e,r,{signal:n})=>{throw await MSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ri}});import{execPath as LSe,execArgv as zSe}from"node:process";import $V from"node:path";var kV,EV,JR=y(()=>{El();kV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},EV=(t,e,{node:r=!1,nodePath:n=LSe,nodeOptions:i=zSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=kl(n,'The "nodePath" option'),l=$V.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if($V.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as USe}from"node:v8";var AV,qSe,BSe,HSe,TV,YR=y(()=>{AV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");HSe[r](t)}},qSe=t=>{try{USe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},BSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},HSe={advanced:qSe,json:BSe},TV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var RV,GSe,an,XR,ZSe,OV,Lb,Ca=y(()=>{RV=({encoding:t})=>{if(XR.has(t))return;let e=ZSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. Please rename it to ${Lb(e)}.`);let r=[...XR].map(n=>Lb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. -Please rename it to one of: ${r}.`)},HSe=new Set(["utf8","utf16le"]),an=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),XR=new Set([...HSe,...an]),GSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in OV)return OV[e];if(XR.has(e))return e},OV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Lb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as ZSe}from"node:fs";import VSe from"node:path";import WSe from"node:process";var IV,PV,CV,QR=y(()=>{El();IV=(t=PV())=>{let e=kl(t,'The "cwd" option');return VSe.resolve(e)},PV=()=>{try{return WSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},CV=(t,e)=>{if(e===PV())return t;let r;try{r=ZSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +Please rename it to one of: ${r}.`)},GSe=new Set(["utf8","utf16le"]),an=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),XR=new Set([...GSe,...an]),ZSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in OV)return OV[e];if(XR.has(e))return e},OV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Lb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as VSe}from"node:fs";import WSe from"node:path";import KSe from"node:process";var IV,PV,CV,QR=y(()=>{El();IV=(t=PV())=>{let e=kl(t,'The "cwd" option');return WSe.resolve(e)},PV=()=>{try{return KSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},CV=(t,e)=>{if(e===PV())return t;let r;try{r=VSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import KSe from"node:path";import DV from"node:process";var NV,zb,JSe,YSe,eI=y(()=>{NV=St(h9(),1);w9();vb();tp();zR();WR();KR();JR();YR();Ca();QR();El();wo();zb=(t,e,r)=>{r.cwd=IV(r.cwd);let[n,i,o]=EV(t,e,r),{command:s,args:a,options:c}=NV.default._parse(n,i,o),l=iZ(c),u=JSe(l);return wV(u),RV(u),AV(u),q9(u),vV(u),u.shell=hR(u.shell),u.env=YSe(u),u.killSignal=M9(u.killSignal),u.forceKillAfterDelay=z9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!an.has(u.encoding)&&u.buffer[f]),DV.platform==="win32"&&KSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},JSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),YSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...DV.env,...t}:t;return r||n?S9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ub,tI=y(()=>{Ub=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ml(t){if(typeof t=="string")return XSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return QSe(t)}var XSe,QSe,jV,ewe,MV,twe,rI=y(()=>{XSe=t=>t.at(-1)===jV?t.slice(0,t.at(-2)===MV?-2:-1):t,QSe=t=>t.at(-1)===ewe?t.subarray(0,t.at(-2)===twe?-2:-1):t,jV=` -`,ewe=jV.codePointAt(0),MV="\r",twe=MV.codePointAt(0)});function ii(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function nI(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Da(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function iI(t,e){return nI(t,e)&&Da(t,e)}var Na=y(()=>{});function FV(){return this[sI].next()}function LV(t){return this[sI].return(t)}function aI({preventCancel:t=!1}={}){let e=this.getReader(),r=new oI(e,t),n=Object.create(nwe);return n[sI]=r,n}var rwe,oI,sI,nwe,zV=y(()=>{rwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),oI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},sI=Symbol();Object.defineProperty(FV,"name",{value:"next"});Object.defineProperty(LV,"name",{value:"return"});nwe=Object.create(rwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:FV},return:{enumerable:!0,configurable:!0,writable:!0,value:LV}})});var UV=y(()=>{});var qV=y(()=>{zV();UV()});var BV,iwe,owe,swe,sp,cI=y(()=>{Na();qV();BV=t=>{if(Da(t,{checkOpen:!1})&&sp.on!==void 0)return owe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(iwe.call(t)==="[object ReadableStream]")return aI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:iwe}=Object.prototype,owe=async function*(t){let e=new AbortController,r={};swe(t,e,r);try{for await(let[n]of sp.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},swe=async(t,e,r)=>{try{await sp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},sp={}});var Fl,awe,ZV,HV,cwe,GV,ji,ap=y(()=>{cI();Fl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=BV(t),u=e();u.length=0;try{for await(let d of l){let f=cwe(d),p=r[f](d,u);ZV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return awe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},awe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&ZV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},ZV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){HV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&HV(c,e,i,o),new ji},HV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},cwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=GV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&GV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:GV}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var xo,cp,qb,Bb,Hb,Gb=y(()=>{xo=t=>t,cp=()=>{},qb=({contents:t})=>t,Bb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Hb=t=>t.length});async function Zb(t,e){return Fl(t,fwe,e)}var lwe,uwe,dwe,fwe,VV=y(()=>{ap();Gb();lwe=()=>({contents:[]}),uwe=()=>1,dwe=(t,{contents:e})=>(e.push(t),e),fwe={init:lwe,convertChunk:{string:xo,buffer:xo,arrayBuffer:xo,dataView:xo,typedArray:xo,others:xo},getSize:uwe,truncateChunk:cp,addChunk:dwe,getFinalChunk:cp,finalize:qb}});async function Vb(t,e){return Fl(t,Swe,e)}var pwe,mwe,hwe,WV,KV,gwe,ywe,_we,bwe,YV,JV,vwe,XV,Swe,QV=y(()=>{ap();Gb();pwe=()=>({contents:new ArrayBuffer(0)}),mwe=t=>hwe.encode(t),hwe=new TextEncoder,WV=t=>new Uint8Array(t),KV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),gwe=(t,e)=>t.slice(0,e),ywe=(t,{contents:e,length:r},n)=>{let i=XV()?bwe(e,n):_we(e,n);return new Uint8Array(i).set(t,r),i},_we=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(YV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},bwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:YV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},YV=t=>JV**Math.ceil(Math.log(t)/Math.log(JV)),JV=2,vwe=({contents:t,length:e})=>XV()?t:t.slice(0,e),XV=()=>"resize"in ArrayBuffer.prototype,Swe={init:pwe,convertChunk:{string:mwe,buffer:WV,arrayBuffer:WV,dataView:KV,typedArray:KV,others:Bb},getSize:Hb,truncateChunk:gwe,addChunk:ywe,getFinalChunk:cp,finalize:vwe}});async function Kb(t,e){return Fl(t,Ewe,e)}var wwe,Wb,xwe,$we,kwe,Ewe,eW=y(()=>{ap();Gb();wwe=()=>({contents:"",textDecoder:new TextDecoder}),Wb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),xwe=(t,{contents:e})=>e+t,$we=(t,e)=>t.slice(0,e),kwe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Ewe={init:wwe,convertChunk:{string:xo,buffer:Wb,arrayBuffer:Wb,dataView:Wb,typedArray:Wb,others:Bb},getSize:Hb,truncateChunk:$we,addChunk:xwe,getFinalChunk:kwe,finalize:qb}});var tW=y(()=>{VV();QV();eW();ap()});import{on as Awe}from"node:events";import{finished as Twe}from"node:stream/promises";var Jb=y(()=>{cI();tW();Object.assign(sp,{on:Awe,finished:Twe})});var rW,Owe,nW,iW,Rwe,oW,sW,Yb,ja=y(()=>{Jb();vo();wo();rW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=Owe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Owe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",nW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},iW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Rwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Rwe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=So(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:nb(r),threshold:i,unit:n}},oW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Yb(r)),sW=(t,e,r)=>{if(!e)return t;let n=Yb(r);return t.length>n?t.slice(0,n):t},Yb=([,t])=>t});import{inspect as Iwe}from"node:util";var cW,Pwe,Cwe,Dwe,Nwe,jwe,aW,lW=y(()=>{rI();sn();QR();sb();ja();tp();Ia();cW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Pwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Dwe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>Nwe(D)).join(` -`)].map(D=>Yf(Ml(jwe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},Pwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Cwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${iW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${bb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Cwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Dwe=(t,e)=>{if(t instanceof ri)return;let r=k9(t)?t.originalMessage:String(t?.message??t),n=Yf(CV(r,e));return n===""?void 0:n},Nwe=t=>typeof t=="string"?t:Iwe(t),jwe=t=>Array.isArray(t)?t.map(e=>Ml(aW(e))).filter(Boolean).join(` -`):aW(t),aW=t=>typeof t=="string"?t:qt(t)?tb(t):""});var Xb,Ll,lp,Mwe,uW,Fwe,up=y(()=>{tp();fb();Ia();lW();Xb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>uW({command:t,escapedCommand:e,cwd:o,durationMs:kR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ll=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>lp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),lp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Fwe(l,u),{originalMessage:A,shortMessage:D,message:$}=cW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=x9(t,$,x);return Object.assign(re,Mwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},Mwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>uW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:kR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),uW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Fwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:bb(e);return{exitCode:r,signal:n,signalDescription:i}}});function Lwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(dW(t*1e3)%1e3),nanoseconds:Math.trunc(dW(t*1e6)%1e3)}}function zwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function lI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return Lwe(t);break}case"bigint":return zwe(t)}throw new TypeError("Expected a finite number or bigint")}var dW,fW=y(()=>{dW=t=>Number.isFinite(t)?t:0});function uI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Bwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Uwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+qwe(d,u):f;i.push(p)}},a=lI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Hwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var Uwe,qwe,Bwe,Hwe,pW=y(()=>{fW();Uwe=t=>t===0||t===0n,qwe=(t,e)=>e===1||e===1n?t:`${t}s`,Bwe=1e-7,Hwe=24n*60n*60n*1000n});var mW,hW=y(()=>{Ol();mW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var gW,Gwe,yW=y(()=>{pW();ds();Ol();hW();gW=(t,e)=>{Al(e)&&(mW(t,e),Gwe(t,e))},Gwe=(t,e)=>{let r=`(done in ${uI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var zl,Qb=y(()=>{yW();zl=(t,e,{reject:r})=>{if(gW(t,e),t.failed&&r)throw t;return t}});var vW,Zwe,Vwe,SW,wW,_W,Wwe,dI,bW,Ma,xW,Kwe,ev,$W,Jwe,Ywe,fI,kW,Xwe,EW,tv,Qwe,pI,exe,txe,AW,Pn,rv,mI,TW,OW,hs,wr=y(()=>{Na();_o();sn();vW=(t,e)=>Ma(t)?"asyncGenerator":xW(t)?"generator":ev(t)?"fileUrl":Jwe(t)?"filePath":Qwe(t)?"webStream":ii(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":exe(t)?"asyncIterable":txe(t)?"iterable":pI(t)?SW({transform:t},e):Kwe(t)?Zwe(t,e):"native",Zwe=(t,e)=>iI(t.transform,{checkOpen:!1})?Vwe(t,e):pI(t.transform)?SW(t,e):Wwe(t,e),Vwe=(t,e)=>(wW(t,e,"Duplex stream"),"duplex"),SW=(t,e)=>(wW(t,e,"web TransformStream"),"webTransform"),wW=({final:t,binary:e,objectMode:r},n,i)=>{_W(t,`${n}.final`,i),_W(e,`${n}.binary`,i),dI(r,`${n}.objectMode`)},_W=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Wwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!bW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(iI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(pI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!bW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return dI(r,`${i}.binary`),dI(n,`${i}.objectMode`),Ma(t)||Ma(e)?"asyncGenerator":"generator"},dI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},bW=t=>Ma(t)||xW(t),Ma=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",xW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Kwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),ev=t=>Object.prototype.toString.call(t)==="[object URL]",$W=t=>ev(t)&&t.protocol!=="file:",Jwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Ywe.has(e))&&fI(t.file),Ywe=new Set(["file","append"]),fI=t=>typeof t=="string",kW=(t,e)=>t==="native"&&typeof e=="string"&&!Xwe.has(e),Xwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),EW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",tv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Qwe=t=>EW(t)||tv(t),pI=t=>EW(t?.readable)&&tv(t?.writable),exe=t=>AW(t)&&typeof t[Symbol.asyncIterator]=="function",txe=t=>AW(t)&&typeof t[Symbol.iterator]=="function",AW=t=>typeof t=="object"&&t!==null,Pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),rv=new Set(["fileUrl","filePath","fileNumber"]),mI=new Set(["fileUrl","filePath"]),TW=new Set([...mI,"webStream","nodeStream"]),OW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var hI,rxe,nxe,RW,gI=y(()=>{wr();hI=(t,e,r,n)=>n==="output"?rxe(t,e,r):nxe(t,e,r),rxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},nxe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},RW=(t,e)=>{let r=t.findLast(({type:n})=>Pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var IW,ixe,oxe,sxe,axe,cxe,lxe,PW=y(()=>{_o();Ca();wr();gI();IW=(t,e,r,n)=>[...t.filter(({type:i})=>!Pn.has(i)),...ixe(t,e,r,n)],ixe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=oxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return lxe(o,r)},oxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?sxe({stdioItem:t,optionName:i}):e==="webTransform"?axe({stdioItem:t,index:r,newTransforms:n,direction:o}):cxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),sxe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},axe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=hI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||an.has(o),{writableObjectMode:f,readableObjectMode:p}=hI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},lxe=(t,e)=>e==="input"?t.reverse():t});import yI from"node:process";var CW,uxe,dxe,Ul,_I,DW,fxe,pxe,NW=y(()=>{Na();wr();CW=(t,e,r)=>{let n=t.map(i=>uxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??pxe},uxe=({type:t,value:e},r)=>dxe[r]??DW[t](e),dxe=["input","output","output"],Ul=()=>{},_I=()=>"input",DW={generator:Ul,asyncGenerator:Ul,fileUrl:Ul,filePath:Ul,iterable:_I,asyncIterable:_I,uint8Array:_I,webStream:t=>tv(t)?"output":"input",nodeStream(t){return Da(t,{checkOpen:!1})?nI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ul,duplex:Ul,native(t){let e=fxe(t);if(e!==void 0)return e;if(ii(t,{checkOpen:!1}))return DW.nodeStream(t)}},fxe=t=>{if([0,yI.stdin].includes(t))return"input";if([1,2,yI.stdout,yI.stderr].includes(t))return"output"},pxe="output"});var jW,MW=y(()=>{jW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var FW,mxe,hxe,LW,gxe,yxe,zW=y(()=>{vo();MW();ds();FW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=mxe(t,n).map((a,c)=>LW(a,c));return o?gxe(s,r,i):jW(s,e)},mxe=(t,e)=>{if(t===void 0)return In.map(n=>e[n]);if(hxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${In.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,In.length);return Array.from({length:r},(n,i)=>t[i])},hxe=t=>In.some(e=>t[e]!==void 0),LW=(t,e)=>Array.isArray(t)?t.map(r=>LW(r,e)):t??(e>=In.length?"ignore":"pipe"),gxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Tl(r,i)&&yxe(n)?"ignore":n),yxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as _xe}from"node:fs";import bxe from"node:tty";var qW,vxe,Sxe,wxe,xxe,UW,BW=y(()=>{Na();vo();sn();ps();qW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?vxe({stdioItem:t,fdNumber:n,direction:i}):xxe({stdioItem:t,fdNumber:n}),vxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Sxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ii(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Sxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=wxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(bxe.isatty(i))throw new TypeError(`The \`${e}: ${xb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:bo(_xe(i)),optionName:e}}},wxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=rb.indexOf(t);if(r!==-1)return r},xxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:UW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:UW(e,e,r),optionName:r}:ii(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,UW=(t,e,r)=>{let n=rb[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var HW,$xe,kxe,Exe,Axe,GW=y(()=>{Na();sn();wr();HW=({input:t,inputFile:e},r)=>r===0?[...$xe(t),...Exe(e)]:[],$xe=t=>t===void 0?[]:[{type:kxe(t),value:t,optionName:"input"}],kxe=t=>{if(Da(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Exe=t=>t===void 0?[]:[{...Axe(t),optionName:"inputFile"}],Axe=t=>{if(ev(t))return{type:"fileUrl",value:t};if(fI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var ZW,VW,Txe,Oxe,WW,Rxe,Ixe,KW,JW=y(()=>{wr();ZW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),VW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Txe(i,t);if(s.length!==0){if(o){Oxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(TW.has(t))return WW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});OW.has(t)&&Ixe({otherStdioItems:s,type:t,value:e,optionName:r})}},Txe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Oxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{mI.has(e)&&WW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},WW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Rxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return KW(s,n,e),i==="output"?o[0].stream:void 0},Rxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Ixe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);KW(i,n,e)},KW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var nv,Pxe,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,qxe,bI,Bxe,iv=y(()=>{vo();PW();gI();wr();NW();zW();BW();GW();JW();nv=(t,e,r,n)=>{let o=FW(e,r,n).map((a,c)=>Pxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=zxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Bxe(a)),s},Pxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=nb(e),{stdioItems:o,isStdioArray:s}=Cxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=CW(o,e,i),c=o.map(d=>qW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=IW(c,i,a,r),u=RW(l,a);return Lxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Cxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Dxe(c,n)),...HW(r,e)],s=ZW(o),a=s.length>1;return Nxe(s,a,n),Mxe(s),{stdioItems:s,isStdioArray:a}},Dxe=(t,e)=>({type:vW(t,e),value:t,optionName:e}),Nxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(jxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},jxe=new Set(["ignore","ipc"]),Mxe=t=>{for(let e of t)Fxe(e)},Fxe=({type:t,value:e,optionName:r})=>{if($W(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(kW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Lxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>rv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},zxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Uxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bI(i),o}},Uxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>qxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},qxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=VW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ti(r)&&r.destroy()},Bxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as YW}from"node:fs";var QW,Mi,Hxe,e3,XW,Gxe,t3=y(()=>{sn();iv();wr();QW=(t,e)=>nv(Gxe,t,e,!0),Mi=({type:t,optionName:e})=>{e3(e,hs[t])},Hxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&e3(t,`"${e}"`),{}),e3=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},XW={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:Hxe},Gxe={input:{...XW,fileUrl:({value:t})=>({contents:[bo(YW(t))]}),filePath:({value:{file:t}})=>({contents:[bo(YW(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...XW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var $o,vI,dp=y(()=>{rI();$o=(t,{stripFinalNewline:e},r)=>vI(e,r)&&t!==void 0&&!Array.isArray(t)?Ml(t):t,vI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var ov,wI,r3,n3,Zxe,Vxe,Wxe,i3,Kxe,SI,Jxe,Yxe,Xxe,sv=y(()=>{ov=(t,e,r,n)=>t||r?void 0:n3(e,n),wI=(t,e,r)=>r?t.flatMap(n=>r3(n,e)):r3(t,e),r3=(t,e)=>{let{transform:r,final:n}=n3(e,{});return[...r(t),...n()]},n3=(t,e)=>(e.previousChunks="",{transform:Zxe.bind(void 0,e,t),final:Wxe.bind(void 0,e)}),Zxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=SI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=SI(n,r.slice(i+1))),t.previousChunks=n},Vxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Wxe=function*({previousChunks:t}){t.length>0&&(yield t)},i3=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Kxe.bind(void 0,n)},Kxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Jxe:Xxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},SI=(t,e)=>`${t}${e}`,Jxe={windowsNewline:`\r +${t}`}});import JSe from"node:path";import DV from"node:process";var NV,zb,YSe,XSe,eI=y(()=>{NV=St(h9(),1);w9();vb();tp();zR();WR();KR();JR();YR();Ca();QR();El();wo();zb=(t,e,r)=>{r.cwd=IV(r.cwd);let[n,i,o]=EV(t,e,r),{command:s,args:a,options:c}=NV.default._parse(n,i,o),l=iZ(c),u=YSe(l);return wV(u),RV(u),AV(u),q9(u),vV(u),u.shell=hR(u.shell),u.env=XSe(u),u.killSignal=M9(u.killSignal),u.forceKillAfterDelay=z9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!an.has(u.encoding)&&u.buffer[f]),DV.platform==="win32"&&JSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},YSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),XSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...DV.env,...t}:t;return r||n?S9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ub,tI=y(()=>{Ub=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ml(t){if(typeof t=="string")return QSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ewe(t)}var QSe,ewe,jV,twe,MV,rwe,rI=y(()=>{QSe=t=>t.at(-1)===jV?t.slice(0,t.at(-2)===MV?-2:-1):t,ewe=t=>t.at(-1)===twe?t.subarray(0,t.at(-2)===rwe?-2:-1):t,jV=` +`,twe=jV.codePointAt(0),MV="\r",rwe=MV.codePointAt(0)});function ii(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function nI(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Da(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function iI(t,e){return nI(t,e)&&Da(t,e)}var Na=y(()=>{});function FV(){return this[sI].next()}function LV(t){return this[sI].return(t)}function aI({preventCancel:t=!1}={}){let e=this.getReader(),r=new oI(e,t),n=Object.create(iwe);return n[sI]=r,n}var nwe,oI,sI,iwe,zV=y(()=>{nwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),oI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},sI=Symbol();Object.defineProperty(FV,"name",{value:"next"});Object.defineProperty(LV,"name",{value:"return"});iwe=Object.create(nwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:FV},return:{enumerable:!0,configurable:!0,writable:!0,value:LV}})});var UV=y(()=>{});var qV=y(()=>{zV();UV()});var BV,owe,swe,awe,sp,cI=y(()=>{Na();qV();BV=t=>{if(Da(t,{checkOpen:!1})&&sp.on!==void 0)return swe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(owe.call(t)==="[object ReadableStream]")return aI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:owe}=Object.prototype,swe=async function*(t){let e=new AbortController,r={};awe(t,e,r);try{for await(let[n]of sp.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},awe=async(t,e,r)=>{try{await sp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},sp={}});var Fl,cwe,ZV,HV,lwe,GV,ji,ap=y(()=>{cI();Fl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=BV(t),u=e();u.length=0;try{for await(let d of l){let f=lwe(d),p=r[f](d,u);ZV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return cwe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},cwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&ZV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},ZV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){HV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&HV(c,e,i,o),new ji},HV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},lwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=GV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&GV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:GV}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var xo,cp,qb,Bb,Hb,Gb=y(()=>{xo=t=>t,cp=()=>{},qb=({contents:t})=>t,Bb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Hb=t=>t.length});async function Zb(t,e){return Fl(t,pwe,e)}var uwe,dwe,fwe,pwe,VV=y(()=>{ap();Gb();uwe=()=>({contents:[]}),dwe=()=>1,fwe=(t,{contents:e})=>(e.push(t),e),pwe={init:uwe,convertChunk:{string:xo,buffer:xo,arrayBuffer:xo,dataView:xo,typedArray:xo,others:xo},getSize:dwe,truncateChunk:cp,addChunk:fwe,getFinalChunk:cp,finalize:qb}});async function Vb(t,e){return Fl(t,wwe,e)}var mwe,hwe,gwe,WV,KV,ywe,_we,bwe,vwe,YV,JV,Swe,XV,wwe,QV=y(()=>{ap();Gb();mwe=()=>({contents:new ArrayBuffer(0)}),hwe=t=>gwe.encode(t),gwe=new TextEncoder,WV=t=>new Uint8Array(t),KV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ywe=(t,e)=>t.slice(0,e),_we=(t,{contents:e,length:r},n)=>{let i=XV()?vwe(e,n):bwe(e,n);return new Uint8Array(i).set(t,r),i},bwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(YV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},vwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:YV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},YV=t=>JV**Math.ceil(Math.log(t)/Math.log(JV)),JV=2,Swe=({contents:t,length:e})=>XV()?t:t.slice(0,e),XV=()=>"resize"in ArrayBuffer.prototype,wwe={init:mwe,convertChunk:{string:hwe,buffer:WV,arrayBuffer:WV,dataView:KV,typedArray:KV,others:Bb},getSize:Hb,truncateChunk:ywe,addChunk:_we,getFinalChunk:cp,finalize:Swe}});async function Kb(t,e){return Fl(t,Awe,e)}var xwe,Wb,$we,kwe,Ewe,Awe,eW=y(()=>{ap();Gb();xwe=()=>({contents:"",textDecoder:new TextDecoder}),Wb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),$we=(t,{contents:e})=>e+t,kwe=(t,e)=>t.slice(0,e),Ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Awe={init:xwe,convertChunk:{string:xo,buffer:Wb,arrayBuffer:Wb,dataView:Wb,typedArray:Wb,others:Bb},getSize:Hb,truncateChunk:kwe,addChunk:$we,getFinalChunk:Ewe,finalize:qb}});var tW=y(()=>{VV();QV();eW();ap()});import{on as Twe}from"node:events";import{finished as Owe}from"node:stream/promises";var Jb=y(()=>{cI();tW();Object.assign(sp,{on:Twe,finished:Owe})});var rW,Rwe,nW,iW,Iwe,oW,sW,Yb,ja=y(()=>{Jb();vo();wo();rW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=Rwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Rwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",nW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},iW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Iwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Iwe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=So(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:nb(r),threshold:i,unit:n}},oW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Yb(r)),sW=(t,e,r)=>{if(!e)return t;let n=Yb(r);return t.length>n?t.slice(0,n):t},Yb=([,t])=>t});import{inspect as Pwe}from"node:util";var cW,Cwe,Dwe,Nwe,jwe,Mwe,aW,lW=y(()=>{rI();sn();QR();sb();ja();tp();Ia();cW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Cwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Nwe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>jwe(D)).join(` +`)].map(D=>Yf(Ml(Mwe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},Cwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Dwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${iW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${bb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Dwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Nwe=(t,e)=>{if(t instanceof ri)return;let r=k9(t)?t.originalMessage:String(t?.message??t),n=Yf(CV(r,e));return n===""?void 0:n},jwe=t=>typeof t=="string"?t:Pwe(t),Mwe=t=>Array.isArray(t)?t.map(e=>Ml(aW(e))).filter(Boolean).join(` +`):aW(t),aW=t=>typeof t=="string"?t:qt(t)?tb(t):""});var Xb,Ll,lp,Fwe,uW,Lwe,up=y(()=>{tp();fb();Ia();lW();Xb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>uW({command:t,escapedCommand:e,cwd:o,durationMs:kR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ll=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>lp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),lp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Lwe(l,u),{originalMessage:A,shortMessage:D,message:$}=cW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=x9(t,$,x);return Object.assign(re,Fwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},Fwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>uW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:kR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),uW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Lwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:bb(e);return{exitCode:r,signal:n,signalDescription:i}}});function zwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(dW(t*1e3)%1e3),nanoseconds:Math.trunc(dW(t*1e6)%1e3)}}function Uwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function lI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return zwe(t);break}case"bigint":return Uwe(t)}throw new TypeError("Expected a finite number or bigint")}var dW,fW=y(()=>{dW=t=>Number.isFinite(t)?t:0});function uI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Hwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&qwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Bwe(d,u):f;i.push(p)}},a=lI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Gwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var qwe,Bwe,Hwe,Gwe,pW=y(()=>{fW();qwe=t=>t===0||t===0n,Bwe=(t,e)=>e===1||e===1n?t:`${t}s`,Hwe=1e-7,Gwe=24n*60n*60n*1000n});var mW,hW=y(()=>{Ol();mW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var gW,Zwe,yW=y(()=>{pW();ds();Ol();hW();gW=(t,e)=>{Al(e)&&(mW(t,e),Zwe(t,e))},Zwe=(t,e)=>{let r=`(done in ${uI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var zl,Qb=y(()=>{yW();zl=(t,e,{reject:r})=>{if(gW(t,e),t.failed&&r)throw t;return t}});var vW,Vwe,Wwe,SW,wW,_W,Kwe,dI,bW,Ma,xW,Jwe,ev,$W,Ywe,Xwe,fI,kW,Qwe,EW,tv,exe,pI,txe,rxe,AW,Pn,rv,mI,TW,OW,hs,wr=y(()=>{Na();_o();sn();vW=(t,e)=>Ma(t)?"asyncGenerator":xW(t)?"generator":ev(t)?"fileUrl":Ywe(t)?"filePath":exe(t)?"webStream":ii(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":txe(t)?"asyncIterable":rxe(t)?"iterable":pI(t)?SW({transform:t},e):Jwe(t)?Vwe(t,e):"native",Vwe=(t,e)=>iI(t.transform,{checkOpen:!1})?Wwe(t,e):pI(t.transform)?SW(t,e):Kwe(t,e),Wwe=(t,e)=>(wW(t,e,"Duplex stream"),"duplex"),SW=(t,e)=>(wW(t,e,"web TransformStream"),"webTransform"),wW=({final:t,binary:e,objectMode:r},n,i)=>{_W(t,`${n}.final`,i),_W(e,`${n}.binary`,i),dI(r,`${n}.objectMode`)},_W=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Kwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!bW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(iI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(pI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!bW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return dI(r,`${i}.binary`),dI(n,`${i}.objectMode`),Ma(t)||Ma(e)?"asyncGenerator":"generator"},dI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},bW=t=>Ma(t)||xW(t),Ma=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",xW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Jwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),ev=t=>Object.prototype.toString.call(t)==="[object URL]",$W=t=>ev(t)&&t.protocol!=="file:",Ywe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Xwe.has(e))&&fI(t.file),Xwe=new Set(["file","append"]),fI=t=>typeof t=="string",kW=(t,e)=>t==="native"&&typeof e=="string"&&!Qwe.has(e),Qwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),EW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",tv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",exe=t=>EW(t)||tv(t),pI=t=>EW(t?.readable)&&tv(t?.writable),txe=t=>AW(t)&&typeof t[Symbol.asyncIterator]=="function",rxe=t=>AW(t)&&typeof t[Symbol.iterator]=="function",AW=t=>typeof t=="object"&&t!==null,Pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),rv=new Set(["fileUrl","filePath","fileNumber"]),mI=new Set(["fileUrl","filePath"]),TW=new Set([...mI,"webStream","nodeStream"]),OW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var hI,nxe,ixe,RW,gI=y(()=>{wr();hI=(t,e,r,n)=>n==="output"?nxe(t,e,r):ixe(t,e,r),nxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},ixe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},RW=(t,e)=>{let r=t.findLast(({type:n})=>Pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var IW,oxe,sxe,axe,cxe,lxe,uxe,PW=y(()=>{_o();Ca();wr();gI();IW=(t,e,r,n)=>[...t.filter(({type:i})=>!Pn.has(i)),...oxe(t,e,r,n)],oxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=sxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return uxe(o,r)},sxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?axe({stdioItem:t,optionName:i}):e==="webTransform"?cxe({stdioItem:t,index:r,newTransforms:n,direction:o}):lxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),axe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=hI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},lxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||an.has(o),{writableObjectMode:f,readableObjectMode:p}=hI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},uxe=(t,e)=>e==="input"?t.reverse():t});import yI from"node:process";var CW,dxe,fxe,Ul,_I,DW,pxe,mxe,NW=y(()=>{Na();wr();CW=(t,e,r)=>{let n=t.map(i=>dxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??mxe},dxe=({type:t,value:e},r)=>fxe[r]??DW[t](e),fxe=["input","output","output"],Ul=()=>{},_I=()=>"input",DW={generator:Ul,asyncGenerator:Ul,fileUrl:Ul,filePath:Ul,iterable:_I,asyncIterable:_I,uint8Array:_I,webStream:t=>tv(t)?"output":"input",nodeStream(t){return Da(t,{checkOpen:!1})?nI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ul,duplex:Ul,native(t){let e=pxe(t);if(e!==void 0)return e;if(ii(t,{checkOpen:!1}))return DW.nodeStream(t)}},pxe=t=>{if([0,yI.stdin].includes(t))return"input";if([1,2,yI.stdout,yI.stderr].includes(t))return"output"},mxe="output"});var jW,MW=y(()=>{jW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var FW,hxe,gxe,LW,yxe,_xe,zW=y(()=>{vo();MW();ds();FW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=hxe(t,n).map((a,c)=>LW(a,c));return o?yxe(s,r,i):jW(s,e)},hxe=(t,e)=>{if(t===void 0)return In.map(n=>e[n]);if(gxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${In.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,In.length);return Array.from({length:r},(n,i)=>t[i])},gxe=t=>In.some(e=>t[e]!==void 0),LW=(t,e)=>Array.isArray(t)?t.map(r=>LW(r,e)):t??(e>=In.length?"ignore":"pipe"),yxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Tl(r,i)&&_xe(n)?"ignore":n),_xe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as bxe}from"node:fs";import vxe from"node:tty";var qW,Sxe,wxe,xxe,$xe,UW,BW=y(()=>{Na();vo();sn();ps();qW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Sxe({stdioItem:t,fdNumber:n,direction:i}):$xe({stdioItem:t,fdNumber:n}),Sxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=wxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ii(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},wxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=xxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(vxe.isatty(i))throw new TypeError(`The \`${e}: ${xb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:bo(bxe(i)),optionName:e}}},xxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=rb.indexOf(t);if(r!==-1)return r},$xe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:UW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:UW(e,e,r),optionName:r}:ii(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,UW=(t,e,r)=>{let n=rb[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var HW,kxe,Exe,Axe,Txe,GW=y(()=>{Na();sn();wr();HW=({input:t,inputFile:e},r)=>r===0?[...kxe(t),...Axe(e)]:[],kxe=t=>t===void 0?[]:[{type:Exe(t),value:t,optionName:"input"}],Exe=t=>{if(Da(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Axe=t=>t===void 0?[]:[{...Txe(t),optionName:"inputFile"}],Txe=t=>{if(ev(t))return{type:"fileUrl",value:t};if(fI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var ZW,VW,Oxe,Rxe,WW,Ixe,Pxe,KW,JW=y(()=>{wr();ZW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),VW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Oxe(i,t);if(s.length!==0){if(o){Rxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(TW.has(t))return WW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});OW.has(t)&&Pxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Oxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Rxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{mI.has(e)&&WW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},WW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Ixe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return KW(s,n,e),i==="output"?o[0].stream:void 0},Ixe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Pxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);KW(i,n,e)},KW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var nv,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,qxe,Bxe,bI,Hxe,iv=y(()=>{vo();PW();gI();wr();NW();zW();BW();GW();JW();nv=(t,e,r,n)=>{let o=FW(e,r,n).map((a,c)=>Cxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Uxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Hxe(a)),s},Cxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=nb(e),{stdioItems:o,isStdioArray:s}=Dxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=CW(o,e,i),c=o.map(d=>qW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=IW(c,i,a,r),u=RW(l,a);return zxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Dxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Nxe(c,n)),...HW(r,e)],s=ZW(o),a=s.length>1;return jxe(s,a,n),Fxe(s),{stdioItems:s,isStdioArray:a}},Nxe=(t,e)=>({type:vW(t,e),value:t,optionName:e}),jxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Mxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Mxe=new Set(["ignore","ipc"]),Fxe=t=>{for(let e of t)Lxe(e)},Lxe=({type:t,value:e,optionName:r})=>{if($W(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(kW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},zxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>rv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Uxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(qxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bI(i),o}},qxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Bxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Bxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=VW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ti(r)&&r.destroy()},Hxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as YW}from"node:fs";var QW,Mi,Gxe,e3,XW,Zxe,t3=y(()=>{sn();iv();wr();QW=(t,e)=>nv(Zxe,t,e,!0),Mi=({type:t,optionName:e})=>{e3(e,hs[t])},Gxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&e3(t,`"${e}"`),{}),e3=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},XW={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:Gxe},Zxe={input:{...XW,fileUrl:({value:t})=>({contents:[bo(YW(t))]}),filePath:({value:{file:t}})=>({contents:[bo(YW(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...XW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var $o,vI,dp=y(()=>{rI();$o=(t,{stripFinalNewline:e},r)=>vI(e,r)&&t!==void 0&&!Array.isArray(t)?Ml(t):t,vI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var ov,wI,r3,n3,Vxe,Wxe,Kxe,i3,Jxe,SI,Yxe,Xxe,Qxe,sv=y(()=>{ov=(t,e,r,n)=>t||r?void 0:n3(e,n),wI=(t,e,r)=>r?t.flatMap(n=>r3(n,e)):r3(t,e),r3=(t,e)=>{let{transform:r,final:n}=n3(e,{});return[...r(t),...n()]},n3=(t,e)=>(e.previousChunks="",{transform:Vxe.bind(void 0,e,t),final:Kxe.bind(void 0,e)}),Vxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=SI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=SI(n,r.slice(i+1))),t.previousChunks=n},Wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Kxe=function*({previousChunks:t}){t.length>0&&(yield t)},i3=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Jxe.bind(void 0,n)},Jxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Yxe:Qxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},SI=(t,e)=>`${t}${e}`,Yxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:SI},Yxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Xxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Yxe}});import{Buffer as Qxe}from"node:buffer";var o3,e0e,s3,t0e,r0e,a3,c3=y(()=>{sn();o3=(t,e)=>t?void 0:e0e.bind(void 0,e),e0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!Qxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},s3=(t,e)=>t?t0e.bind(void 0,e):r0e.bind(void 0,e),t0e=function*(t,e){a3(t,e),yield e},r0e=function*(t,e){if(a3(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},a3=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:SI},Xxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Qxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Xxe}});import{Buffer as e0e}from"node:buffer";var o3,t0e,s3,r0e,n0e,a3,c3=y(()=>{sn();o3=(t,e)=>t?void 0:t0e.bind(void 0,e),t0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!e0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},s3=(t,e)=>t?r0e.bind(void 0,e):n0e.bind(void 0,e),r0e=function*(t,e){a3(t,e),yield e},n0e=function*(t,e){if(a3(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},a3=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as n0e}from"node:buffer";import{StringDecoder as i0e}from"node:string_decoder";var av,o0e,s0e,a0e,xI=y(()=>{sn();av=(t,e,r)=>{if(r)return;if(t)return{transform:o0e.bind(void 0,new TextEncoder)};let n=new i0e(e);return{transform:s0e.bind(void 0,n),final:a0e.bind(void 0,n)}},o0e=function*(t,e){n0e.isBuffer(e)?yield bo(e):typeof e=="string"?yield t.encode(e):yield e},s0e=function*(t,e){yield qt(e)?t.write(e):e},a0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as l3}from"node:util";var $I,cv,u3,c0e,d3,l0e,f3=y(()=>{$I=l3(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=l0e}=e[r];for await(let i of n(t))yield*cv(i,e,r+1)},u3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*c0e(r,Number(e),t)},c0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cv(n,r,e+1)},d3=l3(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),l0e=function*(t){yield t}});var kI,p3,Fa,fp,u0e,d0e,EI=y(()=>{kI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},p3=(t,e)=>[...e.flatMap(r=>[...Fa(r,t,0)]),...fp(t)],Fa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=d0e}=e[r];for(let i of n(t))yield*Fa(i,e,r+1)},fp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*u0e(r,Number(e),t)},u0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Fa(n,r,e+1)},d0e=function*(t){yield t}});import{Transform as f0e,getDefaultHighWaterMark as m3}from"node:stream";var AI,lv,h3,uv=y(()=>{wr();sv();c3();xI();f3();EI();AI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=h3(t,s,o),l=Ma(e),u=Ma(r),d=l?$I.bind(void 0,cv,a):kI.bind(void 0,Fa),f=l||u?$I.bind(void 0,u3,a):kI.bind(void 0,fp),p=l||u?d3.bind(void 0,a):void 0;return{stream:new f0e({writableObjectMode:n,writableHighWaterMark:m3(n),readableObjectMode:i,readableHighWaterMark:m3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},lv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=h3(s,r,a);t=p3(c,t)}return t},h3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:o3(n,a)},av(r,s,n),ov(r,o,n,c),{transform:t,final:e},{transform:s3(i,a)},i3({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var g3,p0e,m0e,h0e,g0e,y3=y(()=>{uv();sn();wr();g3=(t,e)=>{for(let r of p0e(t))m0e(t,r,e)},p0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),m0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>h0e(a,n));r.input=Jf(s)},h0e=(t,e)=>{let r=lv(t,e,"utf8",!0);return g0e(r),Jf(r)},g0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var dv,y0e,_0e,_3,b3,b0e,v3,TI=y(()=>{Ca();wr();Ol();ds();dv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Tl(r,n)&&!an.has(e)&&y0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&_0e.has(o))||t.every(({type:i})=>Pn.has(i))),y0e=t=>t===1||t===2,_0e=new Set(["pipe","overlapped"]),_3=async(t,e,r,n)=>{for await(let i of t)b0e(e)||v3(i,r,n)},b3=(t,e,r)=>{for(let n of t)v3(n,e,r)},b0e=t=>t._readableState.pipes.length>0,v3=(t,e,r)=>{let n=ub(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as v0e,appendFileSync as S0e}from"node:fs";var S3,w0e,x0e,$0e,k0e,E0e,w3=y(()=>{TI();uv();sv();sn();wr();ja();S3=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>w0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},w0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=sW(t,o,d),p=bo(f),{stdioItems:m,objectMode:h}=e[r],g=x0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=$0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});k0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&E0e(b,m,i),S}catch(x){return n.error=x,S}},x0e=(t,e,r,n)=>{try{return lv(t,e,r,!1)}catch(i){return n.error=i,t}},$0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Jf(t)};let s=JG(t,r);return n[o]?{serializedResult:s,finalResult:wI(s,!i[o],e)}:{serializedResult:s}},k0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!dv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wI(t,!1,s);try{b3(a,e,n)}catch(c){r.error??=c}},E0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>rv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?S0e(n,t):(r.add(o),v0e(n,t))}}});var x3,$3=y(()=>{sn();dp();x3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,$o(e,r,"all")]:Array.isArray(e)?[$o(t,r,"all"),...e]:qt(t)&&qt(e)?yR([t,e]):`${t}${e}`}});import{once as OI}from"node:events";var k3,A0e,E3,A3,T0e,RI,II=y(()=>{Ia();k3=async(t,e)=>{let[r,n]=await A0e(t);return e.isForcefullyTerminated??=!1,[r,n]},A0e=async t=>{let[e,r]=await Promise.allSettled([OI(t,"spawn"),OI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?E3(t):r.value},E3=async t=>{try{return await OI(t,"exit")}catch{return E3(t)}},A3=async t=>{let[e,r]=await t;if(!T0e(e,r)&&RI(e,r))throw new ri;return[e,r]},T0e=(t,e)=>t===void 0&&e===void 0,RI=(t,e)=>t!==0||e!==null});var T3,O0e,O3=y(()=>{Ia();ja();II();T3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=O0e(t,e,r),s=o?.code==="ETIMEDOUT",a=oW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},O0e=(t,e,r)=>t!==void 0?t:RI(e,r)?new ri:void 0});import{spawnSync as R0e}from"node:child_process";var R3,I0e,P0e,C0e,fv,D0e,N0e,j0e,M0e,I3=y(()=>{ER();eI();tI();up();Qb();t3();dp();y3();w3();ja();$3();O3();R3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=I0e(t,e,r),d=D0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return zl(d,c,l)},I0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),a=P0e(r),{file:c,commandArguments:l,options:u}=zb(t,e,a);C0e(u);let d=QW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},P0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,C0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&fv("ipcInput"),t&&fv("ipc: true"),r&&fv("detached: true"),n&&fv("cancelSignal")},fv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},D0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=N0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=T3(c,r),{output:m,error:h=l}=S3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>$o(_,r,S)),b=$o(x3(m,r),r,"all");return M0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},N0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{g3(o,r);let a=j0e(r);return R0e(...Ub(t,e,a))}catch(a){return Ll({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},j0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Yb(e)}),M0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Xb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):lp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as PI,on as F0e}from"node:events";var P3,L0e,z0e,U0e,q0e,C3=y(()=>{Dl();ip();np();P3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Pl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),L0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),L0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Eb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([z0e(o,n,s),U0e(o,r,s),q0e(o,r,s)])}catch(a){throw Cl(t),a}finally{s.abort(),Ab(e,i)}},z0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await PI(t,"message",{signal:r});return n}for await(let[n]of F0e(t,"message",{signal:r}))if(e(n))return n},U0e=async(t,e,{signal:r})=>{await PI(t,"disconnect",{signal:r}),H9(e)},q0e=async(t,e,{signal:r})=>{let[n]=await PI(t,"strict:error",{signal:r});throw wb(n,e)}});import{once as N3,on as B0e}from"node:events";var j3,CI,H0e,G0e,Z0e,D3,DI=y(()=>{Dl();ip();np();j3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Pl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),Eb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return H0e(t,s,a),G0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Z0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},H0e=async(t,e,r)=>{try{await N3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},G0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await N3(t,"strict:error",{signal:r.signal});n.error=wb(i,e),r.abort()}catch{}},Z0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of B0e(r,"message",{signal:o.signal}))D3(s),yield c}catch{D3(s)}finally{o.abort(),Ab(e,a),n||Cl(t),i&&await t}},D3=({error:t})=>{if(t)throw t}});import M3 from"node:process";var F3,L3,z3,NI=y(()=>{Fb();C3();DI();Ib();F3=(t,{ipc:e})=>{Object.assign(t,z3(t,!1,e))},L3=()=>{let t=M3,e=!0,r=M3.channel!==void 0;return{...z3(t,e,r),getCancelSignal:_V.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},z3=(t,e,r)=>({sendMessage:Mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:P3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:j3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as V0e}from"node:child_process";import{PassThrough as W0e,Readable as K0e,Writable as J0e,Duplex as Y0e}from"node:stream";var U3,X0e,pp,Q0e,e$e,t$e,r$e,q3=y(()=>{iv();up();Qb();U3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bI(n);let a=new V0e;X0e(a,n),Object.assign(a,{readable:Q0e,writable:e$e,duplex:t$e});let c=Ll({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=r$e(c,s,i);return{subprocess:a,promise:l}},X0e=(t,e)=>{let r=pp(),n=pp(),i=pp(),o=Array.from({length:e.length-3},pp),s=pp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},pp=()=>{let t=new W0e;return t.end(),t},Q0e=()=>new K0e({read(){}}),e$e=()=>new J0e({write(){}}),t$e=()=>new Y0e({read(){},write(){}}),r$e=async(t,e,r)=>zl(t,e,r)});import{createReadStream as B3,createWriteStream as H3}from"node:fs";import{Buffer as n$e}from"node:buffer";import{Readable as mp,Writable as i$e,Duplex as o$e}from"node:stream";var Z3,hp,G3,s$e,V3=y(()=>{uv();iv();wr();Z3=(t,e)=>nv(s$e,t,e,!1),hp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},G3={fileNumber:hp,generator:AI,asyncGenerator:AI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:o$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},s$e={input:{...G3,fileUrl:({value:t})=>({stream:B3(t)}),filePath:({value:{file:t}})=>({stream:B3(t)}),webStream:({value:t})=>({stream:mp.fromWeb(t)}),iterable:({value:t})=>({stream:mp.from(t)}),asyncIterable:({value:t})=>({stream:mp.from(t)}),string:({value:t})=>({stream:mp.from(t)}),uint8Array:({value:t})=>({stream:mp.from(n$e.from(t))})},output:{...G3,fileUrl:({value:t})=>({stream:H3(t)}),filePath:({value:{file:t,append:e}})=>({stream:H3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:i$e.fromWeb(t)}),iterable:hp,asyncIterable:hp,string:hp,uint8Array:hp}}});import{on as a$e,once as W3}from"node:events";import{PassThrough as c$e,getDefaultHighWaterMark as l$e}from"node:stream";import{finished as Y3}from"node:stream/promises";function La(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)MI(i);let e=t.some(({readableObjectMode:i})=>i),r=u$e(t,e),n=new jI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var u$e,jI,d$e,f$e,p$e,MI,m$e,h$e,g$e,y$e,_$e,X3,Q3,FI,eK,b$e,pv,K3,J3,mv=y(()=>{u$e=(t,e)=>{if(t.length===0)return l$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},jI=class extends c$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(MI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=d$e(this,this.#t,this.#o);let r=m$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(MI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},d$e=async(t,e,r)=>{pv(t,K3);let n=new AbortController;try{await Promise.race([f$e(t,n),p$e(t,e,r,n)])}finally{n.abort(),pv(t,-K3)}},f$e=async(t,{signal:e})=>{try{await Y3(t,{signal:e,cleanup:!0})}catch(r){throw X3(t,r),r}},p$e=async(t,e,r,{signal:n})=>{for await(let[i]of a$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},MI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},m$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{pv(t,J3);let a=new AbortController;try{await Promise.race([h$e(o,e,a),g$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),y$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),pv(t,-J3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FI(t):_$e(t))},h$e=async(t,e,{signal:r})=>{try{await t,r.aborted||FI(e)}catch(n){r.aborted||X3(e,n)}},g$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Y3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Q3(s)?i.add(e):eK(t,s)}},y$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await W3(t,i,{signal:o}),!t.readable)return W3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},_$e=t=>{t.writable&&t.end()},X3=(t,e)=>{Q3(e)?FI(t):eK(t,e)},Q3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FI=t=>{(t.readable||t.writable)&&t.destroy()},eK=(t,e)=>{t.destroyed||(t.once("error",b$e),t.destroy(e))},b$e=()=>{},pv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},K3=2,J3=1});import{finished as tK}from"node:stream/promises";var ql,v$e,LI,S$e,zI,hv=y(()=>{vo();ql=(t,e)=>{t.pipe(e),v$e(t,e),S$e(t,e)},v$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LI(e)}},LI=t=>{t.writable&&t.end()},S$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}zI(t)}},zI=t=>{t.readable&&t.destroy()}});var rK,w$e,x$e,$$e,k$e,E$e,nK=y(()=>{mv();vo();kb();wr();hv();rK=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Pn.has(c)))w$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Pn.has(c)))$$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:La(o);ql(s,i)}},w$e=(t,e,r,n)=>{r==="output"?ql(t.stdio[n],e):ql(e,t.stdio[n]);let i=x$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},x$e=["stdin","stdout","stderr"],$$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;k$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},k$e=(t,{signal:e})=>{ti(t)&&Pa(t,E$e,e)},E$e=2});var za,iK=y(()=>{za=[];za.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&za.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&za.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var gv,UI,qI,A$e,BI,yv,T$e,HI,GI,ZI,oK,Iat,Pat,sK=y(()=>{iK();gv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",UI=Symbol.for("signal-exit emitter"),qI=globalThis,A$e=Object.defineProperty.bind(Object),BI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(qI[UI])return qI[UI];A$e(qI,UI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},yv=class{},T$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HI=class extends yv{onExit(){return()=>{}}load(){}unload(){}},GI=class extends yv{#t=ZI.platform==="win32"?"SIGINT":"SIGHUP";#r=new BI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of za)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!gv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of za)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,za.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return gv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&gv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},ZI=globalThis.process,{onExit:oK,load:Iat,unload:Pat}=T$e(gv(ZI)?new GI(ZI):new HI)});import{addAbortListener as O$e}from"node:events";var aK,cK=y(()=>{sK();aK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=oK(()=>{t.kill()});O$e(n,()=>{i()})}});var uK,R$e,I$e,lK,P$e,dK=y(()=>{gR();fb();ps();El();uK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=db(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=R$e(r,n,i),{sourceStream:d,sourceError:f}=P$e(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},R$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=I$e(t,e,...r),a=$b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},I$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(lK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||mR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=eb(r,...n);return{destination:e(lK)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},lK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),P$e=(t,e)=>{try{return{sourceStream:jl(t,e)}}catch(r){return{sourceError:r}}}});var pK,C$e,VI,fK,WI=y(()=>{up();hv();pK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=C$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},C$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return zI(t),n;if(e!==void 0)return LI(r),e},VI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ll({error:t,command:fK,escapedCommand:fK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),fK="source.pipe(destination)"});var mK,hK=y(()=>{mK=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as D$e}from"node:stream/promises";var gK,N$e,j$e,M$e,_v,F$e,L$e,yK=y(()=>{mv();kb();hv();gK=(t,e,r)=>{let n=_v.has(e)?j$e(t,e):N$e(t,e);return Pa(t,F$e,r.signal),Pa(e,L$e,r.signal),M$e(e),n},N$e=(t,e)=>{let r=La([t]);return ql(r,e),_v.set(e,r),r},j$e=(t,e)=>{let r=_v.get(e);return r.add(t),r},M$e=async t=>{try{await D$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_v.delete(t)},_v=new WeakMap,F$e=2,L$e=1});import{aborted as z$e}from"node:util";var _K,U$e,bK=y(()=>{WI();_K=(t,e)=>t===void 0?[]:[U$e(t,e)],U$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await z$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var bv,q$e,B$e,vK=y(()=>{_o();dK();WI();hK();yK();bK();bv=(t,...e)=>{if(Ot(e[0]))return bv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=uK(t,...e),i=q$e({...n,destination:r});return i.pipe=bv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},q$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=B$e(t,i);pK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=gK(e,o,d);return await Promise.race([mK(u),..._K(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},B$e=(t,e)=>Promise.allSettled([t,e])});import{on as H$e}from"node:events";import{getDefaultHighWaterMark as G$e}from"node:stream";var vv,Z$e,KI,V$e,wK,JI,SK,W$e,K$e,Sv=y(()=>{xI();sv();EI();vv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Z$e(e,s),wK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Z$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},KI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;V$e(e,s,t);let a=t.readableObjectMode&&!o;return wK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},V$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},wK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=H$e(t,"data",{signal:e.signal,highWaterMark:SK,highWatermark:SK});return W$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},JI=G$e(!0),SK=JI,W$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=K$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Fa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*fp(a)}},K$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[av(t,r,!e),ov(t,i,!n,{})].filter(Boolean)});import{setImmediate as J$e}from"node:timers/promises";var xK,Y$e,X$e,Q$e,YI,$K,XI=y(()=>{Jb();sn();TI();Sv();ja();dp();xK=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=Y$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([X$e(t),d]);return}let f=vI(c,r),p=KI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Q$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Y$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!dv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=KI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await _3(a,t,r,o)},X$e=async t=>{await J$e(),t.readableFlowing===null&&t.resume()},Q$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Vb(r,{maxBuffer:o})):await Kb(r,{maxBuffer:o})}catch(a){return $K(rW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YI=async t=>{try{return await t}catch(e){return $K(e)}},$K=({bufferedData:t})=>WG(t)?new Uint8Array(t):t});import{finished as eke}from"node:stream/promises";var gp,tke,rke,nke,ike,oke,QI,wv,kK,xv=y(()=>{gp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=tke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],eke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||ike(a,e,r,n)}finally{s.abort()}},tke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&rke(t,r,n),n},rke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{nke(e,r),n.call(t,...i)}},nke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},ike=(t,e,r,n)=>{if(!oke(t,e,r,n))throw t},oke=(t,e,r,n=!0)=>r.propagating?kK(t)||wv(t):(r.propagating=!0,QI(r,e)===n?kK(t):wv(t)),QI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",wv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",kK=t=>t?.code==="EPIPE"});var EK,eP,tP=y(()=>{XI();xv();EK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>eP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),eP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=gp(t,e,l);if(QI(l,e)){await u;return}let[d]=await Promise.all([xK({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var AK,TK,ske,ake,rP=y(()=>{mv();tP();AK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?La([t,e].filter(Boolean)):void 0,TK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>eP({...ske(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:ake(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),ske=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},ake=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var OK,RK,IK=y(()=>{Ol();ds();OK=t=>Tl(t,"ipc"),RK=(t,e)=>{let r=ub(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var PK,CK,DK=y(()=>{ja();IK();wo();DI();PK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=OK(o),a=So(e,"ipc"),c=So(r,"ipc");for await(let l of CI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(nW(t,i,c),i.push(l)),s&&RK(l,o);return i},CK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as cke}from"node:events";var NK,lke,uke,dke,jK=y(()=>{Na();KR();zR();WR();vo();wr();XI();DK();YR();rP();tP();II();xv();NK=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=k3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=EK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=TK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=PK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=lke(h,t,S),D=uke(m,S);try{return await Promise.race([Promise.all([{},A3(_),Promise.all(x),w,T,TV(t,d),...A,...D]),g,dke(t,b),...xV(t,o,f,b),...B9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...SV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>YI(re))),YI(w),CK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},lke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:gp(n,i,r)),uke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ii(o,{checkOpen:!1})&&!ti(o)).map(({type:i,value:o,stream:s=o})=>gp(s,n,e,{isSameDirection:Pn.has(i),stopOnExit:i==="native"}))),dke=async(t,{signal:e})=>{let[r]=await cke(t,"error",{signal:e});throw r}});var MK,yp,Bl,$v=y(()=>{Nl();MK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as FK}from"node:stream/promises";var nP,LK,iP,oP,kv,Ev,sP=y(()=>{xv();nP=async t=>{if(t!==void 0)try{await iP(t)}catch{}},LK=async t=>{if(t!==void 0)try{await oP(t)}catch{}},iP=async t=>{await FK(t,{cleanup:!0,readable:!1,writable:!0})},oP=async t=>{await FK(t,{cleanup:!0,readable:!0,writable:!1})},kv=async(t,e)=>{if(await t,e)throw e},Ev=(t,e,r)=>{r&&!wv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as fke}from"node:stream";import{callbackify as pke}from"node:util";var zK,aP,cP,lP,mke,uP,dP,UK,fP=y(()=>{Ca();ps();Sv();Nl();$v();sP();zK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||an.has(r),{subprocessStdout:a,waitReadableDestroy:c}=aP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=cP(a,s),{read:f,onStdoutDataDone:p}=lP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new fke({read:f,destroy:pke(dP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return uP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},aP=(t,e,r)=>{let n=jl(t,e),i=yp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},cP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:JI},lP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=vv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){mke(this,s,o)},onStdoutDataDone:o}},mke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},uP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await oP(t),await n,await nP(i),await e,r.readable&&r.push(null)}catch(o){await nP(i),UK(r,o)}},dP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(UK(t,n),await kv(e,n))},UK=(t,e)=>{Ev(t,t.readable,e)}});import{Writable as hke}from"node:stream";import{callbackify as qK}from"node:util";var BK,pP,mP,gke,yke,hP,gP,HK,yP=y(()=>{ps();$v();sP();BK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=pP(t,r,e),s=new hke({...mP(n,t,i),destroy:qK(gP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return hP(n,s),s},pP=(t,e,r)=>{let n=$b(t,e),i=yp(r,n,"writableFinal"),o=yp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},mP=(t,e,r)=>({write:gke.bind(void 0,t),final:qK(yke.bind(void 0,t,e,r))}),gke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},yke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},hP=async(t,e,r)=>{try{await iP(t),e.writable&&e.end()}catch(n){await LK(r),HK(e,n)}},gP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(HK(t,i),await kv(e,i))},HK=(t,e)=>{Ev(t,t.writable,e)}});import{Duplex as _ke}from"node:stream";import{callbackify as bke}from"node:util";var GK,vke,ZK=y(()=>{Ca();fP();yP();GK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||an.has(r),{subprocessStdout:c,waitReadableDestroy:l}=aP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=pP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=cP(c,a),{read:g,onStdoutDataDone:b}=lP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new _ke({read:g,...mP(u,t,d),destroy:bke(vke.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return uP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),hP(u,_,c),_},vke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([dP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),gP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var _P,Ske,VK=y(()=>{Ca();ps();Sv();_P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||an.has(e),s=jl(t,r),a=vv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Ske(a,s,t)},Ske=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var WK,KK=y(()=>{$v();fP();yP();ZK();VK();WK=(t,{encoding:e})=>{let r=MK();t.readable=zK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=BK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=GK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=_P.bind(void 0,t,e),t[Symbol.asyncIterator]=_P.bind(void 0,t,e,{})}});var JK,wke,xke,YK=y(()=>{JK=(t,e)=>{for(let[r,n]of xke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},wke=(async()=>{})().constructor.prototype,xke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(wke,t)])});import{setMaxListeners as $ke}from"node:events";import{spawn as kke}from"node:child_process";var XK,Eke,Ake,Tke,Oke,Rke,QK=y(()=>{Jb();ER();eI();ps();tI();NI();up();Qb();q3();V3();dp();nK();vb();cK();vK();rP();jK();KK();Nl();YK();XK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Eke(t,e,r),{subprocess:f,promise:p}=Tke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=bv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),JK(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Eke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),{file:a,commandArguments:c,options:l}=zb(t,e,r),u=Ake(l),d=Z3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Ake=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Tke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=kke(...Ub(t,e,r))}catch(m){return U3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;$ke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];rK(c,a,l),aK(c,r,l);let d={},f=Di();c.kill=U9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=AK(c,r),WK(c,r),F3(c,r);let p=Oke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Oke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await NK({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>$o(x,e,w)),_=$o(h,e,"all"),S=Rke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return zl(S,n,e)},Rke=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?lp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Xb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Av,Ike,Pke,eJ=y(()=>{_o();wo();Av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Ike(n,t[n],i)]));return{...t,...r}},Ike=(t,e,r)=>Pke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Pke=new Set(["env",...SR])});var gs,Cke,Dke,tJ=y(()=>{_o();gR();rZ();I3();QK();eJ();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Cke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Cke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Dke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?R3(a,c,l):XK(a,c,l,i)},Dke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=eZ(e)?tZ(e,r):[e,...r],[s,a,c]=eb(...o),l=Av(Av(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var rJ,nJ,iJ,Nke,jke,oJ=y(()=>{rJ=({file:t,commandArguments:e})=>iJ(t,e),nJ=({file:t,commandArguments:e})=>({...iJ(t,e),isSync:!0}),iJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=Nke(t);return{file:r,commandArguments:n}},Nke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(jke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},jke=/ +/g});var sJ,aJ,Mke,cJ,Fke,lJ,uJ=y(()=>{sJ=(t,e,r)=>{t.sync=e(Mke,r),t.s=t.sync},aJ=({options:t})=>cJ(t),Mke=({options:t})=>({...cJ(t),isSync:!0}),cJ=t=>({options:{...Fke(t),...t}}),Fke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},lJ={preferLocal:!0}});var Sut,We,wut,xut,$ut,kut,Eut,Aut,Tut,Out,Lr=y(()=>{tJ();oJ();JR();uJ();NI();Sut=gs(()=>({})),We=gs(()=>({isSync:!0})),wut=gs(rJ),xut=gs(nJ),$ut=gs(kV),kut=gs(aJ,{},lJ,sJ),{sendMessage:Eut,getOneMessage:Aut,getEachMessage:Tut,getCancelSignal:Out}=L3()});import{existsSync as Tv,statSync as Lke}from"node:fs";import{dirname as bP,extname as zke,isAbsolute as dJ,join as vP,relative as SP,resolve as Ov,sep as Uke}from"node:path";function Rv(t){return t==="./gradlew"||t==="gradle"}function qke(t){return(Tv(vP(t,"build.gradle.kts"))||Tv(vP(t,"build.gradle")))&&Tv(vP(t,"gradle.properties"))}function Bke(t,e){let n=SP(t,e).split(Uke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Hke(t,e){let r=Ov(t,e),n=r;Tv(r)?Lke(r).isFile()&&(n=bP(r)):zke(r)!==""&&(n=bP(r));let i=SP(t,n);if(i.startsWith("..")||dJ(i))return null;let o=n;for(;;){if(qke(o))return o;if(Ov(o)===Ov(t))return null;let s=bP(o);if(s===o)return null;let a=SP(t,s);if(a.startsWith("..")||dJ(a))return null;o=s}}function Iv(t,e){let r=Ov(t),n=new Map,i=[];for(let o of e){let s=Hke(r,o);if(!s){i.push(o);continue}let a=Bke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Pv=y(()=>{"use strict"});import{existsSync as xP,readFileSync as Gke}from"node:fs";import{join as Hl}from"node:path";function Gl(t="."){let e=Hl(t,".cladding","config.yaml");if(!xP(e))return wP;try{let n=(0,fJ.parse)(Gke(e,"utf8"))?.gate;if(!n)return wP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Zke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return wP}}function pJ(t="."){let e=Gl(t).testReport,r=e?[e,...$P]:$P;return[...new Set(r.map(n=>Hl(t,n)))]}function mJ(t="."){let e=Gl(t).testReport;if(e){let r=Hl(t,e);return xP(r)?r:null}return $P.map(r=>Hl(t,r)).find(r=>xP(r))??null}function hJ(t,e){let r=[],n=!1;for(let i of t){let o=Vke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var fJ,Zke,wP,$P,Vke,_p=y(()=>{"use strict";fJ=St(er(),1);Pv();Zke=["type","lint","test","coverage"],wP={scope:"feature"},$P=["test-report.junit.xml",Hl("coverage","junit.xml"),Hl(".cladding","test-report.junit.xml")];Vke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as EP,readFileSync as gJ,readdirSync as Wke,statSync as Kke}from"node:fs";import{join as Cv}from"node:path";function OP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Cv(t,e);if(EP(r))try{if(yJ.test(gJ(r,"utf8")))return!0}catch{}}return!1}function _J(t){try{return EP(t)&&yJ.test(gJ(t,"utf8"))}catch{return!1}}function bJ(t,e=0){if(e>4||!EP(t))return!1;let r;try{r=Wke(t)}catch{return!1}for(let n of r){let i=Cv(t,n),o=!1;try{o=Kke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(bJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&_J(i))return!0}return!1}function Xke(t){if(OP(t))return!0;for(let e of Jke)if(_J(Cv(t,e)))return!0;for(let e of Yke)if(bJ(Cv(t,e)))return!0;return!1}function vJ(t="."){let e=Gl(t).coverage;return e||(Xke(t)?"kover":"jacoco")}function SJ(t="."){return AP[vJ(t)]}function wJ(t="."){return kP[vJ(t)]}var AP,kP,TP,yJ,Jke,Yke,Dv=y(()=>{"use strict";_p();AP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},TP=[kP.kover,kP.jacoco],yJ=/kover/i;Jke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Yke=["buildSrc","build-logic"]});import{existsSync as Zl,readFileSync as IP,readdirSync as $J}from"node:fs";import{dirname as Qke,join as xr,resolve as eEe}from"node:path";import bp from"node:process";function PP(t){return Zl(xr(t,"gradlew"))?"./gradlew":"gradle"}function tEe(t){let e=PP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[SJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function rEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(IP(xr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function iEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function aEe(t,e){for(let r of e)if(Zl(xr(t,r)))return r}function cEe(t,e){try{return $J(t).find(n=>n.endsWith(e))}catch{return}}function fEe(t){let e=[],r=bp.platform==="win32";r||e.push(xr("/etc","madge","config"),xr("/etc","madgerc"));let n=r?bp.env.USERPROFILE:bp.env.HOME;n&&e.push(xr(n,".config","madge","config"),xr(n,".config","madge"),xr(n,".madge","config"),xr(n,".madgerc"));for(let o=eEe(t);;){e.push(xr(o,".madgerc"));let s=Qke(o);if(s===o)break;o=s}let i=bp.env.MADGE_config??bp.env.madge_config;return i&&e.push(i),e}function pEe(t){let e;try{e=IP(t,"utf8")}catch{return!0}try{return JSON.parse(e).excludeRegExp!==void 0}catch{return!0}}function mEe(t,e){let r=e.madge;return r&&typeof r=="object"&&r.excludeRegExp!==void 0?!0:fEe(t).some(n=>Zl(n)&&pEe(n))}function hEe(t){try{return JSON.parse(IP(xr(t,"package.json"),"utf8"))}catch{return{}}}function vp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function xJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function gEe(t,e,r){if(mEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",dEe),{...e,args:n}}function yEe(t,e,r){if(vp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of lEe)if(n.configs.some(i=>Zl(xr(t,i))))return n.gate;if(uEe.some(n=>Zl(xr(t,n)))||r.eslintConfig!==void 0)return e}function bEe(t,e){return _Ee.some(r=>Zl(xr(t,r)))?!0:e.jest!==void 0}function vEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function RP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function SEe(t,e){let r=hEe(t),n=e.lint?yEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:gEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:RP(i,"lint"),s=vp(r,"test"),a=s?vEe(s):void 0;return s&&!a?(o=RP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...vp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&bEe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!vp(r,"coverage")&&!xJ(r,"@vitest/coverage-v8")&&!xJ(r,"@vitest/coverage-istanbul")?o=RP(o,"coverage"):a==="vitest"&&vp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of oEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=cEe(t,o):r=aEe(t,[o]),r)break;if(!r||e.requiresSource&&!iEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?SEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return sEe}var Fi,nEe,oEe,sEe,lEe,uEe,dEe,_Ee,cn=y(()=>{"use strict";Dv();Fi=["--offline","--no-install"];nEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);oEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:tEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:rEe}],sEe={language:"unknown",manifest:"",gates:{}};lEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],uEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],dEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";_Ee=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as wEe,readFileSync as xEe}from"node:fs";import{join as $Ee}from"node:path";function Ua(t){return t.code==="ENOENT"}function Nv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return kJ.test(o)||kJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ua(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} -${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Vl(t,e){let r=$Ee(t,"package.json");if(!wEe(r))return!1;try{return!!JSON.parse(xEe(r,"utf8")).scripts?.[e]}catch{return!1}}var kJ,Cn=y(()=>{"use strict";kJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function kEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:jv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:jv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Nv(i,jv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var jv,qa,Mv=y(()=>{"use strict";Lr();cn();Cn();jv="ARCHITECTURE_VIOLATION";qa={name:jv,subprocess:!0,run:kEe}});function EEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Fv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:Fv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Nv(i,Fv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Fv,Ba,Lv=y(()=>{"use strict";Lr();cn();Cn();Fv="HARDCODED_SECRET";Ba={name:Fv,subprocess:!0,run:EEe}});import{existsSync as CP,readdirSync as EJ}from"node:fs";import{join as zv}from"node:path";function TEe(t,e){let r=zv(t,e.path);if(!CP(r))return!0;if(e.isDirectory)try{return EJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function OEe(t){let{cwd:e="."}=t,r=[];for(let i of AEe)TEe(e,i)&&r.push({detector:Sp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=zv(e,"spec.yaml");if(CP(n)){let i=PEe(n),o=i?null:REe(e);if(i)r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Sp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=IEe(e);s&&r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function REe(t){for(let e of["spec/features","spec/scenarios"]){let r=zv(t,e);if(!CP(r))continue;let n;try{n=EJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(zv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function IEe(t){try{return q(t),null}catch(e){return e.message}}function PEe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Sp,AEe,AJ,TJ=y(()=>{"use strict";Ue();H_();Sp="ABSENCE_OF_GOVERNANCE",AEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];AJ={name:Sp,run:OEe}});function Uv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Uv(r)==="while",o=DEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Uv(r)}'`}let n=CEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Uv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Uv(r)}'`:null}function NEe(t,e){let r=DP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function OJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...NEe(r,n));return e}var CEe,DEe,NP=y(()=>{"use strict";CEe={event:"when",state:"while",optional:"where",unwanted:"if"},DEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function jEe(t){let{cwd:e="."}=t;return ge(e,qv,MEe)}function MEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:qv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of OJ(t.features))e.push({detector:qv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var qv,RJ,IJ=y(()=>{"use strict";NP();wt();qv="AC_DRIFT";RJ={name:qv,run:jEe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return CJ[n]??PJ}var FEe,LEe,zEe,PJ,UEe,qEe,CJ,BEe,DJ,Ha=y(()=>{"use strict";cn();FEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,LEe=/^[ \t]*import\s+([\w.]+)/gm,zEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,PJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:FEe,importStyle:"relative"},UEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:LEe,importStyle:"dotted"},qEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:zEe,importStyle:"dotted"},CJ={typescript:PJ,kotlin:UEe,python:qEe},BEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],DJ=new Set([...Object.values(CJ).flatMap(t=>t?.extensions??[]),...BEe].map(t=>t.toLowerCase()))});import{existsSync as HEe,readFileSync as GEe,readdirSync as ZEe,statSync as VEe}from"node:fs";import{join as jJ,relative as NJ}from"node:path";function WEe(t,e){if(!HEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=ZEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=jJ(i,s),c;try{c=VEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function KEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function YEe(t){return JEe.test(t)}function XEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>WEe(jJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=GEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Ha();MJ="AI_HINTS_FORBIDDEN_PATTERN";JEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;FJ={name:MJ,run:XEe}});function QEe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:zJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var zJ,UJ,qJ=y(()=>{"use strict";Ue();zJ="AC_DUPLICATE_WITHIN_FEATURE";UJ={name:zJ,run:QEe}});import{createRequire as eAe}from"module";import{basename as tAe,dirname as MP,normalize as rAe,relative as nAe,resolve as iAe,sep as GJ}from"path";import*as oAe from"fs";function sAe(t){let e=rAe(t);return e.length>1&&e[e.length-1]===GJ&&(e=e.substring(0,e.length-1)),e}function ZJ(t,e){return t.replace(aAe,e)}function lAe(t){return t==="/"||cAe.test(t)}function jP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=iAe(t)),(n||o)&&(t=sAe(t)),t===".")return"";let s=t[t.length-1]!==i;return ZJ(s?t+i:t,i)}function VJ(t,e){return e+t}function uAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:ZJ(nAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function dAe(t){return t}function fAe(t,e,r){return e+t+r}function pAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?uAe(t,e):n?VJ:dAe}function mAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function hAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function bAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?hAe(t):mAe(t):n&&n.length?yAe:gAe:_Ae}function kAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?$Ae:r&&r.length?n?vAe:SAe:n?wAe:xAe}function TAe(t){return t.group?AAe:EAe}function IAe(t){return t.group?OAe:RAe}function DAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?CAe:PAe}function WJ(t,e,r){if(r.options.useRealPaths)return NAe(e,r);let n=MP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=MP(n)}return r.symlinks.set(t,e),i>1}function NAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Bv(t,e,r,n){e(t&&!n?t:null,r)}function HAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?jAe:zAe:n?e?MAe:BAe:i?e?LAe:qAe:e?FAe:UAe}function VAe(t){return t?ZAe:GAe}function YAe(t,e){return new Promise((r,n)=>{YJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function YJ(t,e,r){new JJ(t,e,r).start()}function XAe(t,e){return new JJ(t,e).start()}var BJ,aAe,cAe,gAe,yAe,_Ae,vAe,SAe,wAe,xAe,$Ae,EAe,AAe,OAe,RAe,PAe,CAe,jAe,MAe,FAe,LAe,zAe,UAe,qAe,BAe,KJ,GAe,ZAe,WAe,KAe,JAe,JJ,HJ,XJ,QJ,e8=y(()=>{BJ=eAe(import.meta.url);aAe=/[\\/]/g;cAe=/^[a-z]:[\\/]$/i;gAe=(t,e)=>{e.push(t||".")},yAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},_Ae=()=>{};vAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},SAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},wAe=(t,e,r,n)=>{r.files++},xAe=(t,e)=>{e.push(t)},$Ae=()=>{};EAe=t=>t,AAe=()=>[""].slice(0,0);OAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},RAe=()=>{};PAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&WJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},CAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&WJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};jAe=t=>t.counts,MAe=t=>t.groups,FAe=t=>t.paths,LAe=t=>t.paths.slice(0,t.options.maxFiles),zAe=(t,e,r)=>(Bv(e,r,t.counts,t.options.suppressErrors),null),UAe=(t,e,r)=>(Bv(e,r,t.paths,t.options.suppressErrors),null),qAe=(t,e,r)=>(Bv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),BAe=(t,e,r)=>(Bv(e,r,t.groups,t.options.suppressErrors),null);KJ={withFileTypes:!0},GAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",KJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},ZAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",KJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};WAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},KAe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},JAe=class{aborted=!1;abort(){this.aborted=!0}},JJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=HAe(e,this.isSynchronous),this.root=jP(t,e),this.state={root:lAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new KAe,options:e,queue:new WAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new JAe,fs:e.fs||oAe},this.joinPath=pAe(this.root,e),this.pushDirectory=bAe(this.root,e),this.pushFile=kAe(e),this.getArray=TAe(e),this.groupFiles=IAe(e),this.resolveSymlink=DAe(e,this.isSynchronous),this.walkDirectory=VAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=jP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=tAe(_),x=jP(MP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};HJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return YAe(this.root,this.options)}withCallback(t){YJ(this.root,this.options,t)}sync(){return XAe(this.root,this.options)}},XJ=null;try{BJ.resolve("picomatch"),XJ=BJ("picomatch")}catch{}QJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:GJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new HJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new HJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||XJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var wp=v((Cdt,o8)=>{"use strict";var t8="[^\\\\/]",QAe="(?=.)",r8="[^/]",FP="(?:\\/|$)",n8="(?:^|\\/)",LP=`\\.{1,2}${FP}`,eTe="(?!\\.)",tTe=`(?!${n8}${LP})`,rTe=`(?!\\.{0,1}${FP})`,nTe=`(?!${LP})`,iTe="[^.\\/]",oTe=`${r8}*?`,sTe="/",i8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:QAe,QMARK:r8,END_ANCHOR:FP,DOTS_SLASH:LP,NO_DOT:eTe,NO_DOTS:tTe,NO_DOT_SLASH:rTe,NO_DOTS_SLASH:nTe,QMARK_NO_DOT:iTe,STAR:oTe,START_ANCHOR:n8,SEP:sTe},aTe={...i8,SLASH_LITERAL:"[\\\\/]",QMARK:t8,STAR:`${t8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},cTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};o8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:cTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?aTe:i8}}});var xp=v(zr=>{"use strict";var{REGEX_BACKSLASH:lTe,REGEX_REMOVE_BACKSLASH:uTe,REGEX_SPECIAL_CHARS:dTe,REGEX_SPECIAL_CHARS_GLOBAL:fTe}=wp();zr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);zr.hasRegexChars=t=>dTe.test(t);zr.isRegexChar=t=>t.length===1&&zr.hasRegexChars(t);zr.escapeRegex=t=>t.replace(fTe,"\\$1");zr.toPosixSlashes=t=>t.replace(lTe,"/");zr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};zr.removeBackslashes=t=>t.replace(uTe,e=>e==="\\"?"":e);zr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?zr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};zr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};zr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};zr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var p8=v((Ndt,f8)=>{"use strict";var s8=xp(),{CHAR_ASTERISK:zP,CHAR_AT:pTe,CHAR_BACKWARD_SLASH:$p,CHAR_COMMA:mTe,CHAR_DOT:UP,CHAR_EXCLAMATION_MARK:qP,CHAR_FORWARD_SLASH:d8,CHAR_LEFT_CURLY_BRACE:BP,CHAR_LEFT_PARENTHESES:HP,CHAR_LEFT_SQUARE_BRACKET:hTe,CHAR_PLUS:gTe,CHAR_QUESTION_MARK:a8,CHAR_RIGHT_CURLY_BRACE:yTe,CHAR_RIGHT_PARENTHESES:c8,CHAR_RIGHT_SQUARE_BRACKET:_Te}=wp(),l8=t=>t===d8||t===$p,u8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},bTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&l8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=s8.removeBackslashes(P)),xe&&_===!0&&(xe=s8.removeBackslashes(xe)));let Cr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Cr.maxDepth=0,l8(A)||s.push(D),Cr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var kp=wp(),ln=xp(),{MAX_LENGTH:Hv,POSIX_REGEX_SOURCE:vTe,REGEX_NON_SPECIAL_CHARS:STe,REGEX_SPECIAL_CHARS_BACKREF:wTe,REPLACEMENTS:m8}=kp,xTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>ln.escapeRegex(i)).join("..")}return r},Wl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,h8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},$Te=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},g8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if($Te(e))return e.replace(/\\(.)/g,"$1")},kTe=t=>{let e=t.map(g8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},ETe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=g8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?ln.escapeRegex(r[0]):`[${r.map(i=>ln.escapeRegex(i)).join("")}]`}*`},ATe=t=>{let e=0,r=t.trim(),n=GP(r);for(;n;)e++,r=n.body.trim(),n=GP(r);return e},TTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kp.DEFAULT_MAX_EXTGLOB_RECURSION,n=h8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||kTe(n)))return{risky:!0};for(let i of n){let o=ETe(i);if(o)return{risky:!0,safeOutput:o};if(ATe(i)>r)return{risky:!0}}return{risky:!1}},ZP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=m8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=kp.globChars(r.windows),l=kp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ln.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Cr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},uo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},ki=H=>{$[H]++,xe.push(H)},en=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},fo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;ki("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Kde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=TTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[H.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=lt||ln.escapeRegex(ht);for(let Ai=H.tokensIndex+1;Ai1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Cr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=ZP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${Ei})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),en("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(wTe,(B,Oe,ut,zt,lt,Ei)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):Ei===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=ln.wrapOutput(ht,$,e),$)}for(;!Cr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=vTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=ln.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){ki("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Wl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Kde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),en("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));P=`\\${P}`}else ki("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Wl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}en("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||ln.hasRegexChars(B))continue;let Oe=ln.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=xTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),en("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){fo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){uo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=STe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){fo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!Ei){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ai=t[$.index+4];if(Ai&&Ai!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Cr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Cr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ai=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ai})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));$.output=ln.escapeLast($.output,"["),en("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing",")"));$.output=ln.escapeLast($.output,"("),en("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","}"));$.output=ln.escapeLast($.output,"{"),en("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};ZP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=m8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=kp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=ln.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};y8.exports=ZP});var S8=v((Mdt,v8)=>{"use strict";var OTe=p8(),VP=_8(),b8=xp(),RTe=wp(),ITe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=ITe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?b8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(b8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):VP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>OTe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=VP.fastpaths(t,e)),i.output||(i=VP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=RTe;v8.exports=Rt});var k8=v((Fdt,$8)=>{"use strict";var w8=S8(),PTe=xp();function x8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:PTe.isWindows()}),w8(t,e,r)}Object.assign(x8,w8);$8.exports=x8});import{readdir as CTe,readdirSync as DTe,realpath as NTe,realpathSync as jTe,stat as MTe,statSync as FTe}from"fs";import{isAbsolute as LTe,posix as Ga,resolve as zTe}from"path";import{fileURLToPath as UTe}from"url";function HTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&BTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ga.relative(t,n)||".":n=>Ga.relative(t,`${e}/${n}`)||"."}function VTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ga.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function O8(t){var e;let r=Kl.default.scan(t,WTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function eOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Kl.default.scan(t);return r.isGlob||r.negated}function Ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function R8(t){return typeof t=="string"?[t]:t??[]}function WP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=QTe(o);s=LTe(s.replace(rOe,""))?Ga.relative(a,s):Ga.normalize(s);let c=(i=tOe.exec(s))===null||i===void 0?void 0:i[0],l=O8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ga.join(o,...d):o}return s}function nOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function iOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=nOe(t,e,n);t.debug&&Ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(A8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Kl.default)(i.match,f),m=(0,Kl.default)(i.ignore,f),h=HTe(i.match,f),g=E8(r,d,o),b=o?g:E8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new QJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&Ep(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return Ep(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&VTe(r,d)]}function oOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function aOe(t){let e={...sOe,...t};return e.cwd=(e.cwd instanceof URL?UTe(e.cwd):zTe(e.cwd)).replace(A8,"/"),e.ignore=R8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||CTe,readdirSync:e.fs.readdirSync||DTe,realpath:e.fs.realpath||NTe,realpathSync:e.fs.realpathSync||jTe,stat:e.fs.stat||MTe,statSync:e.fs.statSync||FTe}),e.debug&&Ep("globbing with options:",e),e}function cOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=qTe(t)||typeof t=="string",i=R8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=aOe(n?e:t);return i.length>0?iOe(o,i):[]}function _s(t,e){let[r,n]=cOe(t,e);return r?oOe(r.sync(),n):[]}var Kl,qTe,A8,T8,BTe,GTe,ZTe,WTe,KTe,JTe,YTe,XTe,QTe,tOe,rOe,sOe,Ap=y(()=>{e8();Kl=St(k8(),1),qTe=Array.isArray,A8=/\\/g,T8=process.platform==="win32",BTe=/^(\/?\.\.)+$/;GTe=/^[A-Z]:\/$/i,ZTe=T8?t=>GTe.test(t):t=>t==="/";WTe={parts:!0};KTe=/(?t.replace(KTe,"\\$&"),XTe=t=>t.replace(JTe,"\\$&"),QTe=T8?XTe:YTe;tOe=/^(\/?\.\.)+/,rOe=/\\(?=[()[\]{}!*+?@|])/g;sOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Tp,readFileSync as lOe,readdirSync as uOe,statSync as I8}from"node:fs";import{join as Za}from"node:path";function dOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=KP(r);return(s.size>0||a.length>0)&&!Tp(Za(e,i.mainRoot))?[{detector:Op,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(fOe(e,i,s,o),pOe(e,i,s,o)),a.length>0&&mOe(e,i,a,o),o)}function KP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function fOe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of uOe(o)){let a=Za(o,s);I8(a).isDirectory()&&(r.has(s)||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function pOe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of r){let a=Za(o,s);Tp(a)&&I8(a).isDirectory()||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function mOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Za(t,i,s.from);if(!Tp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Za(a,l),d;try{d=lOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];hOe(p,s.to,e.importStyle)&&n.push({detector:Op,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function hOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Op,P8,JP=y(()=>{"use strict";Ap();Ue();Ha();Op="ARCHITECTURE_FROM_SPEC";P8={name:Op,run:dOe}});import{existsSync as gOe,readFileSync as yOe}from"node:fs";import{join as _Oe}from"node:path";function vOe(t){let{cwd:e="."}=t,r=_Oe(e,"spec/capabilities.yaml");if(!gOe(r))return[];let n;try{let u=yOe(r,"utf8"),d=C8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size{"use strict";C8=St(er(),1);Ue();Gv="CAPABILITIES_FEATURE_MAPPING",bOe=8;D8={name:Gv,run:vOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function $Oe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function kOe(t){let{cwd:e="."}=t;return ge(e,YP,r=>EOe(r,e))}function EOe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=xOe(e,o);if(!SOe(s))continue;let a=wOe(s,"utf8");$Oe(a)||n.push({detector:YP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YP,j8,M8=y(()=>{"use strict";Ha();wt();YP="CONVENTION_DRIFT";j8={name:YP,run:kOe}});import{existsSync as XP,readFileSync as F8}from"node:fs";import{join as Zv}from"node:path";function AOe(t){return JSON.parse(t).total?.lines?.pct??0}function L8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function ROe(t,e){if(!Rv(dt(t).gates.coverage?.cmd))return null;let r;try{r=Iv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=TP.find(d=>XP(Zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=L8(F8(Zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=z8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function IOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=ROe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=dt(e).language==="kotlin"?TP.find(a=>XP(Zv(e,a)))??wJ(e):n.coverageSummary,o=Zv(e,i);if(!XP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=F8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?TOe(a):n.coverageFormat==="cobertura-xml"?OOe(a):AOe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Vv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Vv}%`}]}var ko,Vv,U8,q8=y(()=>{"use strict";Ue();Dv();Ha();Pv();cn();ko="COVERAGE_DROP",Vv=70;U8={name:ko,run:IOe}});import{existsSync as POe}from"node:fs";import{join as COe}from"node:path";function NOe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>jOe(r,e))}function jOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Wv="DELIVERABLE_INTEGRITY",DOe=8;B8={name:Wv,run:NOe}});function MOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Kv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function FOe(t){let e=MOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Kv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function LOe(t){let{cwd:e="."}=t;return ge(e,Kv,r=>FOe(r))}var Kv,G8,Z8=y(()=>{"use strict";wt();Kv="SMOKE_PROBE_DEMAND";G8={name:Kv,run:LOe}});function zOe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>UOe(r,e))}function UOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Jv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=J_(n,e,o);s.state!=="fresh"&&i.push({detector:Jv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Jv,Yv,QP=y(()=>{"use strict";xl();wt();Jv="STALE_ATTESTATION";Yv={name:Jv,run:zOe}});function qOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return BOe(r)}function BOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:V8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var V8,Xv,eC=y(()=>{"use strict";Ue();V8="DEPENDENCY_CYCLE";Xv={name:V8,run:qOe}});import{appendFileSync as HOe,existsSync as W8,mkdirSync as GOe,readFileSync as ZOe}from"node:fs";import{dirname as VOe,join as WOe}from"node:path";function K8(t){return WOe(t,KOe,JOe)}function J8(t){return tC.add(t),()=>tC.delete(t)}function Va(t,e){let r=K8(t),n=VOe(r);W8(n)||GOe(n,{recursive:!0}),HOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of tC)try{i(t,e)}catch{}}function fr(t){let e=K8(t);if(!W8(e))return[];let r=ZOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var KOe,JOe,tC,un=y(()=>{"use strict";KOe=".cladding",JOe="audit.log.jsonl";tC=new Set});import{existsSync as YOe}from"node:fs";import{join as XOe}from"node:path";function QOe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:rC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(YOe(XOe(e,i.artifact))||n.push({detector:rC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var rC,Y8,X8=y(()=>{"use strict";un();rC="EVIDENCE_MISMATCH";Y8={name:rC,run:QOe}});import{existsSync as eRe,readFileSync as tRe}from"node:fs";import{join as rRe}from"node:path";function nRe(t){let e=rRe(t,r5);if(!eRe(e))return null;try{let n=((0,t5.parse)(tRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*e5(t,e){for(let r of t??[])r.startsWith(Q8)&&(yield{ref:r,name:r.slice(Q8.length),field:e})}function iRe(t){let{cwd:e="."}=t,r=nRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:nC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...e5(s.evidence_refs,"evidence_refs"),...e5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:nC,severity:"warn",path:r5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var t5,nC,Q8,r5,n5,i5=y(()=>{"use strict";t5=St(er(),1);Ue();nC="FIXTURE_REFERENCE_INVALID",Q8="fixture:",r5="conformance/fixtures.yaml";n5={name:nC,run:iRe}});import{existsSync as Jl,readFileSync as iC}from"node:fs";import{join as Wa}from"node:path";function oRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Rp(t){if(!Jl(t))return null;try{return JSON.parse(iC(t,"utf8"))}catch{return null}}function sRe(t,e){let r=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=oRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function aRe(t,e){for(let r of o5){let n=Wa(t,r.path);if(!Jl(n))continue;let i=Rp(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function cRe(t,e){let r=Rp(Wa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of o5){let s=Wa(t,o.path);if(!Jl(s))continue;let a=Rp(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Wa(t,".claude-plugin","marketplace.json");if(Jl(i)){let o=Rp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function lRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function uRe(t,e){let r=Wa(t,"src","cli","clad.ts"),n=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Jl(r)||!Jl(n))return;let i=lRe(iC(r,"utf8"));if(i.length===0)return;let s=Rp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function dRe(t){let{cwd:e="."}=t,r=[];return sRe(e,r),uRe(e,r),aRe(e,r),cRe(e,r),r}var Eo,o5,s5,a5=y(()=>{"use strict";Ap();Eo="HARNESS_INTEGRITY",o5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];s5={name:Eo,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function gRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>_Re(r,e))}function yRe(t){let e=mRe(t,"spec/capabilities.yaml");if(!fRe(e))return!1;try{let r=c5.default.parse(pRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function _Re(t,e){let r=t.features.length;if(r{"use strict";c5=St(er(),1);wt();Qv="HOLLOW_GOVERNANCE",hRe=8;l5={name:Qv,run:gRe}});import{existsSync as d5,readFileSync as f5}from"node:fs";import{join as p5}from"node:path";function m5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function SRe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function wRe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function xRe(t){let e=p5(t,"README.md"),r=p5(t,"docs","dogfood","matrix.md");if(!d5(e)||!d5(r))return[];let n=m5(f5(e,"utf8"),bRe),i=m5(f5(r,"utf8"),vRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=wRe(a);if(c===null)continue;let l=i[s]??"not-run",u=SRe(l);u!==null&&c>u&&o.push({detector:h5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function $Re(t){let{cwd:e="."}=t;return xRe(e)}var h5,bRe,vRe,g5,y5=y(()=>{"use strict";h5="HOST_CLAIM_DRIFT",bRe=//,vRe=//;g5={name:h5,run:$Re}});function kRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return _5(r.features.map(i=>i.id),"feature","spec/features/",n),_5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function _5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:b5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var b5,v5,S5=y(()=>{"use strict";Ue();b5="ID_COLLISION";v5={name:b5,run:kRe}});import{existsSync as Ip,readFileSync as oC,readdirSync as sC,statSync as ERe,writeFileSync as x5}from"node:fs";import{join as Ao}from"node:path";function w5(t){if(!Ip(t))return 0;try{return sC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ARe(t){if(!Ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=ERe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function TRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Ip(e))return 0;try{let r=eS.default.parse(oC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=w5(Ao(t,"spec","features")),r=w5(Ao(t,"spec","scenarios")),n=TRe(t),i=ARe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Yl(t,e){let r=Ao(t,"spec.yaml");if(!Ip(r))return;let n=oC(r,"utf8"),i=ORe(n,e);i!==n&&x5(r,i)}function ORe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as i0e}from"node:buffer";import{StringDecoder as o0e}from"node:string_decoder";var av,s0e,a0e,c0e,xI=y(()=>{sn();av=(t,e,r)=>{if(r)return;if(t)return{transform:s0e.bind(void 0,new TextEncoder)};let n=new o0e(e);return{transform:a0e.bind(void 0,n),final:c0e.bind(void 0,n)}},s0e=function*(t,e){i0e.isBuffer(e)?yield bo(e):typeof e=="string"?yield t.encode(e):yield e},a0e=function*(t,e){yield qt(e)?t.write(e):e},c0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as l3}from"node:util";var $I,cv,u3,l0e,d3,u0e,f3=y(()=>{$I=l3(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for await(let i of n(t))yield*cv(i,e,r+1)},u3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cv(n,r,e+1)},d3=l3(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),u0e=function*(t){yield t}});var kI,p3,Fa,fp,d0e,f0e,EI=y(()=>{kI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},p3=(t,e)=>[...e.flatMap(r=>[...Fa(r,t,0)]),...fp(t)],Fa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=f0e}=e[r];for(let i of n(t))yield*Fa(i,e,r+1)},fp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*d0e(r,Number(e),t)},d0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Fa(n,r,e+1)},f0e=function*(t){yield t}});import{Transform as p0e,getDefaultHighWaterMark as m3}from"node:stream";var AI,lv,h3,uv=y(()=>{wr();sv();c3();xI();f3();EI();AI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=h3(t,s,o),l=Ma(e),u=Ma(r),d=l?$I.bind(void 0,cv,a):kI.bind(void 0,Fa),f=l||u?$I.bind(void 0,u3,a):kI.bind(void 0,fp),p=l||u?d3.bind(void 0,a):void 0;return{stream:new p0e({writableObjectMode:n,writableHighWaterMark:m3(n),readableObjectMode:i,readableHighWaterMark:m3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},lv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=h3(s,r,a);t=p3(c,t)}return t},h3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:o3(n,a)},av(r,s,n),ov(r,o,n,c),{transform:t,final:e},{transform:s3(i,a)},i3({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var g3,m0e,h0e,g0e,y0e,y3=y(()=>{uv();sn();wr();g3=(t,e)=>{for(let r of m0e(t))h0e(t,r,e)},m0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),h0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>g0e(a,n));r.input=Jf(s)},g0e=(t,e)=>{let r=lv(t,e,"utf8",!0);return y0e(r),Jf(r)},y0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var dv,_0e,b0e,_3,b3,v0e,v3,TI=y(()=>{Ca();wr();Ol();ds();dv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Tl(r,n)&&!an.has(e)&&_0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&b0e.has(o))||t.every(({type:i})=>Pn.has(i))),_0e=t=>t===1||t===2,b0e=new Set(["pipe","overlapped"]),_3=async(t,e,r,n)=>{for await(let i of t)v0e(e)||v3(i,r,n)},b3=(t,e,r)=>{for(let n of t)v3(n,e,r)},v0e=t=>t._readableState.pipes.length>0,v3=(t,e,r)=>{let n=ub(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as S0e,appendFileSync as w0e}from"node:fs";var S3,x0e,$0e,k0e,E0e,A0e,w3=y(()=>{TI();uv();sv();sn();wr();ja();S3=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>x0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},x0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=sW(t,o,d),p=bo(f),{stdioItems:m,objectMode:h}=e[r],g=$0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=k0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});E0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&A0e(b,m,i),S}catch(x){return n.error=x,S}},$0e=(t,e,r,n)=>{try{return lv(t,e,r,!1)}catch(i){return n.error=i,t}},k0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Jf(t)};let s=JG(t,r);return n[o]?{serializedResult:s,finalResult:wI(s,!i[o],e)}:{serializedResult:s}},E0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!dv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wI(t,!1,s);try{b3(a,e,n)}catch(c){r.error??=c}},A0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>rv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?w0e(n,t):(r.add(o),S0e(n,t))}}});var x3,$3=y(()=>{sn();dp();x3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,$o(e,r,"all")]:Array.isArray(e)?[$o(t,r,"all"),...e]:qt(t)&&qt(e)?yR([t,e]):`${t}${e}`}});import{once as OI}from"node:events";var k3,T0e,E3,A3,O0e,RI,II=y(()=>{Ia();k3=async(t,e)=>{let[r,n]=await T0e(t);return e.isForcefullyTerminated??=!1,[r,n]},T0e=async t=>{let[e,r]=await Promise.allSettled([OI(t,"spawn"),OI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?E3(t):r.value},E3=async t=>{try{return await OI(t,"exit")}catch{return E3(t)}},A3=async t=>{let[e,r]=await t;if(!O0e(e,r)&&RI(e,r))throw new ri;return[e,r]},O0e=(t,e)=>t===void 0&&e===void 0,RI=(t,e)=>t!==0||e!==null});var T3,R0e,O3=y(()=>{Ia();ja();II();T3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R0e(t,e,r),s=o?.code==="ETIMEDOUT",a=oW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R0e=(t,e,r)=>t!==void 0?t:RI(e,r)?new ri:void 0});import{spawnSync as I0e}from"node:child_process";var R3,P0e,C0e,D0e,fv,N0e,j0e,M0e,F0e,I3=y(()=>{ER();eI();tI();up();Qb();t3();dp();y3();w3();ja();$3();O3();R3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=P0e(t,e,r),d=N0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return zl(d,c,l)},P0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),a=C0e(r),{file:c,commandArguments:l,options:u}=zb(t,e,a);D0e(u);let d=QW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},C0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,D0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&fv("ipcInput"),t&&fv("ipc: true"),r&&fv("detached: true"),n&&fv("cancelSignal")},fv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},N0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=j0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=T3(c,r),{output:m,error:h=l}=S3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>$o(_,r,S)),b=$o(x3(m,r),r,"all");return F0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},j0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{g3(o,r);let a=M0e(r);return I0e(...Ub(t,e,a))}catch(a){return Ll({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Yb(e)}),F0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Xb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):lp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as PI,on as L0e}from"node:events";var P3,z0e,U0e,q0e,B0e,C3=y(()=>{Dl();ip();np();P3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Pl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),z0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),z0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Eb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([U0e(o,n,s),q0e(o,r,s),B0e(o,r,s)])}catch(a){throw Cl(t),a}finally{s.abort(),Ab(e,i)}},U0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await PI(t,"message",{signal:r});return n}for await(let[n]of L0e(t,"message",{signal:r}))if(e(n))return n},q0e=async(t,e,{signal:r})=>{await PI(t,"disconnect",{signal:r}),H9(e)},B0e=async(t,e,{signal:r})=>{let[n]=await PI(t,"strict:error",{signal:r});throw wb(n,e)}});import{once as N3,on as H0e}from"node:events";var j3,CI,G0e,Z0e,V0e,D3,DI=y(()=>{Dl();ip();np();j3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Pl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),Eb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return G0e(t,s,a),Z0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),V0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},G0e=async(t,e,r)=>{try{await N3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Z0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await N3(t,"strict:error",{signal:r.signal});n.error=wb(i,e),r.abort()}catch{}},V0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of H0e(r,"message",{signal:o.signal}))D3(s),yield c}catch{D3(s)}finally{o.abort(),Ab(e,a),n||Cl(t),i&&await t}},D3=({error:t})=>{if(t)throw t}});import M3 from"node:process";var F3,L3,z3,NI=y(()=>{Fb();C3();DI();Ib();F3=(t,{ipc:e})=>{Object.assign(t,z3(t,!1,e))},L3=()=>{let t=M3,e=!0,r=M3.channel!==void 0;return{...z3(t,e,r),getCancelSignal:_V.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},z3=(t,e,r)=>({sendMessage:Mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:P3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:j3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as W0e}from"node:child_process";import{PassThrough as K0e,Readable as J0e,Writable as Y0e,Duplex as X0e}from"node:stream";var U3,Q0e,pp,e$e,t$e,r$e,n$e,q3=y(()=>{iv();up();Qb();U3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bI(n);let a=new W0e;Q0e(a,n),Object.assign(a,{readable:e$e,writable:t$e,duplex:r$e});let c=Ll({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=n$e(c,s,i);return{subprocess:a,promise:l}},Q0e=(t,e)=>{let r=pp(),n=pp(),i=pp(),o=Array.from({length:e.length-3},pp),s=pp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},pp=()=>{let t=new K0e;return t.end(),t},e$e=()=>new J0e({read(){}}),t$e=()=>new Y0e({write(){}}),r$e=()=>new X0e({read(){},write(){}}),n$e=async(t,e,r)=>zl(t,e,r)});import{createReadStream as B3,createWriteStream as H3}from"node:fs";import{Buffer as i$e}from"node:buffer";import{Readable as mp,Writable as o$e,Duplex as s$e}from"node:stream";var Z3,hp,G3,a$e,V3=y(()=>{uv();iv();wr();Z3=(t,e)=>nv(a$e,t,e,!1),hp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},G3={fileNumber:hp,generator:AI,asyncGenerator:AI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:s$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},a$e={input:{...G3,fileUrl:({value:t})=>({stream:B3(t)}),filePath:({value:{file:t}})=>({stream:B3(t)}),webStream:({value:t})=>({stream:mp.fromWeb(t)}),iterable:({value:t})=>({stream:mp.from(t)}),asyncIterable:({value:t})=>({stream:mp.from(t)}),string:({value:t})=>({stream:mp.from(t)}),uint8Array:({value:t})=>({stream:mp.from(i$e.from(t))})},output:{...G3,fileUrl:({value:t})=>({stream:H3(t)}),filePath:({value:{file:t,append:e}})=>({stream:H3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:o$e.fromWeb(t)}),iterable:hp,asyncIterable:hp,string:hp,uint8Array:hp}}});import{on as c$e,once as W3}from"node:events";import{PassThrough as l$e,getDefaultHighWaterMark as u$e}from"node:stream";import{finished as Y3}from"node:stream/promises";function La(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)MI(i);let e=t.some(({readableObjectMode:i})=>i),r=d$e(t,e),n=new jI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var d$e,jI,f$e,p$e,m$e,MI,h$e,g$e,y$e,_$e,b$e,X3,Q3,FI,eK,v$e,pv,K3,J3,mv=y(()=>{d$e=(t,e)=>{if(t.length===0)return u$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},jI=class extends l$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(MI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=f$e(this,this.#t,this.#o);let r=h$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(MI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},f$e=async(t,e,r)=>{pv(t,K3);let n=new AbortController;try{await Promise.race([p$e(t,n),m$e(t,e,r,n)])}finally{n.abort(),pv(t,-K3)}},p$e=async(t,{signal:e})=>{try{await Y3(t,{signal:e,cleanup:!0})}catch(r){throw X3(t,r),r}},m$e=async(t,e,r,{signal:n})=>{for await(let[i]of c$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},MI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{pv(t,J3);let a=new AbortController;try{await Promise.race([g$e(o,e,a),y$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),_$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),pv(t,-J3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FI(t):b$e(t))},g$e=async(t,e,{signal:r})=>{try{await t,r.aborted||FI(e)}catch(n){r.aborted||X3(e,n)}},y$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Y3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Q3(s)?i.add(e):eK(t,s)}},_$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await W3(t,i,{signal:o}),!t.readable)return W3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},b$e=t=>{t.writable&&t.end()},X3=(t,e)=>{Q3(e)?FI(t):eK(t,e)},Q3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FI=t=>{(t.readable||t.writable)&&t.destroy()},eK=(t,e)=>{t.destroyed||(t.once("error",v$e),t.destroy(e))},v$e=()=>{},pv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},K3=2,J3=1});import{finished as tK}from"node:stream/promises";var ql,S$e,LI,w$e,zI,hv=y(()=>{vo();ql=(t,e)=>{t.pipe(e),S$e(t,e),w$e(t,e)},S$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LI(e)}},LI=t=>{t.writable&&t.end()},w$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}zI(t)}},zI=t=>{t.readable&&t.destroy()}});var rK,x$e,$$e,k$e,E$e,A$e,nK=y(()=>{mv();vo();kb();wr();hv();rK=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Pn.has(c)))x$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Pn.has(c)))k$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:La(o);ql(s,i)}},x$e=(t,e,r,n)=>{r==="output"?ql(t.stdio[n],e):ql(e,t.stdio[n]);let i=$$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},$$e=["stdin","stdout","stderr"],k$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;E$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},E$e=(t,{signal:e})=>{ti(t)&&Pa(t,A$e,e)},A$e=2});var za,iK=y(()=>{za=[];za.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&za.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&za.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var gv,UI,qI,T$e,BI,yv,O$e,HI,GI,ZI,oK,jat,Mat,sK=y(()=>{iK();gv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",UI=Symbol.for("signal-exit emitter"),qI=globalThis,T$e=Object.defineProperty.bind(Object),BI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(qI[UI])return qI[UI];T$e(qI,UI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},yv=class{},O$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HI=class extends yv{onExit(){return()=>{}}load(){}unload(){}},GI=class extends yv{#t=ZI.platform==="win32"?"SIGINT":"SIGHUP";#r=new BI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of za)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!gv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of za)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,za.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return gv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&gv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},ZI=globalThis.process,{onExit:oK,load:jat,unload:Mat}=O$e(gv(ZI)?new GI(ZI):new HI)});import{addAbortListener as R$e}from"node:events";var aK,cK=y(()=>{sK();aK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=oK(()=>{t.kill()});R$e(n,()=>{i()})}});var uK,I$e,P$e,lK,C$e,dK=y(()=>{gR();fb();ps();El();uK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=db(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=I$e(r,n,i),{sourceStream:d,sourceError:f}=C$e(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},I$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=P$e(t,e,...r),a=$b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},P$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(lK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||mR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=eb(r,...n);return{destination:e(lK)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},lK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),C$e=(t,e)=>{try{return{sourceStream:jl(t,e)}}catch(r){return{sourceError:r}}}});var pK,D$e,VI,fK,WI=y(()=>{up();hv();pK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=D$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},D$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return zI(t),n;if(e!==void 0)return LI(r),e},VI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ll({error:t,command:fK,escapedCommand:fK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),fK="source.pipe(destination)"});var mK,hK=y(()=>{mK=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as N$e}from"node:stream/promises";var gK,j$e,M$e,F$e,_v,L$e,z$e,yK=y(()=>{mv();kb();hv();gK=(t,e,r)=>{let n=_v.has(e)?M$e(t,e):j$e(t,e);return Pa(t,L$e,r.signal),Pa(e,z$e,r.signal),F$e(e),n},j$e=(t,e)=>{let r=La([t]);return ql(r,e),_v.set(e,r),r},M$e=(t,e)=>{let r=_v.get(e);return r.add(t),r},F$e=async t=>{try{await N$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_v.delete(t)},_v=new WeakMap,L$e=2,z$e=1});import{aborted as U$e}from"node:util";var _K,q$e,bK=y(()=>{WI();_K=(t,e)=>t===void 0?[]:[q$e(t,e)],q$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await U$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var bv,B$e,H$e,vK=y(()=>{_o();dK();WI();hK();yK();bK();bv=(t,...e)=>{if(Ot(e[0]))return bv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=uK(t,...e),i=B$e({...n,destination:r});return i.pipe=bv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},B$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=H$e(t,i);pK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=gK(e,o,d);return await Promise.race([mK(u),..._K(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},H$e=(t,e)=>Promise.allSettled([t,e])});import{on as G$e}from"node:events";import{getDefaultHighWaterMark as Z$e}from"node:stream";var vv,V$e,KI,W$e,wK,JI,SK,K$e,J$e,Sv=y(()=>{xI();sv();EI();vv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return V$e(e,s),wK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},V$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},KI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;W$e(e,s,t);let a=t.readableObjectMode&&!o;return wK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},W$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},wK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=G$e(t,"data",{signal:e.signal,highWaterMark:SK,highWatermark:SK});return K$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},JI=Z$e(!0),SK=JI,K$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=J$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Fa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*fp(a)}},J$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[av(t,r,!e),ov(t,i,!n,{})].filter(Boolean)});import{setImmediate as Y$e}from"node:timers/promises";var xK,X$e,Q$e,eke,YI,$K,XI=y(()=>{Jb();sn();TI();Sv();ja();dp();xK=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=X$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Q$e(t),d]);return}let f=vI(c,r),p=KI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([eke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},X$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!dv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=KI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await _3(a,t,r,o)},Q$e=async t=>{await Y$e(),t.readableFlowing===null&&t.resume()},eke=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Vb(r,{maxBuffer:o})):await Kb(r,{maxBuffer:o})}catch(a){return $K(rW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YI=async t=>{try{return await t}catch(e){return $K(e)}},$K=({bufferedData:t})=>WG(t)?new Uint8Array(t):t});import{finished as tke}from"node:stream/promises";var gp,rke,nke,ike,oke,ske,QI,wv,kK,xv=y(()=>{gp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=rke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],tke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||oke(a,e,r,n)}finally{s.abort()}},rke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&nke(t,r,n),n},nke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{ike(e,r),n.call(t,...i)}},ike=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},oke=(t,e,r,n)=>{if(!ske(t,e,r,n))throw t},ske=(t,e,r,n=!0)=>r.propagating?kK(t)||wv(t):(r.propagating=!0,QI(r,e)===n?kK(t):wv(t)),QI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",wv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",kK=t=>t?.code==="EPIPE"});var EK,eP,tP=y(()=>{XI();xv();EK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>eP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),eP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=gp(t,e,l);if(QI(l,e)){await u;return}let[d]=await Promise.all([xK({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var AK,TK,ake,cke,rP=y(()=>{mv();tP();AK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?La([t,e].filter(Boolean)):void 0,TK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>eP({...ake(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:cke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),ake=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},cke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var OK,RK,IK=y(()=>{Ol();ds();OK=t=>Tl(t,"ipc"),RK=(t,e)=>{let r=ub(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var PK,CK,DK=y(()=>{ja();IK();wo();DI();PK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=OK(o),a=So(e,"ipc"),c=So(r,"ipc");for await(let l of CI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(nW(t,i,c),i.push(l)),s&&RK(l,o);return i},CK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as lke}from"node:events";var NK,uke,dke,fke,jK=y(()=>{Na();KR();zR();WR();vo();wr();XI();DK();YR();rP();tP();II();xv();NK=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=k3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=EK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=TK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=PK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=uke(h,t,S),D=dke(m,S);try{return await Promise.race([Promise.all([{},A3(_),Promise.all(x),w,T,TV(t,d),...A,...D]),g,fke(t,b),...xV(t,o,f,b),...B9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...SV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>YI(re))),YI(w),CK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},uke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:gp(n,i,r)),dke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ii(o,{checkOpen:!1})&&!ti(o)).map(({type:i,value:o,stream:s=o})=>gp(s,n,e,{isSameDirection:Pn.has(i),stopOnExit:i==="native"}))),fke=async(t,{signal:e})=>{let[r]=await lke(t,"error",{signal:e});throw r}});var MK,yp,Bl,$v=y(()=>{Nl();MK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as FK}from"node:stream/promises";var nP,LK,iP,oP,kv,Ev,sP=y(()=>{xv();nP=async t=>{if(t!==void 0)try{await iP(t)}catch{}},LK=async t=>{if(t!==void 0)try{await oP(t)}catch{}},iP=async t=>{await FK(t,{cleanup:!0,readable:!1,writable:!0})},oP=async t=>{await FK(t,{cleanup:!0,readable:!0,writable:!1})},kv=async(t,e)=>{if(await t,e)throw e},Ev=(t,e,r)=>{r&&!wv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as pke}from"node:stream";import{callbackify as mke}from"node:util";var zK,aP,cP,lP,hke,uP,dP,UK,fP=y(()=>{Ca();ps();Sv();Nl();$v();sP();zK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||an.has(r),{subprocessStdout:a,waitReadableDestroy:c}=aP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=cP(a,s),{read:f,onStdoutDataDone:p}=lP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new pke({read:f,destroy:mke(dP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return uP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},aP=(t,e,r)=>{let n=jl(t,e),i=yp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},cP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:JI},lP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=vv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){hke(this,s,o)},onStdoutDataDone:o}},hke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},uP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await oP(t),await n,await nP(i),await e,r.readable&&r.push(null)}catch(o){await nP(i),UK(r,o)}},dP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(UK(t,n),await kv(e,n))},UK=(t,e)=>{Ev(t,t.readable,e)}});import{Writable as gke}from"node:stream";import{callbackify as qK}from"node:util";var BK,pP,mP,yke,_ke,hP,gP,HK,yP=y(()=>{ps();$v();sP();BK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=pP(t,r,e),s=new gke({...mP(n,t,i),destroy:qK(gP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return hP(n,s),s},pP=(t,e,r)=>{let n=$b(t,e),i=yp(r,n,"writableFinal"),o=yp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},mP=(t,e,r)=>({write:yke.bind(void 0,t),final:qK(_ke.bind(void 0,t,e,r))}),yke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},_ke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},hP=async(t,e,r)=>{try{await iP(t),e.writable&&e.end()}catch(n){await LK(r),HK(e,n)}},gP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(HK(t,i),await kv(e,i))},HK=(t,e)=>{Ev(t,t.writable,e)}});import{Duplex as bke}from"node:stream";import{callbackify as vke}from"node:util";var GK,Ske,ZK=y(()=>{Ca();fP();yP();GK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||an.has(r),{subprocessStdout:c,waitReadableDestroy:l}=aP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=pP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=cP(c,a),{read:g,onStdoutDataDone:b}=lP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new bke({read:g,...mP(u,t,d),destroy:vke(Ske.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return uP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),hP(u,_,c),_},Ske=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([dP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),gP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var _P,wke,VK=y(()=>{Ca();ps();Sv();_P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||an.has(e),s=jl(t,r),a=vv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return wke(a,s,t)},wke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var WK,KK=y(()=>{$v();fP();yP();ZK();VK();WK=(t,{encoding:e})=>{let r=MK();t.readable=zK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=BK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=GK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=_P.bind(void 0,t,e),t[Symbol.asyncIterator]=_P.bind(void 0,t,e,{})}});var JK,xke,$ke,YK=y(()=>{JK=(t,e)=>{for(let[r,n]of $ke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},xke=(async()=>{})().constructor.prototype,$ke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(xke,t)])});import{setMaxListeners as kke}from"node:events";import{spawn as Eke}from"node:child_process";var XK,Ake,Tke,Oke,Rke,Ike,QK=y(()=>{Jb();ER();eI();ps();tI();NI();up();Qb();q3();V3();dp();nK();vb();cK();vK();rP();jK();KK();Nl();YK();XK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Ake(t,e,r),{subprocess:f,promise:p}=Oke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=bv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),JK(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Ake=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),{file:a,commandArguments:c,options:l}=zb(t,e,r),u=Tke(l),d=Z3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Tke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Oke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Eke(...Ub(t,e,r))}catch(m){return U3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;kke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];rK(c,a,l),aK(c,r,l);let d={},f=Di();c.kill=U9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=AK(c,r),WK(c,r),F3(c,r);let p=Rke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Rke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await NK({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>$o(x,e,w)),_=$o(h,e,"all"),S=Ike({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return zl(S,n,e)},Ike=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?lp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Xb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Av,Pke,Cke,eJ=y(()=>{_o();wo();Av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Pke(n,t[n],i)]));return{...t,...r}},Pke=(t,e,r)=>Cke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Cke=new Set(["env",...SR])});var gs,Dke,Nke,tJ=y(()=>{_o();gR();rZ();I3();QK();eJ();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Dke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Dke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Nke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?R3(a,c,l):XK(a,c,l,i)},Nke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=eZ(e)?tZ(e,r):[e,...r],[s,a,c]=eb(...o),l=Av(Av(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var rJ,nJ,iJ,jke,Mke,oJ=y(()=>{rJ=({file:t,commandArguments:e})=>iJ(t,e),nJ=({file:t,commandArguments:e})=>({...iJ(t,e),isSync:!0}),iJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=jke(t);return{file:r,commandArguments:n}},jke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Mke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Mke=/ +/g});var sJ,aJ,Fke,cJ,Lke,lJ,uJ=y(()=>{sJ=(t,e,r)=>{t.sync=e(Fke,r),t.s=t.sync},aJ=({options:t})=>cJ(t),Fke=({options:t})=>({...cJ(t),isSync:!0}),cJ=t=>({options:{...Lke(t),...t}}),Lke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},lJ={preferLocal:!0}});var Eut,We,Aut,Tut,Out,Rut,Iut,Put,Cut,Dut,Lr=y(()=>{tJ();oJ();JR();uJ();NI();Eut=gs(()=>({})),We=gs(()=>({isSync:!0})),Aut=gs(rJ),Tut=gs(nJ),Out=gs(kV),Rut=gs(aJ,{},lJ,sJ),{sendMessage:Iut,getOneMessage:Put,getEachMessage:Cut,getCancelSignal:Dut}=L3()});import{existsSync as Tv,statSync as zke}from"node:fs";import{dirname as bP,extname as Uke,isAbsolute as dJ,join as vP,relative as SP,resolve as Ov,sep as qke}from"node:path";function Rv(t){return t==="./gradlew"||t==="gradle"}function Bke(t){return(Tv(vP(t,"build.gradle.kts"))||Tv(vP(t,"build.gradle")))&&Tv(vP(t,"gradle.properties"))}function Hke(t,e){let n=SP(t,e).split(qke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Gke(t,e){let r=Ov(t,e),n=r;Tv(r)?zke(r).isFile()&&(n=bP(r)):Uke(r)!==""&&(n=bP(r));let i=SP(t,n);if(i.startsWith("..")||dJ(i))return null;let o=n;for(;;){if(Bke(o))return o;if(Ov(o)===Ov(t))return null;let s=bP(o);if(s===o)return null;let a=SP(t,s);if(a.startsWith("..")||dJ(a))return null;o=s}}function Iv(t,e){let r=Ov(t),n=new Map,i=[];for(let o of e){let s=Gke(r,o);if(!s){i.push(o);continue}let a=Hke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Pv=y(()=>{"use strict"});import{existsSync as xP,readFileSync as Zke}from"node:fs";import{join as Hl}from"node:path";function Gl(t="."){let e=Hl(t,".cladding","config.yaml");if(!xP(e))return wP;try{let n=(0,fJ.parse)(Zke(e,"utf8"))?.gate;if(!n)return wP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Vke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return wP}}function pJ(t="."){let e=Gl(t).testReport,r=e?[e,...$P]:$P;return[...new Set(r.map(n=>Hl(t,n)))]}function mJ(t="."){let e=Gl(t).testReport;if(e){let r=Hl(t,e);return xP(r)?r:null}return $P.map(r=>Hl(t,r)).find(r=>xP(r))??null}function hJ(t,e){let r=[],n=!1;for(let i of t){let o=Wke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var fJ,Vke,wP,$P,Wke,_p=y(()=>{"use strict";fJ=St(er(),1);Pv();Vke=["type","lint","test","coverage"],wP={scope:"feature"},$P=["test-report.junit.xml",Hl("coverage","junit.xml"),Hl(".cladding","test-report.junit.xml")];Wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as EP,readFileSync as gJ,readdirSync as Kke,statSync as Jke}from"node:fs";import{join as Cv}from"node:path";function OP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Cv(t,e);if(EP(r))try{if(yJ.test(gJ(r,"utf8")))return!0}catch{}}return!1}function _J(t){try{return EP(t)&&yJ.test(gJ(t,"utf8"))}catch{return!1}}function bJ(t,e=0){if(e>4||!EP(t))return!1;let r;try{r=Kke(t)}catch{return!1}for(let n of r){let i=Cv(t,n),o=!1;try{o=Jke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(bJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&_J(i))return!0}return!1}function Qke(t){if(OP(t))return!0;for(let e of Yke)if(_J(Cv(t,e)))return!0;for(let e of Xke)if(bJ(Cv(t,e)))return!0;return!1}function vJ(t="."){let e=Gl(t).coverage;return e||(Qke(t)?"kover":"jacoco")}function SJ(t="."){return AP[vJ(t)]}function wJ(t="."){return kP[vJ(t)]}var AP,kP,TP,yJ,Yke,Xke,Dv=y(()=>{"use strict";_p();AP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},TP=[kP.kover,kP.jacoco],yJ=/kover/i;Yke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Xke=["buildSrc","build-logic"]});import{existsSync as vp,readFileSync as IP,readdirSync as $J,statSync as eEe}from"node:fs";import{dirname as tEe,join as xr,resolve as rEe}from"node:path";import Zl from"node:process";function PP(t){return vp(xr(t,"gradlew"))?"./gradlew":"gradle"}function nEe(t){let e=PP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[SJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function iEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(IP(xr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function sEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function lEe(t,e){for(let r of e)if(vp(xr(t,r)))return r}function uEe(t,e){try{return $J(t).find(n=>n.endsWith(e))}catch{return}}function mEe(t){let e=[],r=Zl.platform==="win32";r||e.push(xr("/etc","madge","config"),xr("/etc","madgerc"));let n=r?Zl.env.USERPROFILE:Zl.env.HOME;n&&e.push(xr(n,".config","madge","config"),xr(n,".config","madge"),xr(n,".madge","config"),xr(n,".madgerc"));for(let o=rEe(t);;){e.push(xr(o,".madgerc"));let s=tEe(o);if(s===o)break;o=s}let i=Zl.env.MADGE_config??Zl.env.madge_config;return i&&e.push(i),e}function hEe(){for(let[t,e]of Object.entries(Zl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function kJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function yEe(t){try{return eEe(t).isFile()}catch{return!1}}function _Ee(t){let e;try{e=IP(t,"utf8")}catch{return!0}try{return kJ(JSON.parse(e).excludeRegExp)}catch{return gEe.test(e)}}function bEe(t,e){let r=e.madge;return r&&typeof r=="object"&&kJ(r.excludeRegExp)||hEe()?!0:mEe(t).some(n=>yEe(n)&&_Ee(n))}function vEe(t){try{return JSON.parse(IP(xr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function bp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function xJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function SEe(t,e,r){if(bEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",pEe),{...e,args:n}}function wEe(t,e,r){if(bp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of dEe)if(n.configs.some(i=>vp(xr(t,i))))return n.gate;if(fEe.some(n=>vp(xr(t,n)))||r.eslintConfig!==void 0)return e}function $Ee(t,e){return xEe.some(r=>vp(xr(t,r)))?!0:e.jest!==void 0}function kEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function RP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function EEe(t,e){let r=vEe(t),n=e.lint?wEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:SEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:RP(i,"lint"),s=bp(r,"test"),a=s?kEe(s):void 0;return s&&!a?(o=RP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...bp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&$Ee(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!bp(r,"coverage")&&!xJ(r,"@vitest/coverage-v8")&&!xJ(r,"@vitest/coverage-istanbul")?o=RP(o,"coverage"):a==="vitest"&&bp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of aEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=uEe(t,o):r=lEe(t,[o]),r)break;if(!r||e.requiresSource&&!sEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?EEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return cEe}var Fi,oEe,aEe,cEe,dEe,fEe,pEe,gEe,xEe,cn=y(()=>{"use strict";Dv();Fi=["--offline","--no-install"];oEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);aEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:nEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:iEe}],cEe={language:"unknown",manifest:"",gates:{}};dEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],fEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],pEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";gEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;xEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as AEe,readFileSync as TEe}from"node:fs";import{join as OEe}from"node:path";function Ua(t){return t.code==="ENOENT"}function Nv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return EJ.test(o)||EJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ua(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Vl(t,e){let r=OEe(t,"package.json");if(!AEe(r))return!1;try{return!!JSON.parse(TEe(r,"utf8")).scripts?.[e]}catch{return!1}}var EJ,Cn=y(()=>{"use strict";EJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function REe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:jv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:jv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Nv(i,jv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var jv,qa,Mv=y(()=>{"use strict";Lr();cn();Cn();jv="ARCHITECTURE_VIOLATION";qa={name:jv,subprocess:!0,run:REe}});function IEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Fv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:Fv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Nv(i,Fv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Fv,Ba,Lv=y(()=>{"use strict";Lr();cn();Cn();Fv="HARDCODED_SECRET";Ba={name:Fv,subprocess:!0,run:IEe}});import{existsSync as CP,readdirSync as AJ}from"node:fs";import{join as zv}from"node:path";function CEe(t,e){let r=zv(t,e.path);if(!CP(r))return!0;if(e.isDirectory)try{return AJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function DEe(t){let{cwd:e="."}=t,r=[];for(let i of PEe)CEe(e,i)&&r.push({detector:Sp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=zv(e,"spec.yaml");if(CP(n)){let i=MEe(n),o=i?null:NEe(e);if(i)r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Sp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=jEe(e);s&&r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function NEe(t){for(let e of["spec/features","spec/scenarios"]){let r=zv(t,e);if(!CP(r))continue;let n;try{n=AJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(zv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jEe(t){try{return q(t),null}catch(e){return e.message}}function MEe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Sp,PEe,TJ,OJ=y(()=>{"use strict";Ue();H_();Sp="ABSENCE_OF_GOVERNANCE",PEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];TJ={name:Sp,run:DEe}});function Uv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Uv(r)==="while",o=LEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Uv(r)}'`}let n=FEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Uv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Uv(r)}'`:null}function zEe(t,e){let r=DP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function RJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zEe(r,n));return e}var FEe,LEe,NP=y(()=>{"use strict";FEe={event:"when",state:"while",optional:"where",unwanted:"if"},LEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function UEe(t){let{cwd:e="."}=t;return ge(e,qv,qEe)}function qEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:qv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of RJ(t.features))e.push({detector:qv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var qv,IJ,PJ=y(()=>{"use strict";NP();wt();qv="AC_DRIFT";IJ={name:qv,run:UEe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return DJ[n]??CJ}var BEe,HEe,GEe,CJ,ZEe,VEe,DJ,WEe,NJ,Ha=y(()=>{"use strict";cn();BEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,HEe=/^[ \t]*import\s+([\w.]+)/gm,GEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,CJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:BEe,importStyle:"relative"},ZEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:HEe,importStyle:"dotted"},VEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:GEe,importStyle:"dotted"},DJ={typescript:CJ,kotlin:ZEe,python:VEe},WEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],NJ=new Set([...Object.values(DJ).flatMap(t=>t?.extensions??[]),...WEe].map(t=>t.toLowerCase()))});import{existsSync as KEe,readFileSync as JEe,readdirSync as YEe,statSync as XEe}from"node:fs";import{join as MJ,relative as jJ}from"node:path";function QEe(t,e){if(!KEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=YEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=MJ(i,s),c;try{c=XEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rAe(t){return tAe.test(t)}function nAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>QEe(MJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=JEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ha();FJ="AI_HINTS_FORBIDDEN_PATTERN";tAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;LJ={name:FJ,run:nAe}});function iAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:UJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var UJ,qJ,BJ=y(()=>{"use strict";Ue();UJ="AC_DUPLICATE_WITHIN_FEATURE";qJ={name:UJ,run:iAe}});import{createRequire as oAe}from"module";import{basename as sAe,dirname as MP,normalize as aAe,relative as cAe,resolve as lAe,sep as ZJ}from"path";import*as uAe from"fs";function dAe(t){let e=aAe(t);return e.length>1&&e[e.length-1]===ZJ&&(e=e.substring(0,e.length-1)),e}function VJ(t,e){return t.replace(fAe,e)}function mAe(t){return t==="/"||pAe.test(t)}function jP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lAe(t)),(n||o)&&(t=dAe(t)),t===".")return"";let s=t[t.length-1]!==i;return VJ(s?t+i:t,i)}function WJ(t,e){return e+t}function hAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:VJ(cAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gAe(t){return t}function yAe(t,e,r){return e+t+r}function _Ae(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hAe(t,e):n?WJ:gAe}function bAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ae(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vAe(t):bAe(t):n&&n.length?wAe:SAe:xAe}function RAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OAe:r&&r.length?n?kAe:EAe:n?AAe:TAe}function CAe(t){return t.group?PAe:IAe}function jAe(t){return t.group?DAe:NAe}function LAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FAe:MAe}function KJ(t,e,r){if(r.options.useRealPaths)return zAe(e,r);let n=MP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=MP(n)}return r.symlinks.set(t,e),i>1}function zAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Bv(t,e,r,n){e(t&&!n?t:null,r)}function KAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UAe:GAe:n?e?qAe:WAe:i?e?HAe:VAe:e?BAe:ZAe}function XAe(t){return t?YAe:JAe}function rTe(t,e){return new Promise((r,n)=>{XJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function XJ(t,e,r){new YJ(t,e,r).start()}function nTe(t,e){return new YJ(t,e).start()}var HJ,fAe,pAe,SAe,wAe,xAe,kAe,EAe,AAe,TAe,OAe,IAe,PAe,DAe,NAe,MAe,FAe,UAe,qAe,BAe,HAe,GAe,ZAe,VAe,WAe,JJ,JAe,YAe,QAe,eTe,tTe,YJ,GJ,QJ,e8,t8=y(()=>{HJ=oAe(import.meta.url);fAe=/[\\/]/g;pAe=/^[a-z]:[\\/]$/i;SAe=(t,e)=>{e.push(t||".")},wAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xAe=()=>{};kAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AAe=(t,e,r,n)=>{r.files++},TAe=(t,e)=>{e.push(t)},OAe=()=>{};IAe=t=>t,PAe=()=>[""].slice(0,0);DAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NAe=()=>{};MAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&KJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&KJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UAe=t=>t.counts,qAe=t=>t.groups,BAe=t=>t.paths,HAe=t=>t.paths.slice(0,t.options.maxFiles),GAe=(t,e,r)=>(Bv(e,r,t.counts,t.options.suppressErrors),null),ZAe=(t,e,r)=>(Bv(e,r,t.paths,t.options.suppressErrors),null),VAe=(t,e,r)=>(Bv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WAe=(t,e,r)=>(Bv(e,r,t.groups,t.options.suppressErrors),null);JJ={withFileTypes:!0},JAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",JJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",JJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},eTe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},tTe=class{aborted=!1;abort(){this.aborted=!0}},YJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KAe(e,this.isSynchronous),this.root=jP(t,e),this.state={root:mAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eTe,options:e,queue:new QAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tTe,fs:e.fs||uAe},this.joinPath=_Ae(this.root,e),this.pushDirectory=$Ae(this.root,e),this.pushFile=RAe(e),this.getArray=CAe(e),this.groupFiles=jAe(e),this.resolveSymlink=LAe(e,this.isSynchronous),this.walkDirectory=XAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=jP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=sAe(_),x=jP(MP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};GJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rTe(this.root,this.options)}withCallback(t){XJ(this.root,this.options,t)}sync(){return nTe(this.root,this.options)}},QJ=null;try{HJ.resolve("picomatch"),QJ=HJ("picomatch")}catch{}e8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:ZJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new GJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new GJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||QJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var wp=v((Fdt,s8)=>{"use strict";var r8="[^\\\\/]",iTe="(?=.)",n8="[^/]",FP="(?:\\/|$)",i8="(?:^|\\/)",LP=`\\.{1,2}${FP}`,oTe="(?!\\.)",sTe=`(?!${i8}${LP})`,aTe=`(?!\\.{0,1}${FP})`,cTe=`(?!${LP})`,lTe="[^.\\/]",uTe=`${n8}*?`,dTe="/",o8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iTe,QMARK:n8,END_ANCHOR:FP,DOTS_SLASH:LP,NO_DOT:oTe,NO_DOTS:sTe,NO_DOT_SLASH:aTe,NO_DOTS_SLASH:cTe,QMARK_NO_DOT:lTe,STAR:uTe,START_ANCHOR:i8,SEP:dTe},fTe={...o8,SLASH_LITERAL:"[\\\\/]",QMARK:r8,STAR:`${r8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},pTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};s8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?fTe:o8}}});var xp=v(zr=>{"use strict";var{REGEX_BACKSLASH:mTe,REGEX_REMOVE_BACKSLASH:hTe,REGEX_SPECIAL_CHARS:gTe,REGEX_SPECIAL_CHARS_GLOBAL:yTe}=wp();zr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);zr.hasRegexChars=t=>gTe.test(t);zr.isRegexChar=t=>t.length===1&&zr.hasRegexChars(t);zr.escapeRegex=t=>t.replace(yTe,"\\$1");zr.toPosixSlashes=t=>t.replace(mTe,"/");zr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};zr.removeBackslashes=t=>t.replace(hTe,e=>e==="\\"?"":e);zr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?zr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};zr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};zr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};zr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var m8=v((zdt,p8)=>{"use strict";var a8=xp(),{CHAR_ASTERISK:zP,CHAR_AT:_Te,CHAR_BACKWARD_SLASH:$p,CHAR_COMMA:bTe,CHAR_DOT:UP,CHAR_EXCLAMATION_MARK:qP,CHAR_FORWARD_SLASH:f8,CHAR_LEFT_CURLY_BRACE:BP,CHAR_LEFT_PARENTHESES:HP,CHAR_LEFT_SQUARE_BRACKET:vTe,CHAR_PLUS:STe,CHAR_QUESTION_MARK:c8,CHAR_RIGHT_CURLY_BRACE:wTe,CHAR_RIGHT_PARENTHESES:l8,CHAR_RIGHT_SQUARE_BRACKET:xTe}=wp(),u8=t=>t===f8||t===$p,d8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Te=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&u8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=a8.removeBackslashes(P)),xe&&_===!0&&(xe=a8.removeBackslashes(xe)));let Cr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Cr.maxDepth=0,u8(A)||s.push(D),Cr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var kp=wp(),ln=xp(),{MAX_LENGTH:Hv,POSIX_REGEX_SOURCE:kTe,REGEX_NON_SPECIAL_CHARS:ETe,REGEX_SPECIAL_CHARS_BACKREF:ATe,REPLACEMENTS:h8}=kp,TTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>ln.escapeRegex(i)).join("..")}return r},Wl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,g8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},OTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},y8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OTe(e))return e.replace(/\\(.)/g,"$1")},RTe=t=>{let e=t.map(y8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},ITe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=y8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?ln.escapeRegex(r[0]):`[${r.map(i=>ln.escapeRegex(i)).join("")}]`}*`},PTe=t=>{let e=0,r=t.trim(),n=GP(r);for(;n;)e++,r=n.body.trim(),n=GP(r);return e},CTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kp.DEFAULT_MAX_EXTGLOB_RECURSION,n=g8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RTe(n)))return{risky:!0};for(let i of n){let o=ITe(i);if(o)return{risky:!0,safeOutput:o};if(PTe(i)>r)return{risky:!0}}return{risky:!1}},ZP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=h8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=kp.globChars(r.windows),l=kp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ln.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Cr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},uo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},ki=H=>{$[H]++,xe.push(H)},en=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},fo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;ki("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Jde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=CTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[H.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=lt||ln.escapeRegex(ht);for(let Ai=H.tokensIndex+1;Ai1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Cr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=ZP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${Ei})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),en("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(ATe,(B,Oe,ut,zt,lt,Ei)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):Ei===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=ln.wrapOutput(ht,$,e),$)}for(;!Cr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=kTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=ln.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){ki("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Wl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Jde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),en("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));P=`\\${P}`}else ki("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Wl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}en("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||ln.hasRegexChars(B))continue;let Oe=ln.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=TTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),en("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){fo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){uo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=ETe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){fo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!Ei){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ai=t[$.index+4];if(Ai&&Ai!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Cr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Cr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ai=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ai})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));$.output=ln.escapeLast($.output,"["),en("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing",")"));$.output=ln.escapeLast($.output,"("),en("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","}"));$.output=ln.escapeLast($.output,"{"),en("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};ZP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=h8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=kp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=ln.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};_8.exports=ZP});var w8=v((qdt,S8)=>{"use strict";var DTe=m8(),VP=b8(),v8=xp(),NTe=wp(),jTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jTe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?v8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(v8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):VP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>DTe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=VP.fastpaths(t,e)),i.output||(i=VP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=NTe;S8.exports=Rt});var E8=v((Bdt,k8)=>{"use strict";var x8=w8(),MTe=xp();function $8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MTe.isWindows()}),x8(t,e,r)}Object.assign($8,x8);k8.exports=$8});import{readdir as FTe,readdirSync as LTe,realpath as zTe,realpathSync as UTe,stat as qTe,statSync as BTe}from"fs";import{isAbsolute as HTe,posix as Ga,resolve as GTe}from"path";import{fileURLToPath as ZTe}from"url";function KTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&WTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ga.relative(t,n)||".":n=>Ga.relative(t,`${e}/${n}`)||"."}function XTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ga.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function R8(t){var e;let r=Kl.default.scan(t,QTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Kl.default.scan(t);return r.isGlob||r.negated}function Ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function I8(t){return typeof t=="string"?[t]:t??[]}function WP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=iOe(o);s=HTe(s.replace(aOe,""))?Ga.relative(a,s):Ga.normalize(s);let c=(i=sOe.exec(s))===null||i===void 0?void 0:i[0],l=R8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ga.join(o,...d):o}return s}function cOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cOe(t,e,n);t.debug&&Ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(T8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Kl.default)(i.match,f),m=(0,Kl.default)(i.ignore,f),h=KTe(i.match,f),g=A8(r,d,o),b=o?g:A8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new e8({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&Ep(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return Ep(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XTe(r,d)]}function uOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fOe(t){let e={...dOe,...t};return e.cwd=(e.cwd instanceof URL?ZTe(e.cwd):GTe(e.cwd)).replace(T8,"/"),e.ignore=I8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FTe,readdirSync:e.fs.readdirSync||LTe,realpath:e.fs.realpath||zTe,realpathSync:e.fs.realpathSync||UTe,stat:e.fs.stat||qTe,statSync:e.fs.statSync||BTe}),e.debug&&Ep("globbing with options:",e),e}function pOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VTe(t)||typeof t=="string",i=I8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fOe(n?e:t);return i.length>0?lOe(o,i):[]}function _s(t,e){let[r,n]=pOe(t,e);return r?uOe(r.sync(),n):[]}var Kl,VTe,T8,O8,WTe,JTe,YTe,QTe,eOe,tOe,rOe,nOe,iOe,sOe,aOe,dOe,Ap=y(()=>{t8();Kl=St(E8(),1),VTe=Array.isArray,T8=/\\/g,O8=process.platform==="win32",WTe=/^(\/?\.\.)+$/;JTe=/^[A-Z]:\/$/i,YTe=O8?t=>JTe.test(t):t=>t==="/";QTe={parts:!0};eOe=/(?t.replace(eOe,"\\$&"),nOe=t=>t.replace(tOe,"\\$&"),iOe=O8?nOe:rOe;sOe=/^(\/?\.\.)+/,aOe=/\\(?=[()[\]{}!*+?@|])/g;dOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Tp,readFileSync as mOe,readdirSync as hOe,statSync as P8}from"node:fs";import{join as Za}from"node:path";function gOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=KP(r);return(s.size>0||a.length>0)&&!Tp(Za(e,i.mainRoot))?[{detector:Op,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(yOe(e,i,s,o),_Oe(e,i,s,o)),a.length>0&&bOe(e,i,a,o),o)}function KP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function yOe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of hOe(o)){let a=Za(o,s);P8(a).isDirectory()&&(r.has(s)||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Oe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of r){let a=Za(o,s);Tp(a)&&P8(a).isDirectory()||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function bOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Za(t,i,s.from);if(!Tp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Za(a,l),d;try{d=mOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vOe(p,s.to,e.importStyle)&&n.push({detector:Op,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function vOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Op,C8,JP=y(()=>{"use strict";Ap();Ue();Ha();Op="ARCHITECTURE_FROM_SPEC";C8={name:Op,run:gOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function kOe(t){let{cwd:e="."}=t,r=xOe(e,"spec/capabilities.yaml");if(!SOe(r))return[];let n;try{let u=wOe(r,"utf8"),d=D8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size<$Oe;for(let u of i){if(typeof u!="object"||u===null)continue;let d=String(u.id??"(unnamed)"),f=Array.isArray(u.features)?u.features:[];if(f.length===0){a.push({detector:Gv,severity:l?"info":"warn",path:"spec/capabilities.yaml",message:l?`capability "${d}" has no features mapped yet \u2014 retained as future onboarding intent; bind it when a matching feature lands`:`capability "${d}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let p of f){let m=String(p);o.has(m)?c.add(m):a.push({detector:Gv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${d}" references feature ${m} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let u of o)c.has(u)||a.push({detector:Gv,severity:"info",path:"spec.yaml",message:`feature ${u} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return a}var D8,Gv,$Oe,N8,j8=y(()=>{"use strict";D8=St(er(),1);Ue();Gv="CAPABILITIES_FEATURE_MAPPING",$Oe=8;N8={name:Gv,run:kOe}});import{existsSync as EOe,readFileSync as AOe}from"node:fs";import{join as TOe}from"node:path";function OOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function ROe(t){let{cwd:e="."}=t;return ge(e,YP,r=>IOe(r,e))}function IOe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=TOe(e,o);if(!EOe(s))continue;let a=AOe(s,"utf8");OOe(a)||n.push({detector:YP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YP,M8,F8=y(()=>{"use strict";Ha();wt();YP="CONVENTION_DRIFT";M8={name:YP,run:ROe}});import{existsSync as XP,readFileSync as L8}from"node:fs";import{join as Zv}from"node:path";function POe(t){return JSON.parse(t).total?.lines?.pct??0}function z8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function NOe(t,e){if(!Rv(dt(t).gates.coverage?.cmd))return null;let r;try{r=Iv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=TP.find(d=>XP(Zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=z8(L8(Zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=U8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function jOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=NOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=dt(e).language==="kotlin"?TP.find(a=>XP(Zv(e,a)))??wJ(e):n.coverageSummary,o=Zv(e,i);if(!XP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=L8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?COe(a):n.coverageFormat==="cobertura-xml"?DOe(a):POe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Vv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Vv}%`}]}var ko,Vv,q8,B8=y(()=>{"use strict";Ue();Dv();Ha();Pv();cn();ko="COVERAGE_DROP",Vv=70;q8={name:ko,run:jOe}});import{existsSync as MOe}from"node:fs";import{join as FOe}from"node:path";function zOe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>UOe(r,e))}function UOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Wv="DELIVERABLE_INTEGRITY",LOe=8;H8={name:Wv,run:zOe}});function qOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Kv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function BOe(t){let e=qOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Kv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function HOe(t){let{cwd:e="."}=t;return ge(e,Kv,r=>BOe(r))}var Kv,Z8,V8=y(()=>{"use strict";wt();Kv="SMOKE_PROBE_DEMAND";Z8={name:Kv,run:HOe}});function GOe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>ZOe(r,e))}function ZOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Jv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=J_(n,e,o);s.state!=="fresh"&&i.push({detector:Jv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Jv,Yv,QP=y(()=>{"use strict";xl();wt();Jv="STALE_ATTESTATION";Yv={name:Jv,run:GOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return WOe(r)}function WOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:W8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var W8,Xv,eC=y(()=>{"use strict";Ue();W8="DEPENDENCY_CYCLE";Xv={name:W8,run:VOe}});import{appendFileSync as KOe,existsSync as K8,mkdirSync as JOe,readFileSync as YOe}from"node:fs";import{dirname as XOe,join as QOe}from"node:path";function J8(t){return QOe(t,eRe,tRe)}function Y8(t){return tC.add(t),()=>tC.delete(t)}function Va(t,e){let r=J8(t),n=XOe(r);K8(n)||JOe(n,{recursive:!0}),KOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of tC)try{i(t,e)}catch{}}function fr(t){let e=J8(t);if(!K8(e))return[];let r=YOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var eRe,tRe,tC,un=y(()=>{"use strict";eRe=".cladding",tRe="audit.log.jsonl";tC=new Set});import{existsSync as rRe}from"node:fs";import{join as nRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:rC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(rRe(nRe(e,i.artifact))||n.push({detector:rC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var rC,X8,Q8=y(()=>{"use strict";un();rC="EVIDENCE_MISMATCH";X8={name:rC,run:iRe}});import{existsSync as oRe,readFileSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let e=aRe(t,n5);if(!oRe(e))return null;try{let n=((0,r5.parse)(sRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*t5(t,e){for(let r of t??[])r.startsWith(e5)&&(yield{ref:r,name:r.slice(e5.length),field:e})}function lRe(t){let{cwd:e="."}=t,r=cRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:nC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...t5(s.evidence_refs,"evidence_refs"),...t5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:nC,severity:"warn",path:n5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var r5,nC,e5,n5,i5,o5=y(()=>{"use strict";r5=St(er(),1);Ue();nC="FIXTURE_REFERENCE_INVALID",e5="fixture:",n5="conformance/fixtures.yaml";i5={name:nC,run:lRe}});import{existsSync as Jl,readFileSync as iC}from"node:fs";import{join as Wa}from"node:path";function uRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Rp(t){if(!Jl(t))return null;try{return JSON.parse(iC(t,"utf8"))}catch{return null}}function dRe(t,e){let r=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=uRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function fRe(t,e){for(let r of s5){let n=Wa(t,r.path);if(!Jl(n))continue;let i=Rp(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function pRe(t,e){let r=Rp(Wa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of s5){let s=Wa(t,o.path);if(!Jl(s))continue;let a=Rp(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Wa(t,".claude-plugin","marketplace.json");if(Jl(i)){let o=Rp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function mRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function hRe(t,e){let r=Wa(t,"src","cli","clad.ts"),n=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Jl(r)||!Jl(n))return;let i=mRe(iC(r,"utf8"));if(i.length===0)return;let s=Rp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function gRe(t){let{cwd:e="."}=t,r=[];return dRe(e,r),hRe(e,r),fRe(e,r),pRe(e,r),r}var Eo,s5,a5,c5=y(()=>{"use strict";Ap();Eo="HARNESS_INTEGRITY",s5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];a5={name:Eo,run:gRe}});import{existsSync as yRe,readFileSync as _Re}from"node:fs";import{join as bRe}from"node:path";function SRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>xRe(r,e))}function wRe(t){let e=bRe(t,"spec/capabilities.yaml");if(!yRe(e))return!1;try{let r=l5.default.parse(_Re(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function xRe(t,e){let r=t.features.length;if(r{"use strict";l5=St(er(),1);wt();Qv="HOLLOW_GOVERNANCE",vRe=8;u5={name:Qv,run:SRe}});import{existsSync as f5,readFileSync as p5}from"node:fs";import{join as m5}from"node:path";function h5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function ERe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function ARe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function TRe(t){let e=m5(t,"README.md"),r=m5(t,"docs","dogfood","matrix.md");if(!f5(e)||!f5(r))return[];let n=h5(p5(e,"utf8"),$Re),i=h5(p5(r,"utf8"),kRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=ARe(a);if(c===null)continue;let l=i[s]??"not-run",u=ERe(l);u!==null&&c>u&&o.push({detector:g5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ORe(t){let{cwd:e="."}=t;return TRe(e)}var g5,$Re,kRe,y5,_5=y(()=>{"use strict";g5="HOST_CLAIM_DRIFT",$Re=//,kRe=//;y5={name:g5,run:ORe}});function RRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return b5(r.features.map(i=>i.id),"feature","spec/features/",n),b5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function b5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:v5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var v5,S5,w5=y(()=>{"use strict";Ue();v5="ID_COLLISION";S5={name:v5,run:RRe}});import{existsSync as Ip,readFileSync as oC,readdirSync as sC,statSync as IRe,writeFileSync as $5}from"node:fs";import{join as Ao}from"node:path";function x5(t){if(!Ip(t))return 0;try{return sC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function PRe(t){if(!Ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=IRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function CRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Ip(e))return 0;try{let r=eS.default.parse(oC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=x5(Ao(t,"spec","features")),r=x5(Ao(t,"spec","scenarios")),n=CRe(t),i=PRe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Yl(t,e){let r=Ao(t,"spec.yaml");if(!Ip(r))return;let n=oC(r,"utf8"),i=DRe(n,e);i!==n&&$5(r,i)}function DRe(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`],s=d=>r===`\r @@ -273,49 +273,49 @@ ${o.join(` `))}function Ka(t="."){let e=Ao(t,"spec","features");if(!Ip(e))return!1;let r=[];for(let i of sC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,eS.parse)(oC(Ao(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return x5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var eS,Pp=y(()=>{"use strict";eS=St(er(),1)});import{existsSync as $5,readFileSync as k5,readdirSync as RRe}from"node:fs";import{join as aC}from"node:path";function IRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=E5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cC(e),{detector:Cp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of E5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Cp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...cC(e)),o}function cC(t){let e=aC(t,"spec","index.yaml"),r=aC(t,"spec","features");if(!$5(e)||!$5(r))return[];let n=new Map;try{for(let l of k5(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of RRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=k5(aC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Cp,E5,A5,T5=y(()=>{"use strict";Pp();Ue();Cp="INVENTORY_DRIFT",E5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];A5={name:Cp,run:IRe}});import{existsSync as PRe,readFileSync as CRe}from"node:fs";import{join as DRe}from"node:path";function jRe(t){let{cwd:e="."}=t,r=DRe(e,"src","spec","schema.json"),n=[];if(PRe(r)){let i;try{i=JSON.parse(CRe(r,"utf8"))}catch(o){n.push({detector:Dp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of NRe)i.required?.includes(o)||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==O5&&n.push({detector:Dp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${O5}'`})}catch{}return n}var Dp,NRe,O5,R5,I5=y(()=>{"use strict";Ue();Dp="META_INTEGRITY",NRe=["schema","project","features"],O5="0.1";R5={name:Dp,run:jRe}});function MRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return P5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),P5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function P5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:C5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var C5,D5,N5=y(()=>{"use strict";Ue();C5="SLUG_CONFLICT";D5={name:C5,run:MRe}});function Xl(t){return t==="planned"||t==="in_progress"}var tS=y(()=>{"use strict"});import{existsSync as FRe}from"node:fs";import{join as LRe}from"node:path";function zRe(t){let{cwd:e="."}=t;return ge(e,rS,r=>URe(r,e))}function URe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=LRe(e,i);FRe(o)||r.push(qRe(n.id,i,n.status))}return r}function qRe(t,e,r){return Xl(r)?{detector:rS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:rS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var rS,nS,lC=y(()=>{"use strict";tS();wt();rS="MISSING_IMPLEMENTATION";nS={name:rS,run:zRe}});function BRe(t){let{cwd:e="."}=t;return ge(e,uC,HRe)}function HRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:uC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var uC,iS,dC=y(()=>{"use strict";wt();uC="MISSING_TESTS";iS={name:uC,run:BRe}});import{existsSync as GRe,readFileSync as ZRe}from"node:fs";import{join as j5}from"node:path";function M5(t){if(GRe(t))try{return JSON.parse(ZRe(t,"utf8"))}catch{return}}function JRe(t){let{cwd:e="."}=t,r=M5(j5(e,VRe)),n=M5(j5(e,WRe));if(!r||!n)return[{detector:fC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>KRe&&i.push({detector:fC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var fC,VRe,WRe,KRe,F5,L5=y(()=>{"use strict";fC="PERFORMANCE_DRIFT",VRe="perf/baseline.json",WRe="perf/current.json",KRe=10;F5={name:fC,run:JRe}});import{existsSync as YRe}from"node:fs";import{join as XRe}from"node:path";function eIe(t){let{cwd:e="."}=t;return ge(e,pC,r=>rIe(r,e))}function tIe(t,e){return(t.modules??[]).some(r=>YRe(XRe(e,r)))}function rIe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||tIe(s,e)||r.push(s.id);let n=QRe;if(r.length<=n)return[];let i=r.slice(0,z5).join(", "),o=r.length>z5?", \u2026":"";return[{detector:pC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var pC,QRe,z5,U5,q5=y(()=>{"use strict";wt();pC="PLANNED_BACKLOG",QRe=5,z5=8;U5={name:pC,run:eIe}});import{existsSync as nIe,readFileSync as iIe}from"node:fs";import{join as oIe}from"node:path";function cIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>lIe(r,e))}function lIe(t,e){if(t.features.lengthn.includes(i))?[{detector:mC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var mC,sIe,aIe,B5,H5=y(()=>{"use strict";wt();mC="PROJECT_CONTEXT_DRIFT",sIe=8,aIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];B5={name:mC,run:cIe}});function G5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:oS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function uIe(t){let{cwd:e="."}=t;return ge(e,oS,dIe)}function dIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...G5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:oS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...G5(e,n.features,`scenario ${n.id}.features`));return r}var oS,sS,hC=y(()=>{"use strict";wt();oS="REFERENCE_INTEGRITY";sS={name:oS,run:uIe}});function Np(t=""){return new RegExp(fIe,t)}var fIe,gC=y(()=>{"use strict";fIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as pIe,readdirSync as mIe,readFileSync as hIe,statSync as gIe,writeFileSync as yIe}from"node:fs";import{dirname as _Ie,join as jp,normalize as bIe,relative as vIe}from"node:path";function kIe(t){let e=[];for(let r of t.matchAll($Ie))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Np("g"))??[])e.push(n);return[...new Set(e)].sort()}function EIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function Z5(t){return t.split("\\").join("/")}function AIe(t){return SIe.some(e=>t===e||t.startsWith(`${e}/`))}function TIe(t){let e=jp(t,"docs");if(!pIe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=mIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=jp(i,s),c;try{c=gIe(a)}catch{continue}let l=Z5(vIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function OIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=bIe(jp(_Ie(t),e));return Z5(r)}function Mp(t="."){let e=[];for(let r of TIe(t)){let n;try{n=hIe(jp(t,r),"utf8")}catch{continue}let i=EIe(n),o=kIe(i);if(AIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(wIe)?[]:i.match(Np("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(xIe)){let d=OIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function V5(t="."){let e=Mp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return yIe(jp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return $5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var eS,Pp=y(()=>{"use strict";eS=St(er(),1)});import{existsSync as k5,readFileSync as E5,readdirSync as NRe}from"node:fs";import{join as aC}from"node:path";function jRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=A5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cC(e),{detector:Cp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of A5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Cp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...cC(e)),o}function cC(t){let e=aC(t,"spec","index.yaml"),r=aC(t,"spec","features");if(!k5(e)||!k5(r))return[];let n=new Map;try{for(let l of E5(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of NRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=E5(aC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Cp,A5,T5,O5=y(()=>{"use strict";Pp();Ue();Cp="INVENTORY_DRIFT",A5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];T5={name:Cp,run:jRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function URe(t){let{cwd:e="."}=t,r=LRe(e,"src","spec","schema.json"),n=[];if(MRe(r)){let i;try{i=JSON.parse(FRe(r,"utf8"))}catch(o){n.push({detector:Dp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of zRe)i.required?.includes(o)||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==R5&&n.push({detector:Dp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${R5}'`})}catch{}return n}var Dp,zRe,R5,I5,P5=y(()=>{"use strict";Ue();Dp="META_INTEGRITY",zRe=["schema","project","features"],R5="0.1";I5={name:Dp,run:URe}});function qRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return C5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),C5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function C5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:D5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var D5,N5,j5=y(()=>{"use strict";Ue();D5="SLUG_CONFLICT";N5={name:D5,run:qRe}});function Xl(t){return t==="planned"||t==="in_progress"}var tS=y(()=>{"use strict"});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function GRe(t){let{cwd:e="."}=t;return ge(e,rS,r=>ZRe(r,e))}function ZRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=HRe(e,i);BRe(o)||r.push(VRe(n.id,i,n.status))}return r}function VRe(t,e,r){return Xl(r)?{detector:rS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:rS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var rS,nS,lC=y(()=>{"use strict";tS();wt();rS="MISSING_IMPLEMENTATION";nS={name:rS,run:GRe}});function WRe(t){let{cwd:e="."}=t;return ge(e,uC,KRe)}function KRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:uC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var uC,iS,dC=y(()=>{"use strict";wt();uC="MISSING_TESTS";iS={name:uC,run:WRe}});import{existsSync as JRe,readFileSync as YRe}from"node:fs";import{join as M5}from"node:path";function F5(t){if(JRe(t))try{return JSON.parse(YRe(t,"utf8"))}catch{return}}function tIe(t){let{cwd:e="."}=t,r=F5(M5(e,XRe)),n=F5(M5(e,QRe));if(!r||!n)return[{detector:fC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>eIe&&i.push({detector:fC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var fC,XRe,QRe,eIe,L5,z5=y(()=>{"use strict";fC="PERFORMANCE_DRIFT",XRe="perf/baseline.json",QRe="perf/current.json",eIe=10;L5={name:fC,run:tIe}});import{existsSync as rIe}from"node:fs";import{join as nIe}from"node:path";function oIe(t){let{cwd:e="."}=t;return ge(e,pC,r=>aIe(r,e))}function sIe(t,e){return(t.modules??[]).some(r=>rIe(nIe(e,r)))}function aIe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||sIe(s,e)||r.push(s.id);let n=iIe;if(r.length<=n)return[];let i=r.slice(0,U5).join(", "),o=r.length>U5?", \u2026":"";return[{detector:pC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var pC,iIe,U5,q5,B5=y(()=>{"use strict";wt();pC="PLANNED_BACKLOG",iIe=5,U5=8;q5={name:pC,run:oIe}});import{existsSync as cIe,readFileSync as lIe}from"node:fs";import{join as uIe}from"node:path";function pIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>mIe(r,e))}function mIe(t,e){if(t.features.lengthn.includes(i))?[{detector:mC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var mC,dIe,fIe,H5,G5=y(()=>{"use strict";wt();mC="PROJECT_CONTEXT_DRIFT",dIe=8,fIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];H5={name:mC,run:pIe}});function Z5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:oS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function hIe(t){let{cwd:e="."}=t;return ge(e,oS,gIe)}function gIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...Z5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:oS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...Z5(e,n.features,`scenario ${n.id}.features`));return r}var oS,sS,hC=y(()=>{"use strict";wt();oS="REFERENCE_INTEGRITY";sS={name:oS,run:hIe}});function Np(t=""){return new RegExp(yIe,t)}var yIe,gC=y(()=>{"use strict";yIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as _Ie,readdirSync as bIe,readFileSync as vIe,statSync as SIe,writeFileSync as wIe}from"node:fs";import{dirname as xIe,join as jp,normalize as $Ie,relative as kIe}from"node:path";function RIe(t){let e=[];for(let r of t.matchAll(OIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Np("g"))??[])e.push(n);return[...new Set(e)].sort()}function IIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function V5(t){return t.split("\\").join("/")}function PIe(t){return EIe.some(e=>t===e||t.startsWith(`${e}/`))}function CIe(t){let e=jp(t,"docs");if(!_Ie(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=bIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=jp(i,s),c;try{c=SIe(a)}catch{continue}let l=V5(kIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function DIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=$Ie(jp(xIe(t),e));return V5(r)}function Mp(t="."){let e=[];for(let r of CIe(t)){let n;try{n=vIe(jp(t,r),"utf8")}catch{continue}let i=IIe(n),o=RIe(i);if(PIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(AIe)?[]:i.match(Np("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(TIe)){let d=DIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function W5(t="."){let e=Mp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return wIe(jp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var SIe,wIe,xIe,$Ie,aS=y(()=>{"use strict";gC();SIe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],wIe="clad-doc-links: ignore",xIe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,$Ie=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as RIe}from"node:fs";import{join as IIe}from"node:path";function PIe(t){let{cwd:e="."}=t;return ge(e,cS,r=>CIe(r,e))}function CIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Mp(e).docs){for(let o of i.doc_links)RIe(IIe(e,o))||n.push({detector:cS,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:cS,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var cS,lS,yC=y(()=>{"use strict";aS();wt();cS="DOC_LINK_INTEGRITY";lS={name:cS,run:PIe}});function DIe(t){let{cwd:e="."}=t;return ge(e,Fp,r=>NIe(r))}function NIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=W5,o=t.project.onboarding_seeded===!0&&!i;r>=W5&&n.length===0&&e.push({detector:Fp,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let a of n)(a.features??[]).length===0&&e.push({detector:Fp,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Fp,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Fp,W5,K5,J5=y(()=>{"use strict";wt();Fp="SCENARIO_COVERAGE",W5=8;K5={name:Fp,run:DIe}});import{createHash as jIe}from"node:crypto";function MIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Lp(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??Y5),sample:MIe(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(Y5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function zp(t){return(t.features??[]).filter(e=>e.status==="done").length}function FIe(t,e){return e<=0?!1:e>=1?!0:parseInt(jIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var Y5,uS=y(()=>{"use strict";Y5=["unwanted"]});import{chmodSync as LIe,existsSync as Q5,readFileSync as zIe,readdirSync as UIe,statSync as eY,unlinkSync as qIe,utimesSync as BIe,writeFileSync as HIe}from"node:fs";import{join as tY}from"node:path";import rY from"node:process";function GIe(t){return pJ(t).map(e=>{try{let r=eY(e);return r.isFile()?{path:e,body:zIe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function ZIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!Q5(r.path))continue;if(!eY(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}qIe(r.path);continue}HIe(r.path,r.body),r.mode!==void 0&&LIe(r.path,r.mode),r.atime&&r.mtime&&BIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function VIe(t){let e=!1,r=n=>{for(let i of UIe(n,{withFileTypes:!0})){if(e)return;let o=tY(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function _C(t={}){let{cwd:e="."}=t,r=tY(e,vs);if(!Q5(r)||!VIe(r))return{stage:Ja,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${vs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Ja,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=GIe(e)}catch(d){return{stage:Ja,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,vs];try{s=We(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=ZIe(o);if(l.length>0)return{stage:Ja,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Ja,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=Nt(Ja,i.cmd,s,c);return u||Yt(Ja,s)}var Ja,vs,WIe,bC=y(()=>{"use strict";Lr();cn();_p();Cn();Ja="stage_2.3",vs="tests/oracle";WIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${rY.argv[1]}`;if(WIe){let t=_C();console.log(JSON.stringify(t)),rY.exit(t.exitCode)}});import{existsSync as KIe}from"node:fs";import{join as JIe}from"node:path";function YIe(t){let{cwd:e="."}=t;return ge(e,oi,r=>XIe(r,e))}function XIe(t,e){let r=[],n=Lp(t.project,zp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?fr(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Up(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:oi,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${vs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!KIe(JIe(e,f))){r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${vs}/`)||r.push({detector:oi,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${vs}/ \u2014 stage_2.3 only runs ${vs}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:oi,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:oi,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:oi,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var oi,nY,iY=y(()=>{"use strict";un();uS();bC();wt();oi="SPEC_CONFORMANCE";nY={name:oi,run:YIe}});function QIe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:vC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>oY&&i.push({detector:vC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${oY})`})}return i}var vC,oY,sY,aY=y(()=>{"use strict";un();vC="STALE_EVIDENCE",oY=90;sY={name:vC,run:QIe}});import{existsSync as cY}from"node:fs";import{join as lY}from"node:path";function ePe(t){let{cwd:e="."}=t;return ge(e,Ql,r=>tPe(r,e))}function tPe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ql,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Ql,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>cY(lY(e,o)));i.length>0&&r.push({detector:Ql,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Xl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>cY(lY(e,i)))&&r.push({detector:Ql,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var Ql,dS,SC=y(()=>{"use strict";tS();wt();Ql="STALE_SPECIFICATION";dS={name:Ql,run:ePe}});import{existsSync as uY,statSync as dY}from"node:fs";import{join as fY}from"node:path";function nPe(t,e){let r=0;for(let n of e){let i=fY(t,n);if(!uY(i))continue;let o=dY(i).mtimeMs;o>r&&(r=o)}return r}function iPe(t){let{cwd:e="."}=t;return ge(e,wC,r=>oPe(r,e))}function oPe(t,e){let r=Li(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=nPe(e,n);if(i===0)return[];let o=_s([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=fY(e,a);if(!uY(c))continue;let l=dY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>rPe&&s.push({detector:wC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var wC,rPe,fS,xC=y(()=>{"use strict";Ap();Ha();wt();wC="STALE_TESTS",rPe=30;fS={name:wC,run:iPe}});import{existsSync as sPe}from"node:fs";import{join as aPe}from"node:path";function cPe(t){let{cwd:e="."}=t;return ge(e,qp,r=>lPe(r,e))}function lPe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:qp,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!sPe(aPe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:qp,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:qp,severity:Xl(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var qp,pS,$C=y(()=>{"use strict";tS();wt();qp="STATUS_DRIFT";pS={name:qp,run:cPe}});function uPe(t){let{cwd:e="."}=t;return ge(e,mS,r=>dPe(r,e))}function dPe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:mS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:mS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var mS,pY,mY=y(()=>{"use strict";cn();wt();mS="TECH_STACK_MISMATCH";pY={name:mS,run:uPe}});function hPe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function gPe(t){let{cwd:e="."}=t;return ge(e,kC,r=>yPe(r,e))}function yPe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=_s([...hPe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:kC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var kC,hY,fPe,pPe,mPe,hS,EC=y(()=>{"use strict";Ap();JP();wt();kC="UNMAPPED_ARTIFACT",hY=["src/stages/**/*.ts","src/spec/**/*.ts"],fPe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},pPe={kotlin:"src/main/kotlin"},mPe=8;hS={name:kC,run:gPe}});import{existsSync as gY}from"node:fs";import{join as yY}from"node:path";function bPe(t){return _Pe.some(e=>t.startsWith(e))}function vPe(t){let{cwd:e="."}=t;return ge(e,AC,r=>SPe(r,e))}function SPe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if(bPe(o))continue;let s=o.split("#",1)[0];gY(yY(e,o))||s&&gY(yY(e,s))||r.push({detector:AC,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`}function yte(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${pte(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(mte);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(mte);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${pte(s)}.md`,`${a.join(` +`)}`)}return o}function mte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as wqe}from"node:fs";import{dirname as xqe,join as Pj}from"node:path";import{fileURLToPath as $qe}from"node:url";var Cj=xqe($qe(import.meta.url));function _te(t){for(let e of[Pj(Cj,"viewer",t),Pj(Cj,"..","graph","viewer",t),Pj(Cj,"..","..","dist","viewer",t)])try{return wqe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function bte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -901,21 +901,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}eC();yC();lC();dC();hC();QP();xC();$C();EC();TC();rh();gC();Ue();var vqe=[iS,gS,nS,hS,sS,lS,Xv,pS,fS,Yv];function Sqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Np().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Hx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of vqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of Sqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Dj();Ue();Pi();var xqe=new Set(["mermaid","dot","json","obsidian","html"]);function vte(t={}){try{let e=t.format??"mermaid";if(!xqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=xc(n,".");if(t.focus){let s=Fx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Mx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=gte(i);for(let[c,l]of a){let u=wqe(s,c);Nj(Mj(u),{recursive:!0}),jj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Bx(i,Hx(i,"."));Nj(Mj(t.out),{recursive:!0}),jj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?hte(i):r==="json"?qx(i):mte(i);t.out?(Nj(Mj(t.out),{recursive:!0}),jj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function Ste(){try{let t=xc(q(),".");process.stdout.write(bte(Gx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}rh();import{createServer as $qe}from"node:http";import{existsSync as kqe,watch as Eqe}from"node:fs";import{join as Aqe}from"node:path";Ue();Pi();function Tqe(t={}){let e=t.cwd??".",r=new Set,n=()=>xc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}eC();yC();lC();dC();hC();QP();xC();$C();EC();TC();rh();gC();Ue();var kqe=[iS,gS,nS,hS,sS,lS,Xv,pS,fS,Yv];function Eqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Np().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Hx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of kqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of Eqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Dj();Ue();Pi();var Tqe=new Set(["mermaid","dot","json","obsidian","html"]);function Ste(t={}){try{let e=t.format??"mermaid";if(!Tqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=xc(n,".");if(t.focus){let s=Fx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Mx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=yte(i);for(let[c,l]of a){let u=Aqe(s,c);Nj(Mj(u),{recursive:!0}),jj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Bx(i,Hx(i,"."));Nj(Mj(t.out),{recursive:!0}),jj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?gte(i):r==="json"?qx(i):hte(i);t.out?(Nj(Mj(t.out),{recursive:!0}),jj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function wte(){try{let t=xc(q(),".");process.stdout.write(vte(Gx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}rh();import{createServer as Oqe}from"node:http";import{existsSync as Rqe,watch as Iqe}from"node:fs";import{join as Pqe}from"node:path";Ue();Pi();function Cqe(t={}){let e=t.cwd??".",r=new Set,n=()=>xc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=$qe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=qx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Hx(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected +`)}catch{r.delete(u)}},o=Oqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=qx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Hx(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected -`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Bx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=Aqe(e,u);if(kqe(d))try{let f=Eqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Bx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=Pqe(e,u);if(Rqe(d))try{let f=Iqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function wte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Tqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Oqe=["stage_1.1","stage_2.1","stage_2.3"];function Rqe(t){return(t.features??[]).filter(e=>e.status==="done")}function Iqe(t,e){let r=Rqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function xte(t,e){let r=[];for(let n of Oqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=Iqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}TS();import $te from"node:process";function Pqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Zx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Pqe(n,t);i.pass||r.push(i)}return r}un();var Fj="stage_4.1";function Lj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Fj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Zx(r);if(n.length===0)return{stage:Fj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Fj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var Cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$te.argv[1]}`;if(Cqe){let t=Lj();console.log(JSON.stringify(t)),$te.exit(t.exitCode)}$l();import{randomBytes as Dqe}from"node:crypto";import{unlinkSync as Nqe}from"node:fs";import{tmpdir as jqe}from"node:os";import{join as Mqe,resolve as zj}from"node:path";import Fqe from"node:process";var Hr=null;function kte(t){Hr={cwd:zj(t),run:null,jsonFile:null}}function Uj(){return Hr!==null}function qj(t,e){if(!Hr||Hr.cwd!==zj(t))return null;if(Hr.run)return Hr.run;let r=Mqe(jqe(),`clad-shared-vitest-${Fqe.pid}-${Dqe(6).toString("hex")}.json`);Hr.jsonFile=r;let n=e(r);return Hr.run={proc:n,jsonFile:r},Hr.run}function Ete(t){return!Hr||Hr.cwd!==zj(t)?null:Hr.run}function Bj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ate(){let t=Hr?.jsonFile;if(Hr=null,t)try{Nqe(t)}catch{}}Lr();import Tte from"node:process";var Vx="stage_1.4";function Hj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Vx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Vx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Vx,pass:!0,exitCode:0}:{stage:Vx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var Lqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tte.argv[1]}`;if(Lqe){let t=Hj();console.log(JSON.stringify(t)),Tte.exit(t.exitCode)}Lr();import Ote from"node:process";nh();Cn();var Wx="stage_2.2";function Gj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Wx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Wx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Ete(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Wx,r,s,n);return a||Yt(Wx,s)}var qqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ote.argv[1]}`;if(qqe){let t=Gj();console.log(JSON.stringify(t)),Ote.exit(t.exitCode)}Hp();Zj();Lr();cn();Cn();import Ite from"node:process";var Yx="stage_3.2";function Vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Yx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Yx,i,s,o);return a||Yt(Yx,s)}var c4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ite.argv[1]}`;if(c4e){let t=Vj();console.log(JSON.stringify(t)),Ite.exit(t.exitCode)}Lr();Ue();Cn();import{existsSync as l4e}from"node:fs";import{resolve as Cte}from"node:path";import Dte from"node:process";var fi="stage_2.4",Wj=5e3,u4e=3e4;function Kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return f4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Cte(e,r.path);if(!l4e(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Wj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Pte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},d4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function f4e(t,e,r){let n=Math.min(e.length*Wj,u4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(p4e(t,s,r))}return m4e(o)}function p4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Cte(t,a):a,u=Wj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ua(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function m4e(t){let e="skip";for(let o of t)Pte[o.disposition]>Pte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${d4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var h4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Dte.argv[1]}`;if(h4e){let t=Kj();console.log(JSON.stringify(t)),Dte.exit(t.exitCode)}Lr();cn();Cn();import Nte from"node:process";var Xx="stage_3.1";function Jj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var g4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Nte.argv[1]}`;if(g4e){let t=Jj();console.log(JSON.stringify(t)),Nte.exit(t.exitCode)}bC();Yj();Xj();Lr();Kx();import{randomBytes as x4e}from"node:crypto";import{unlinkSync as $4e}from"node:fs";import{tmpdir as k4e}from"node:os";import{join as E4e}from"node:path";import eM from"node:process";nh();Cn();Ue();import{readFileSync as b4e}from"node:fs";import{resolve as Fte}from"node:path";function v4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Fte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function S4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function w4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=S4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Fte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Qj(t,e){try{let r=v4e(b4e(t,"utf8"));return r?w4e(q(e),r,e):[]}catch{return[]}}var Gr="stage_2.1";function Lte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function zte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Ute(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function A4e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Lte(n,i))return null;let o=n,s=i,a=qj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Gr,n,c,s))return null;let u=Yt(Gr,c);if(Bj(u)==="fallback")return null;if(r){let d=Qj(l,e);if(d.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Gr,pass:!0,exitCode:0}}function T4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!zte(n,i))return null;let o=n,s=i,a=qj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Gr,o,a.proc,s))return null;let c=Yt(Gr,a.proc);if(Bj(c)==="fallback")return null;if(r&&Ute(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Gr,pass:!0,exitCode:0}}function tM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Gr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Gr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Lte(n,i),a=zte(n,i),c=r&&s;if(Uj()&&s){let d=A4e(t,e,c);if(d)return d}if(Uj()&&a){let d=T4e(t,e);if(d)return d}let l,u=i;c&&(l=E4e(k4e(),`clad-vitest-${eM.pid}-${x4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Gr,n,d,u);if(f)return f;let p=ju("unit",Yt(Gr,d),d);if(r&&p.pass&&Ute(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Qj(l,e);if(m.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{$4e(l)}catch{}}}var O4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${eM.argv[1]}`;if(O4e){let t=tM();console.log(JSON.stringify(t)),eM.exit(t.exitCode)}Lr();cn();Cn();import qte from"node:process";var t0="stage_3.3";function rM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Yt(t0,s)}var R4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${qte.argv[1]}`;if(R4e){let t=rM();console.log(JSON.stringify(t)),qte.exit(t.exitCode)}SC();Bf();ba();iM();Pp();aS();var Kte=St(er(),1);import{existsSync as oM,readFileSync as U4e,readdirSync as Wte,statSync as q4e,writeFileSync as B4e}from"node:fs";import{basename as ch,join as lh,relative as Vte}from"node:path";var H4e=["self-dogfood:","fixture:","derived:"],Jte=/\.(test|spec)\.[jt]sx?$/;function Yte(t,e=t,r=[]){let n;try{n=Wte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=lh(e,i);try{q4e(o).isDirectory()?Yte(t,o,r):Jte.test(i)&&r.push(o)}catch{continue}}return r}function Xte(t="."){let e=lh(t,"spec","features"),r=lh(t,"tests"),n=[],i=[];if(!oM(e)||!oM(r))return{repaired:n,suggested:i};let o=Yte(r),s=new Map;for(let a of o){let c=Vte(t,a).split("\\").join("/"),l=s.get(ch(a))??[];l.push(c),s.set(ch(a),l)}for(let a of Wte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=lh(e,a),l,u;try{l=U4e(c,"utf8"),u=(0,Kte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(H4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(oM(lh(t,b)))continue;let _=s.get(ch(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>ch(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Vte(t,h).split("\\").join("/")).find(h=>{let g=ch(h).replace(Jte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function xte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Cqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Dqe=["stage_1.1","stage_2.1","stage_2.3"];function Nqe(t){return(t.features??[]).filter(e=>e.status==="done")}function jqe(t,e){let r=Nqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function $te(t,e){let r=[];for(let n of Dqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=jqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}TS();import kte from"node:process";function Mqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Zx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Mqe(n,t);i.pass||r.push(i)}return r}un();var Fj="stage_4.1";function Lj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Fj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Zx(r);if(n.length===0)return{stage:Fj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Fj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var Fqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kte.argv[1]}`;if(Fqe){let t=Lj();console.log(JSON.stringify(t)),kte.exit(t.exitCode)}$l();import{randomBytes as Lqe}from"node:crypto";import{unlinkSync as zqe}from"node:fs";import{tmpdir as Uqe}from"node:os";import{join as qqe,resolve as zj}from"node:path";import Bqe from"node:process";var Hr=null;function Ete(t){Hr={cwd:zj(t),run:null,jsonFile:null}}function Uj(){return Hr!==null}function qj(t,e){if(!Hr||Hr.cwd!==zj(t))return null;if(Hr.run)return Hr.run;let r=qqe(Uqe(),`clad-shared-vitest-${Bqe.pid}-${Lqe(6).toString("hex")}.json`);Hr.jsonFile=r;let n=e(r);return Hr.run={proc:n,jsonFile:r},Hr.run}function Ate(t){return!Hr||Hr.cwd!==zj(t)?null:Hr.run}function Bj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Tte(){let t=Hr?.jsonFile;if(Hr=null,t)try{zqe(t)}catch{}}Lr();import Ote from"node:process";var Vx="stage_1.4";function Hj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Vx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Vx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Vx,pass:!0,exitCode:0}:{stage:Vx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ote.argv[1]}`;if(Hqe){let t=Hj();console.log(JSON.stringify(t)),Ote.exit(t.exitCode)}Lr();import Rte from"node:process";nh();Cn();var Wx="stage_2.2";function Gj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Wx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Wx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Ate(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Wx,r,s,n);return a||Yt(Wx,s)}var Vqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(Vqe){let t=Gj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Hp();Zj();Lr();cn();Cn();import Pte from"node:process";var Yx="stage_3.2";function Vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Yx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Yx,i,s,o);return a||Yt(Yx,s)}var p4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Pte.argv[1]}`;if(p4e){let t=Vj();console.log(JSON.stringify(t)),Pte.exit(t.exitCode)}Lr();Ue();Cn();import{existsSync as m4e}from"node:fs";import{resolve as Dte}from"node:path";import Nte from"node:process";var fi="stage_2.4",Wj=5e3,h4e=3e4;function Kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return y4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Dte(e,r.path);if(!m4e(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Wj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Cte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},g4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function y4e(t,e,r){let n=Math.min(e.length*Wj,h4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(_4e(t,s,r))}return b4e(o)}function _4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Dte(t,a):a,u=Wj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ua(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function b4e(t){let e="skip";for(let o of t)Cte[o.disposition]>Cte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${g4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var v4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Nte.argv[1]}`;if(v4e){let t=Kj();console.log(JSON.stringify(t)),Nte.exit(t.exitCode)}Lr();cn();Cn();import jte from"node:process";var Xx="stage_3.1";function Jj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var S4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jte.argv[1]}`;if(S4e){let t=Jj();console.log(JSON.stringify(t)),jte.exit(t.exitCode)}bC();Yj();Xj();Lr();Kx();import{randomBytes as T4e}from"node:crypto";import{unlinkSync as O4e}from"node:fs";import{tmpdir as R4e}from"node:os";import{join as I4e}from"node:path";import eM from"node:process";nh();Cn();Ue();import{readFileSync as $4e}from"node:fs";import{resolve as Lte}from"node:path";function k4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Lte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function E4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function A4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=E4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Lte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Qj(t,e){try{let r=k4e($4e(t,"utf8"));return r?A4e(q(e),r,e):[]}catch{return[]}}var Gr="stage_2.1";function zte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Ute(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function qte(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function P4e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!zte(n,i))return null;let o=n,s=i,a=qj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Gr,n,c,s))return null;let u=Yt(Gr,c);if(Bj(u)==="fallback")return null;if(r){let d=Qj(l,e);if(d.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Gr,pass:!0,exitCode:0}}function C4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Ute(n,i))return null;let o=n,s=i,a=qj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Gr,o,a.proc,s))return null;let c=Yt(Gr,a.proc);if(Bj(c)==="fallback")return null;if(r&&qte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Gr,pass:!0,exitCode:0}}function tM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Gr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Gr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=zte(n,i),a=Ute(n,i),c=r&&s;if(Uj()&&s){let d=P4e(t,e,c);if(d)return d}if(Uj()&&a){let d=C4e(t,e);if(d)return d}let l,u=i;c&&(l=I4e(R4e(),`clad-vitest-${eM.pid}-${T4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Gr,n,d,u);if(f)return f;let p=ju("unit",Yt(Gr,d),d);if(r&&p.pass&&qte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Qj(l,e);if(m.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{O4e(l)}catch{}}}var D4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${eM.argv[1]}`;if(D4e){let t=tM();console.log(JSON.stringify(t)),eM.exit(t.exitCode)}Lr();cn();Cn();import Bte from"node:process";var t0="stage_3.3";function rM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Yt(t0,s)}var N4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bte.argv[1]}`;if(N4e){let t=rM();console.log(JSON.stringify(t)),Bte.exit(t.exitCode)}SC();Bf();ba();iM();Pp();aS();var Jte=St(er(),1);import{existsSync as oM,readFileSync as Z4e,readdirSync as Kte,statSync as V4e,writeFileSync as W4e}from"node:fs";import{basename as ch,join as lh,relative as Wte}from"node:path";var K4e=["self-dogfood:","fixture:","derived:"],Yte=/\.(test|spec)\.[jt]sx?$/;function Xte(t,e=t,r=[]){let n;try{n=Kte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=lh(e,i);try{V4e(o).isDirectory()?Xte(t,o,r):Yte.test(i)&&r.push(o)}catch{continue}}return r}function Qte(t="."){let e=lh(t,"spec","features"),r=lh(t,"tests"),n=[],i=[];if(!oM(e)||!oM(r))return{repaired:n,suggested:i};let o=Xte(r),s=new Map;for(let a of o){let c=Wte(t,a).split("\\").join("/"),l=s.get(ch(a))??[];l.push(c),s.set(ch(a),l)}for(let a of Kte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=lh(e,a),l,u;try{l=Z4e(c,"utf8"),u=(0,Jte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(K4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(oM(lh(t,b)))continue;let _=s.get(ch(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>ch(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Wte(t,h).split("\\").join("/")).find(h=>{let g=ch(h).replace(Yte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&B4e(c,l,"utf8")}return{repaired:n,suggested:i}}xl();import{existsSync as G4e,readFileSync as Z4e}from"node:fs";import{join as V4e}from"node:path";function W4e(t,e){let r=V4e(t,e);if(!G4e(r))return[];let n=[];for(let i of Z4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function Qte(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>W4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function ere(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}uS();Ue();un();Pi();un();xl();var sM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],K4e=[...sM,"att"];function J4e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Y4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":J_(e,r,t).state==="fresh"?"\u2713":"!"}function o0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...sM.map(o=>J4e(i,o,e)),Y4e(i,r,e)]}));return{columns:K4e,rows:n}}function tre(t,e=".",r={}){let n=r.internal??!1,i=o0(t,e),o=[...sM.map(c=>n?c.replace("stage_",""):X4e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function X4e(t){return Ta(t).slice(0,3)}async function k5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(gde(),hde)),Promise.resolve().then(()=>(Sde(),vde)),Promise.resolve().then(()=>(om(),I7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ste(s),prepareInit:({cwd:s,mode:a,intent:c})=>ite(s,a,c),initialize:Sj,prepareClarify:(s,{cwd:a})=>ote(a,s),clarify:kj,resolveReview:(s,{cwd:a})=>ete(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function E5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Sj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&W4e(c,l,"utf8")}return{repaired:n,suggested:i}}xl();import{existsSync as J4e,readFileSync as Y4e}from"node:fs";import{join as X4e}from"node:path";function Q4e(t,e){let r=X4e(t,e);if(!J4e(r))return[];let n=[];for(let i of Y4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function ere(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>Q4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function tre(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}uS();Ue();un();Pi();un();xl();var sM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],e6e=[...sM,"att"];function t6e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function r6e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":J_(e,r,t).state==="fresh"?"\u2713":"!"}function o0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...sM.map(o=>t6e(i,o,e)),r6e(i,r,e)]}));return{columns:e6e,rows:n}}function rre(t,e=".",r={}){let n=r.internal??!1,i=o0(t,e),o=[...sM.map(c=>n?c.replace("stage_",""):n6e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function n6e(t){return Ta(t).slice(0,3)}async function R5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(yde(),gde)),Promise.resolve().then(()=>(wde(),Sde)),Promise.resolve().then(()=>(om(),P7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ate(s),prepareInit:({cwd:s,mode:a,intent:c})=>ote(s,a,c),initialize:Sj,prepareClarify:(s,{cwd:a})=>ste(a,s),clarify:kj,resolveReview:(s,{cwd:a})=>tte(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function I5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Sj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} `),G.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){G.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())G.stdout.write(` ${o+1}. ${s} @@ -926,32 +926,32 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&B4e(c,l,"u `),G.stdout.write(` e.g. clad init payment SaaS for B2B `),G.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));G.exit(0)}async function A5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Zde(),Gde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} +`));G.exit(0)}async function P5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Vde(),Zde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} `);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>uR(l,s)),c=`${SG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function T5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Yl(".",r),Ka("."),V5(".");let n=su(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Xte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=i0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=dS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function O5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=C_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function R5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=D_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}N_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function C5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Yl(".",r),Ka("."),W5(".");let n=su(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Qte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=i0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=dS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function D5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=C_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function N5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=D_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}N_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} `):G.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),G.exit(0)}async function I5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await eD({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function P5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await t7(".",{wireHosts:async()=>(await eD({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` +`),G.exit(0)}async function j5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await eD({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function M5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await r7(".",{wireHosts:async()=>(await eD({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),IA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var C5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function IA(t){let e=t.tier??"all",r=t.silent===!0,n=C5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>sh(i)],["stage_1.2",()=>oh(i)],["stage_1.3",()=>si({...i,strict:t.strict})],["stage_1.4",Hj],["stage_1.5",nc],["stage_1.6",Qp],["stage_2.1",()=>tM({...i,strict:t.strict})],["stage_2.2",()=>Gj(i)],["stage_2.3",_C],["stage_2.4",Kj],["stage_3.1",Jj],["stage_3.2",Vj],["stage_3.3",rM],["stage_4.1",Lj],["stage_4.2",ah]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":li(d)?"fail":"skip",u=[];Y_("."),kte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=qX(p);li(h)&&(c=!0,a=Math.max(a,BX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),li(h)&&U5e(p))}}finally{Q_(),Ate()}if(t.strict)try{let d=q();for(let f of xte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!li(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>li(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{GG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function D5e(t){try{let e=q(),r=hl(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} -`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function N5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} -`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function j5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=yS(e,o=>{try{return Wde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function M5e(t={}){try{if(t.sessions){lte(t);return}if(t.trend!==void 0&&t.trend!==!1){ute(t);return}let e=q(),n=zH(e,o=>{try{return Wde(o,"utf8")}catch{return null}},"."),i=qH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} +`),IA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var F5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function IA(t){let e=t.tier??"all",r=t.silent===!0,n=F5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>sh(i)],["stage_1.2",()=>oh(i)],["stage_1.3",()=>si({...i,strict:t.strict})],["stage_1.4",Hj],["stage_1.5",nc],["stage_1.6",Qp],["stage_2.1",()=>tM({...i,strict:t.strict})],["stage_2.2",()=>Gj(i)],["stage_2.3",_C],["stage_2.4",Kj],["stage_3.1",Jj],["stage_3.2",Vj],["stage_3.3",rM],["stage_4.1",Lj],["stage_4.2",ah]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":li(d)?"fail":"skip",u=[];Y_("."),Ete(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=BX(p);li(h)&&(c=!0,a=Math.max(a,HX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),li(h)&&Z5e(p))}}finally{Q_(),Tte()}if(t.strict)try{let d=q();for(let f of $te(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!li(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>li(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{GG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function L5e(t){try{let e=q(),r=hl(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} +`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function z5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} +`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function U5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=yS(e,o=>{try{return Kde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function q5e(t={}){try{if(t.sessions){ute(t);return}if(t.trend!==void 0&&t.trend!==!1){dte(t);return}let e=q(),n=zH(e,o=>{try{return Kde(o,"utf8")}catch{return null}},"."),i=qH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} `);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${gl}`];G.stdout.write(`${c.join(` `)} -`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function F5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=IA({...t,focusModules:e});if(!t.json){let n=wX(".");n&&G.stdout.write(`\u2139 ${n} -`)}G.exitCode=r.worst}function L5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=fX(".",t,{checkStages:IA,onIndex:Ka,gitOpInProgress:PO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function z5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=X5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function B5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=IA({...t,focusModules:e});if(!t.json){let n=xX(".");n&&G.stdout.write(`\u2139 ${n} +`)}G.exitCode=r.worst}function H5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=pX(".",t,{checkStages:IA,onIndex:Ka,gitOpInProgress:PO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function G5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=Q5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),G.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";G.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}G.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=Qte(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${ere(i)} -`),G.exit(0)}function U5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Vde(Sl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] +`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=ere(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${tre(i)} +`),G.exit(0)}function Z5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Wde(Sl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&G.stdout.write(` \u2026 and ${n.length-3} more finding(s) `),t.hint&&G.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Vde(e.trim(),160)} -`)}}function Vde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function q5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} -`),G.exitCode=0;return}G.stdout.write(`${tre(e,".",{internal:t.internal})} -`),G.exit(0)}function B5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function H5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=bl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:yl(u),auditMarkdown:_l(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=DG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{$5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${B5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function G5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function Z5e(){let t=new R4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(E5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(A5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(T5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(I5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(P5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(F5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(O5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(L5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>z5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(R5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(q5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(D5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>N5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>JX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>j5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>M5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>vte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Ste()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{wte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>vG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>CY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>H5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(G5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(UX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(k5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){cX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}jY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(nte),t}var V5e=!!globalThis.__CLADDING_BUNDLED,W5e=V5e||import.meta.url===`file://${G.argv[1]}`;W5e&&Z5e().parse();export{C5e as TIER_STAGES,Z5e as createProgram,H5e as runBundleCommand,F5e as runCheckCommand,IA as runCheckStages,O5e as runCheckpointCommand,D5e as runContextCommand,L5e as runDoneCommand,N5e as runImpactCommand,j5e as runInferDepsCommand,E5e as runInitCommand,M5e as runMeasureCommand,z5e as runOracleCommand,R5e as runRollbackCommand,G5e as runRouteCommand,A5e as runRunCommand,k5e as runServeCommand,I5e as runSetupCommand,q5e as runStatusCommand,T5e as runSyncCommand,P5e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Wde(e.trim(),160)} +`)}}function Wde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function V5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} +`),G.exitCode=0;return}G.stdout.write(`${rre(e,".",{internal:t.internal})} +`),G.exit(0)}function W5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=bl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:yl(u),auditMarkdown:_l(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=DG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{O5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${W5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function J5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function Y5e(){let t=new R4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(I5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(P5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(C5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(j5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(M5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(B5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(D5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(H5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>G5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(N5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(V5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(L5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>z5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>YX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>U5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>q5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>Ste(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>wte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{xte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>vG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>DY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>K5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(J5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(qX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(R5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){lX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}MY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ite),t}var X5e=!!globalThis.__CLADDING_BUNDLED,Q5e=X5e||import.meta.url===`file://${G.argv[1]}`;Q5e&&Y5e().parse();export{F5e as TIER_STAGES,Y5e as createProgram,K5e as runBundleCommand,B5e as runCheckCommand,IA as runCheckStages,D5e as runCheckpointCommand,L5e as runContextCommand,H5e as runDoneCommand,z5e as runImpactCommand,U5e as runInferDepsCommand,I5e as runInitCommand,q5e as runMeasureCommand,G5e as runOracleCommand,N5e as runRollbackCommand,J5e as runRouteCommand,P5e as runRunCommand,R5e as runServeCommand,j5e as runSetupCommand,V5e as runStatusCommand,C5e as runSyncCommand,M5e as runUpdateCommand}; diff --git a/spec/attestation.yaml b/spec/attestation.yaml index d5f5c1d8..3c71667e 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -20,12 +20,12 @@ attested_modules: CHANGELOG.md: a67e4c092a7223c1 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: cd57c4adbf63c21f - README.ja.md: 0b9ae54836f7c7c5 - README.ko.html: c90c121ff05543e2 - README.ko.md: 201d815f50b9a5c8 - README.md: 0f3ff03524db0951 - README.zh.md: 07f985aed7eb3304 + README.html: 4b53ba35d39fde31 + README.ja.md: f30039ac322e6de1 + README.ko.html: 7b0a16975efaaeef + README.ko.md: f3eafbdb44038429 + README.md: 8aea451e838a6330 + README.zh.md: caa962e802af7681 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -145,7 +145,7 @@ attested_modules: src/agents/orchestrator.md: 1b758de0bdab8eb0 src/agents/planner.md: 2ca87ed1fe99c913 src/agents/reviewer.md: cdf7469a3e58b438 - src/changelog/collect.ts: bb0830526334da9f + src/changelog/collect.ts: c9ae573dba826a75 src/changelog/render.ts: 83dd2d95f24ca68c src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f @@ -228,7 +228,7 @@ attested_modules: src/oracle/payload.ts: 0171633d758ceed8 src/oracle/policy.ts: 8919ad927bd59b08 src/oracle/record.ts: 0b9c124225abe1ac - src/report/ac-delta.ts: 18ba218cebf5b6f1 + src/report/ac-delta.ts: f75250d617c710dc src/report/bundle.ts: f8a2fb6c2d02326f src/report/report.ts: f6f6f8bdb679b702 src/report/sarif.ts: 71e97aceeb0a4473 @@ -317,7 +317,7 @@ attested_modules: src/stages/spec-conformance.ts: 1e9b052a2a268d7a src/stages/test-run-cache.ts: 462a5ef1d30eb766 src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e - src/stages/toolchain/detect.ts: 1fa0f54b90c9494d + src/stages/toolchain/detect.ts: e50845a8aa69c765 src/stages/toolchain/gate-config.ts: 818a0a549d875581 src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 @@ -425,7 +425,7 @@ attested_modules: tests/stages/stale-tests.test.ts: 1467ceedb8019e86 tests/stages/status-drift.test.ts: cff1092eeb23c268 tests/stages/tech-stack-mismatch.test.ts: 878436ffd2f94c97 - tests/stages/toolchain.test.ts: 958add1f40d1f06d + tests/stages/toolchain.test.ts: 200184f572abcf88 tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 diff --git a/src/changelog/collect.ts b/src/changelog/collect.ts index 55427063..8dadec98 100644 --- a/src/changelog/collect.ts +++ b/src/changelog/collect.ts @@ -266,7 +266,13 @@ export function collectSpecEntryRevisions(cwd: string, sinceRef: string): readon const added = status.startsWith('A'); const deleted = status.startsWith('D'); - const head = added || !deleted ? parseShard(readWorktreeOrNull(cwd, newPath)) : null; + // BOTH sides are revisions. Reading the head from the working tree let an + // uncommitted edit hide a rewrite that IS in the range, or charge the range + // with one it never made — and the same leak reached the status, which + // manufactures the rewrite-plus-done pairing this data exists to surface. + // The candidate set and the co-change column already come from the + // committed diff; this was the odd one out. + const head = added || !deleted ? parseShard(gitShowOrNull(cwd, 'HEAD', newPath)) : null; const base = added ? null : parseShard(gitShowOrNull(cwd, sinceRef, oldPath)); const anchor = head ?? base; if (!anchor) continue; diff --git a/src/report/ac-delta.ts b/src/report/ac-delta.ts index 4c3581b9..94346526 100644 --- a/src/report/ac-delta.ts +++ b/src/report/ac-delta.ts @@ -89,9 +89,22 @@ function contractKey(ac: AcceptanceCriterion): string { ].join(FIELD_SEPARATOR); } -function byId(acs: readonly AcceptanceCriterion[]): Map { - const map = new Map(); - for (const ac of acs) if (ac.id && !map.has(ac.id)) map.set(ac.id, ac); +/** + * Groups criteria by id in DOCUMENT order, keeping every occurrence. + * + * A duplicate id is invalid and the strict gate says so — but this renderer + * gates nothing, so it runs precisely in the window before green. Keeping only + * the first occurrence let a rewrite of a later duplicate report "unchanged" + * while the same packet's spec-changes section printed the new text. + */ +function byId(acs: readonly AcceptanceCriterion[]): Map { + const map = new Map(); + for (const ac of acs) { + if (!ac.id) continue; + const group = map.get(ac.id); + if (group) group.push(ac); + else map.set(ac.id, [ac]); + } return map; } @@ -109,27 +122,35 @@ function deltaOf(entry: SpecEntryRevision): SpecEntryDelta { const head = byId(entry.headAcs); const rows: AcDeltaRow[] = []; - for (const [id, ac] of head) { - const was = base.get(id); - if (!was) { - rows.push({id, kind: 'new', ...(ac.ears ? {ears: ac.ears} : {})}); - continue; - } - if (contractKey(ac) === contractKey(was)) { - rows.push({id, kind: 'unchanged', ...(ac.ears ? {ears: ac.ears} : {})}); - continue; + // Occurrences pair positionally: the k-th at head against the k-th at base. + // Surplus on either side is a genuine addition or removal. + for (const [id, group] of head) { + const wasGroup = base.get(id) ?? []; + for (const [k, ac] of group.entries()) { + const was = wasGroup[k]; + if (!was) { + rows.push({id, kind: 'new', ...(ac.ears ? {ears: ac.ears} : {})}); + continue; + } + if (contractKey(ac) === contractKey(was)) { + rows.push({id, kind: 'unchanged', ...(ac.ears ? {ears: ac.ears} : {})}); + continue; + } + const shifted = norm(ac.ears) !== norm(was.ears); + rows.push({ + id, + kind: 'rewritten', + ...(ac.ears ? {ears: ac.ears} : {}), + ...(shifted ? {earsShift: `${was.ears ?? '(none)'} → ${ac.ears ?? '(none)'}`} : {}), + }); } - const shifted = norm(ac.ears) !== norm(was.ears); - rows.push({ - id, - kind: 'rewritten', - ...(ac.ears ? {ears: ac.ears} : {}), - ...(shifted ? {earsShift: `${was.ears ?? '(none)'} → ${ac.ears ?? '(none)'}`} : {}), - }); } - for (const [id, ac] of base) { - if (!head.has(id)) rows.push({id, kind: 'removed', ...(ac.ears ? {ears: ac.ears} : {})}); + for (const [id, group] of base) { + const headCount = head.get(id)?.length ?? 0; + for (const ac of group.slice(headCount)) { + rows.push({id, kind: 'removed', ...(ac.ears ? {ears: ac.ears} : {})}); + } } rows.sort((a, b) => a.id.localeCompare(b.id)); diff --git a/src/stages/toolchain/detect.ts b/src/stages/toolchain/detect.ts index 774f7326..b8832763 100644 --- a/src/stages/toolchain/detect.ts +++ b/src/stages/toolchain/detect.ts @@ -11,7 +11,7 @@ // This is the polyglot adapter: cladding itself stays language-agnostic; // the *user project* decides which language tools run. -import {existsSync, readFileSync, readdirSync} from 'node:fs'; +import {existsSync, readFileSync, readdirSync, statSync} from 'node:fs'; import type {Dirent} from 'node:fs'; import {dirname, join, resolve} from 'node:path'; import process from 'node:process'; @@ -424,28 +424,71 @@ function madgeConfigPaths(cwd: string): readonly string[] { return paths; } +/** + * True when the environment itself sets madge's exclusion. + * + * `rc` folds any `madge_*` variable into the config (case-insensitively), so + * `madge_excludeRegExp=^vendor/` is a live rule with no file behind it. Missing + * it is the damaging direction: cladding would send its own `--exclude`, which + * REPLACES rather than merges, and the user's rule would vanish. + */ +function envDeclaresMadgeExclude(): boolean { + for (const [key, value] of Object.entries(process.env)) { + if (!/^madge_excluderegexp/i.test(key)) continue; + if (typeof value === 'string' && value.trim().length > 0) return true; + } + return false; +} + /** * True when this config file actually puts an exclusion in force. * - * Presence is not enough: an empty `.madgerc`, or one carrying only - * `detectiveOptions` (madge's own README recipe), configures no exclusion — so - * standing down for it would leave build output blocking the gate while - * cladding believed the project had it handled. + * Presence is not enough, and neither is the key: an empty `.madgerc`, one + * carrying only `detectiveOptions` (madge's own README recipe), and one whose + * `excludeRegExp` is `[]`, `null`, `""` or `false` all configure no exclusion — + * standing down for any of them leaves build output blocking the gate while + * cladding believes the project has it handled. * - * A file we cannot parse (rc also accepts ini) returns true: we do not guess - * against a user's config, and standing down only restores the prior behavior. + * So the test is the EFFECTIVE value, read the way rc reads the file: JSON + * first, ini second. Only an unreadable file returns true unconditionally. + */ +function hasEffectiveExclude(value: unknown): boolean { + if (Array.isArray(value)) return value.length > 0; + return typeof value === 'string' && value.trim().length > 0; +} + +/** + * A light `excludeRegExp` probe for the ini form rc also accepts. Deliberately + * narrow — one key, `name = value` or `name[] = value` — because the only + * question is whether a non-empty value is set, and pulling in a full ini + * parser to answer it would be more surface than the answer is worth. */ +const INI_EXCLUDE = /^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m; + +/** True only for an existing regular file — a directory carries no config. */ +function isFile(p: string): boolean { + try { + return statSync(p).isFile(); + } catch { + return false; + } +} + function declaresMadgeExclude(file: string): boolean { let body: string; try { body = readFileSync(file, 'utf8'); } catch { + // Present but unreadable: we cannot tell, so leave the project alone. return true; } try { - return (JSON.parse(body) as {excludeRegExp?: unknown}).excludeRegExp !== undefined; + return hasEffectiveExclude((JSON.parse(body) as {excludeRegExp?: unknown}).excludeRegExp); } catch { - return true; + // Not JSON. rc also reads ini, so look for the key there before concluding + // anything — a file we cannot read as either sets no exclusion, exactly as + // it sets none for madge. + return INI_EXCLUDE.test(body); } } @@ -453,14 +496,25 @@ function declaresMadgeExclude(file: string): boolean { function madgeExclusionInForce(cwd: string, pkg: PackageManifest): boolean { // `package.json#madge` is read from cwd only (madge/bin/cli.js:63) — no walk. const inline = pkg.madge as {excludeRegExp?: unknown} | undefined; - if (inline && typeof inline === 'object' && inline.excludeRegExp !== undefined) return true; - return madgeConfigPaths(cwd).some((p) => existsSync(p) && declaresMadgeExclude(p)); + if (inline && typeof inline === 'object' && hasEffectiveExclude(inline.excludeRegExp)) return true; + if (envDeclaresMadgeExclude()) return true; + // A path that is a DIRECTORY is not a config: rc's walk stops there and reads + // nothing, so no exclusion is in force and our default should still apply. + return madgeConfigPaths(cwd).some((p) => isFile(p) && declaresMadgeExclude(p)); } -/** Reads package.json once for gate refinement; malformed input declares nothing. */ +/** + * Reads package.json once for gate refinement; malformed input declares nothing. + * + * The BOM strip is not cosmetic: madge reads this file with `require()`, which + * tolerates a byte-order mark, while `JSON.parse` throws on it. Without this, + * a BOM'd manifest made cladding blind to a `madge` block madge itself honours + * — and since madge REPLACES exclusions rather than merging them, cladding + * would then delete the user's rule. + */ function readPackageManifest(cwd: string): PackageManifest { try { - return JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8')) as PackageManifest; + return JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8').replace(/^\uFEFF/, '')) as PackageManifest; } catch { return {}; } diff --git a/tests/changelog/collect.test.ts b/tests/changelog/collect.test.ts index 32e99b49..72bab1b9 100644 --- a/tests/changelog/collect.test.ts +++ b/tests/changelog/collect.test.ts @@ -333,3 +333,63 @@ describe('AC-a2278f11 · every touched spec entry, regardless of status', () => expect(() => collectSpecEntryRevisions(dir, 'no-such-ref')).toThrow(/does not resolve/); }); }); + +describe('AC-a2278f11 · both sides are REVISIONS, not the working tree', () => { + let dir: string; + + function entry(file: string, id: string, status: string, text: string): void { + writeFileSync( + join(dir, 'spec', 'features', file), + [ + `id: ${id}`, + 'slug: thing', + `title: "Entry ${id}"`, + `status: ${status}`, + 'acceptance_criteria:', + ' - id: AC-000001', + ' ears: ubiquitous', + ` text: "${text}"`, + '', + ].join('\n'), + ); + } + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-rev-')); + initRepo(dir); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + specYaml(dir, 1); + entry('thing-aaa001.yaml', 'F-aaa001', 'planned', 'The system shall do the original thing.'); + commitAll(dir, 'baseline'); + git(dir, ['tag', 'v0']); + entry('thing-aaa001.yaml', 'F-aaa001', 'done', 'The system shall do the REVISED thing.'); + commitAll(dir, 'revise and finish'); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('an uncommitted edit cannot hide a rewrite that IS in the range', () => { + const committed = collectSpecEntryRevisions(dir, 'v0'); + expect(committed[0]?.headAcs[0]?.text).toContain('REVISED'); + + // Revert the text in the working tree WITHOUT committing. The range still + // contains the rewrite, so the answer must not move. + entry('thing-aaa001.yaml', 'F-aaa001', 'done', 'The system shall do the original thing.'); + const dirty = collectSpecEntryRevisions(dir, 'v0'); + expect(dirty[0]?.headAcs[0]?.text, 'a dirty tree changed what the range says').toContain('REVISED'); + expect(JSON.stringify(dirty)).toBe(JSON.stringify(committed)); + }); + + test('an uncommitted edit cannot invent a rewrite the range never made', () => { + const committed = collectSpecEntryRevisions(dir, 'v0'); + entry('thing-aaa001.yaml', 'F-aaa001', 'done', 'The system shall do something ELSE entirely.'); + expect(JSON.stringify(collectSpecEntryRevisions(dir, 'v0'))).toBe(JSON.stringify(committed)); + }); + + test('an uncommitted status flip cannot manufacture a done transition', () => { + entry('thing-aaa001.yaml', 'F-aaa001', 'archived', 'The system shall do the REVISED thing.'); + expect(collectSpecEntryRevisions(dir, 'v0')[0]?.statusAfter).toBe('done'); + }); +}); diff --git a/tests/report/ac-delta.test.ts b/tests/report/ac-delta.test.ts index a0c0b683..28d8e405 100644 --- a/tests/report/ac-delta.test.ts +++ b/tests/report/ac-delta.test.ts @@ -155,6 +155,26 @@ describe('AC-c32cbab2 · classifying how each criterion moved', () => { expect(d[0]?.counts).toEqual({new: 0, rewritten: 1, removed: 0, unchanged: 0}); }); + test('a duplicated criterion id does not let the later occurrence hide a rewrite', () => { + // A duplicate is invalid and the strict gate says so — but `clad report` + // gates nothing, so it renders exactly in the window before green, where a + // first-wins join reported "unchanged" while the packet's own spec-changes + // section printed the new text. The packet must not contradict itself. + const d = buildSpecDeltasFor( + [ac('AC-0001', {text: 'first'}), ac('AC-0001', {text: 'second'})], + [ac('AC-0001', {text: 'first'}), ac('AC-0001', {text: 'second REWRITTEN'})], + ); + expect(d[0]?.counts.rewritten).toBe(1); + expect(d[0]?.counts.unchanged).toBe(1); + }); + + test('a surplus duplicate at head is new; a surplus at base is removed', () => { + const added = buildSpecDeltasFor([ac('AC-0001')], [ac('AC-0001'), ac('AC-0001')]); + expect(added[0]?.counts).toMatchObject({new: 1, unchanged: 1}); + const dropped = buildSpecDeltasFor([ac('AC-0001'), ac('AC-0001')], [ac('AC-0001')]); + expect(dropped[0]?.counts).toMatchObject({removed: 1, unchanged: 1}); + }); + test('the status transition rides along with the delta', () => { const d = buildSpecEntryDeltas([entry([], [], {statusBefore: 'planned', statusAfter: 'done'})]); expect(d[0]?.statusBefore).toBe('planned'); diff --git a/tests/stages/toolchain.test.ts b/tests/stages/toolchain.test.ts index b1bd05b2..d302d1f6 100644 --- a/tests/stages/toolchain.test.ts +++ b/tests/stages/toolchain.test.ts @@ -390,7 +390,92 @@ describe('detectToolchain', () => { } }); - test('AC-caa9471d · a config that sets no exclusion does NOT switch the fix off', () => { + test('AC-caa9471d · a config file that puts NO exclusion in force does not switch the fix off', () => { + // The question is not "does a file exist" but "would madge apply an + // exclusion". Every row below exists and sets nothing, so cladding must + // still supply its own — otherwise build-output cycles keep the gate RED + // while cladding believes the project has it covered. + for (const [label, body] of [ + ['empty file', ''], + ['whitespace only', ' \n\t\n'], + ['comment-bearing jsonc', '// no exclusions here\n{}\n'], + ['unparseable garbage', 'not json and not ini {{{'], + ['INI without excludeRegExp', 'detectiveOptions[ts][skipTypeImports] = true\n'], + ['excludeRegExp: []', '{"excludeRegExp": []}'], + ['excludeRegExp: null', '{"excludeRegExp": null}'], + ['excludeRegExp empty string', '{"excludeRegExp": ""}'], + ['excludeRegExp: false', '{"excludeRegExp": false}'], + ] as [string, string][]) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-vacuous-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, '.madgerc'), body); + expect(detectToolchain(own).gates.arch?.args, label).toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + test('AC-554d9436 · a config that DOES set an exclusion still makes cladding stand down', () => { + for (const [label, body] of [ + ['JSON array', '{"excludeRegExp": ["^vendor/"]}'], + ['JSON string', '{"excludeRegExp": "^vendor/"}'], + ['INI array form', 'excludeRegExp[] = ^vendor/\n'], + ['INI scalar form', 'excludeRegExp = ^vendor/\n'], + ] as [string, string][]) { + const own = mkdtempSync(join(tmpdir(), 'clad-madge-inforce-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + writeFileSync(join(own, '.madgerc'), body); + expect(detectToolchain(own).gates.arch?.args, label).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + } + }); + + test('AC-554d9436 · an environment-set exclusion is honoured — it has no file behind it', () => { + // rc folds any madge_* variable into the config, so this is a live rule. + // Missing it is the damaging direction: cladding would send --exclude, + // which REPLACES rather than merges, and the rule would vanish. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-env-')); + const saved = process.env.madge_excludeRegExp; + try { + writeFileSync(join(own, 'package.json'), '{}'); + process.env.madge_excludeRegExp = '^vendor/'; + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + if (saved === undefined) delete process.env.madge_excludeRegExp; + else process.env.madge_excludeRegExp = saved; + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-554d9436 · a BOM in package.json does not hide its madge block', () => { + // madge reads it with require(), which tolerates a BOM; JSON.parse does not. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-bom-')); + try { + writeFileSync(join(own, 'package.json'), '\uFEFF' + JSON.stringify({madge: {excludeRegExp: ['^vendor/']}})); + expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-caa9471d · a .madgerc that is a DIRECTORY carries no config', () => { + // rc's walk stops at it and reads nothing, so our default must still apply. + const own = mkdtempSync(join(tmpdir(), 'clad-madge-dir-')); + try { + writeFileSync(join(own, 'package.json'), '{}'); + mkdirSync(join(own, '.madgerc')); + expect(detectToolchain(own).gates.arch?.args).toContain('--exclude'); + } finally { + rmSync(own, {recursive: true, force: true}); + } + }); + + test('AC-caa9471d · legacy: non-madge filenames and empty package blocks still do not switch it off', () => { // These all EXIST but put no excludeRegExp in force, so build output would // keep blocking the gate while cladding believed the project had it covered. for (const [label, write] of [ @@ -412,17 +497,6 @@ describe('detectToolchain', () => { } }); - test('AC-554d9436 · an unparseable .madgerc makes cladding stand down, not guess', () => { - const own = mkdtempSync(join(tmpdir(), 'clad-madge-ini-')); - try { - writeFileSync(join(own, 'package.json'), '{}'); - // rc also accepts ini; we cannot read it reliably, so we must not override. - writeFileSync(join(own, '.madgerc'), 'excludeRegExp[] = ^vendor/\n'); - expect(detectToolchain(own).gates.arch?.args).not.toContain('--exclude'); - } finally { - rmSync(own, {recursive: true, force: true}); - } - }); test('AC-c04171bd · the scan root stays the repository root, never a named directory', () => { // Narrowing the root is worse than the defect: a missing directory makes From 921fec4c81ab127d30ca30209b2e61889652bd10 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Mon, 3 Aug 2026 17:35:44 +0900 Subject: [PATCH 6/8] fix(gate,init): say WHICH files, and ship the rule for writing a criterion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both of these came out of a controlled A/B run, not from reading the code. A FAILING SCANNER NAMED THE KIND OF PROBLEM AND NEVER THE INSTANCE. The architecture stage told a developer "the code has an import loop" and stopped. Three things conspired: the message builder preferred the tool's progress stream over its report stream — madge writes "- Finding files" to one and the numbered cycle list to the other — then cut what survived to 200 characters, and finally the terminal replaced the message wholesale with a canned plain sentence. So the one fact that makes the finding actionable, which files form the loop, could not reach the person who had to fix it. Now both streams survive with the report first, the budget fits a real list, and the terminal prints the specifics indented under the plain sentence rather than instead of it. Verified end to end: a project with three planted cycles now names all three. This is the defect that cost a real adopter sixteen days and left a wrong root cause on their issue log. In the A/B run, three of three agents given the released build "fixed" the gate by deleting or rewriting their own build output — a wrong repair they believed was right, because nothing told them what the gate was actually objecting to. NOTHING SHIPPED TO AN ADOPTER SAID HOW TO WRITE AN ACCEPTANCE CRITERION. `docs/` is not in the published package, so a project that installs cladding receives no statement of the EARS rules its own gate enforces. Two of three agents in the A/B run reverse-engineered them from the minified bundle. The managed AGENTS.md block now carries the table — the trigger word each pattern requires, one working example per row, and where the obligation versus the reasoning belongs. A table that drifts from the validator is worse than no table, so the test extracts every example from the rendered block and asserts it against checkEarsShape. Changing one without the other fails. Mutation-checked: reverting the stream/budget change fails 3 tests, skewing one table row fails 1. One older test pinned the defect ("stderr wins over stdout") and was rewritten to the corrected contract. 2809 tests green, `clad check --tier=pre-push --strict` exits 0. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 13 + README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- plugins/claude-code/dist/clad.js | 596 ++++++++++++++++--------------- spec/attestation.yaml | 20 +- src/cli/clad.ts | 26 +- src/init/agents-md.ts | 17 + src/stages/util.ts | 20 +- tests/init/agents-md.test.ts | 31 ++ tests/stages/util.test.ts | 52 ++- 14 files changed, 473 insertions(+), 326 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e982b8fb..004d9ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,19 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). - **A section lead asserted that the code had been changed to match a rewritten criterion.** The population is deliberately status-blind, so the line also sat above entries with no code yet; it is now conditional. - **A rewritten obligation could pass as unchanged.** The criterion comparison read only the statement, the pattern and the trigger — not `action` and `response`, which state the obligation itself and which four out of five criteria in this project carry. Rewriting one of them classified as no change at all; in this repository's own history that hid 31 rewrites. - **An instruction the schema rejects.** The `planner` brief asked for an `archive_reason` on a removed acceptance criterion, but that field exists only at feature level and the criterion schema refuses unknown keys — following the instruction failed the sync barrier. +- **A failing scanner said what KIND of problem it found, never which one.** The architecture + stage reported "the code has an import loop" and stopped there, because the code that builds + the message preferred the tool's progress output over its report — madge writes its progress + to one stream and the numbered cycle list to the other — and then cut what survived to two + hundred characters. The gate now shows the list, and the terminal prints the specifics under + the plain sentence instead of replacing them with it. An adopter spent sixteen days on this + and recorded the wrong cause; in a controlled run, three of three agents given the old build + "fixed" it by deleting or rewriting their own build output. +- **Nothing shipped to an adopter said how to write an acceptance criterion.** The managed + AGENTS.md block now carries the EARS table — which trigger word each pattern requires, with a + working example per row — and a test asserts every example in it against the real validator, + so the table cannot drift from the rule it teaches. `docs/` is not in the published package, + so agents were reverse-engineering the rules from the minified bundle. - **Stale and self-contradicting counts across the six READMEs**, where feature and test-file totals disagreed with the spec and, in places, with each other inside the same file. ## [0.9.2] — Completions record whether anything checked them independently (2026-07-26) diff --git a/README.html b/README.html index 6a40024d..76b58930 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2803/2803
+
2809/2809
all pass
diff --git a/README.ja.md b/README.ja.md index 8105e04e..d555cd28 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 | 15 段階 · 41 detectors | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 | 15 段階 · 41 detectors | 273(269 done) | 249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 4654965f..6254e53d 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2803/2803
+
2809/2809
all pass
diff --git a/README.ko.md b/README.ko.md index dabe65ff..b197ee18 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | 249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 4f594f95..ea72e520 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 | 15 stages · 41 detectors | 273 (269 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 | 15 stages · 41 detectors | 273 (269 done) | 249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 6d726a08..5acca3d8 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2803 / 2803 | 15 阶段 · 41 检测器 | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 | 15 阶段 · 41 检测器 | 273(269 done) | 249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 079ee28b..347d1d24 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -5,50 +5,50 @@ const require = __claddingCreateRequire(import.meta.url); // short-circuits so the bundle doesn't fire every stage at startup. globalThis.__CLADDING_BUNDLED = true; var Yde=Object.create;var PA=Object.defineProperty;var Xde=Object.getOwnPropertyDescriptor;var Qde=Object.getOwnPropertyNames;var efe=Object.getPrototypeOf,tfe=Object.prototype.hasOwnProperty;var Ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dr=(t,e)=>{for(var r in e)PA(t,r,{get:e[r],enumerable:!0})},rfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qde(e))!tfe.call(t,i)&&i!==r&&PA(t,i,{get:()=>e[i],enumerable:!(n=Xde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Yde(efe(t)):{},rfe(e||!t||!t.__esModule?PA(r,"default",{value:t,enumerable:!0}):r,t));var lf=v(DA=>{var ky=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},CA=class extends ky{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};DA.CommanderError=ky;DA.InvalidArgumentError=CA});var Ey=v(jA=>{var{InvalidArgumentError:nfe}=lf(),NA=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new nfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ife(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}jA.Argument=NA;jA.humanReadableArgName=ife});var LA=v(FA=>{var{humanReadableArgName:ofe}=Ey(),MA=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),o=n.long&&e._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>ofe(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let p=d.map(m=>o(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let p=d.map(m=>o(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(f,p,r))}),s.join(` -`)}displayWidth(e){return y4(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return ur==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,d;return u{let a=s.match(i);if(a===null){o.push("");return}let c=[a.shift()],l=this.displayWidth(c[0]);a.forEach(u=>{let d=this.displayWidth(u);if(l+d<=r){c.push(u),l+=d;return}o.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),o.push(c.join(""))}),o.join(` -`)}};function y4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}FA.Help=MA;FA.stripColor=y4});var BA=v(qA=>{var{InvalidArgumentError:sfe}=lf(),zA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=afe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new sfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?_4(this.name().replace(/^no-/,"")):_4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},UA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function _4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function afe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} +`)}};function _4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}FA.Help=MA;FA.stripColor=_4});var BA=v(qA=>{var{InvalidArgumentError:sfe}=lf(),zA=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=afe(e);this.short=n.shortFlag,this.long=n.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(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new sfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?b4(this.name().replace(/^no-/,"")):b4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},UA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function b4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function afe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,o=t.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(r=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a} - a short flag is a single dash and a single character - either use a single dash and a single character (for a short flag) - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}qA.Option=zA;qA.DualOptions=UA});var v4=v(b4=>{function cfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function lfe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=cfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}qA.Option=zA;qA.DualOptions=UA});var S4=v(v4=>{function cfe(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=t.length;i++){let o=1;t[i-1]===e[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&t[i-1]===e[n-2]&&t[i-2]===e[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[t.length][e.length]}function lfe(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=cfe(t,s),c=Math.max(t.length,s.length);(c-a)/c>o&&(as.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}b4.suggestSimilar=lfe});var $4=v(WA=>{var ufe=Ge("node:events").EventEmitter,HA=Ge("node:child_process"),po=Ge("node:path"),Ay=Ge("node:fs"),Be=Ge("node:process"),{Argument:dfe,humanReadableArgName:ffe}=Ey(),{CommanderError:GA}=lf(),{Help:pfe,stripColor:mfe}=LA(),{Option:S4,DualOptions:hfe}=BA(),{suggestSimilar:w4}=v4(),ZA=class t extends ufe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>VA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>VA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>mfe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new pfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name +(Did you mean ${n[0]}?)`:""}v4.suggestSimilar=lfe});var k4=v(WA=>{var ufe=Ge("node:events").EventEmitter,HA=Ge("node:child_process"),po=Ge("node:path"),Ay=Ge("node:fs"),Be=Ge("node:process"),{Argument:dfe,humanReadableArgName:ffe}=Ey(),{CommanderError:GA}=lf(),{Help:pfe,stripColor:mfe}=LA(),{Option:w4,DualOptions:hfe}=BA(),{suggestSimilar:x4}=S4(),ZA=class t extends ufe{constructor(e){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=e||"",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:r=>Be.stdout.write(r),writeErr:r=>Be.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Be.stdout.isTTY?Be.stdout.columns:void 0,getErrHelpWidth:()=>Be.stderr.isTTY?Be.stderr.columns:void 0,getOutHasColors:()=>VA()??(Be.stdout.isTTY&&Be.stdout.hasColors?.()),getErrHasColors:()=>VA()??(Be.stderr.isTTY&&Be.stderr.hasColors?.()),stripColor:r=>mfe(r)},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(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return i&&(c.description(i),c._executableHandler=!0),o.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),i?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new pfe,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new dfe(e,r)}argument(e,r,n,i){let o=this.createArgument(e,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'. -Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new GA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new S4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' -- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof S4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. +Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new GA(e,r,n)),Be.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new w4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' +- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof w4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){Be.versions?.electron&&(r.from="electron");let i=Be.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Be.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":Be.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true. - 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(e,r,n){if(Ay.existsSync(e))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=po.resolve(u,d);if(Ay.existsSync(f))return f;if(i.includes(po.extname(d)))return;let p=i.find(m=>Ay.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=po.resolve(po.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=po.basename(this._scriptPath,po.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(po.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=x4(Be.execArgv).concat(r),c=HA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=HA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=x4(Be.execArgv).concat(r),c=HA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new GA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new GA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} + - ${i}`;throw new Error(o)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(u,d){let f=po.resolve(u,d);if(Ay.existsSync(f))return f;if(i.includes(po.extname(d)))return;let p=i.find(m=>Ay.existsSync(`${f}${m}`));if(p)return`${f}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=po.resolve(po.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=po.basename(this._scriptPath,po.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(po.extname(s));let c;Be.platform!=="win32"?n?(r.unshift(s),r=$4(Be.execArgv).concat(r),c=HA.spawn(Be.argv[0],r,{stdio:"inherit"})):c=HA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=$4(Be.execArgv).concat(r),c=HA.spawn(Be.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Be.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;c.on("close",u=>{u=u??1,l?l(new GA(u,"commander.executeSubCommandAsync","(close)")):Be.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!l)Be.exit(1);else{let d=new GA(1,"commander.executeSubCommandAsync","(error)");d.nestedError=u,l(d)}}),this.runningCommand=c}_dispatchSubcommand(e,r,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?ie(n,a,s),n.defaultValue))):o===void 0&&(o=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function o(u){return u.length>1&&u[0]==="-"}let s=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,c=null,l=0;for(;l2&&u[0]==="-"&&u[1]!=="-"){let d=this._findOption(`-${u[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,u.slice(2)):(this.emit(`option:${d.name()}`),c=`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let d=u.indexOf("="),f=this._findOption(u.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(d+1));continue}}if(i===r&&o(u)&&!(this.commands.length===0&&s(u))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(u)){r.push(u),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u,...e.slice(l));break}else if(this._defaultCommandName){n.push(u,...e.slice(l));break}}if(this._passThroughOptions){i.push(u,...e.slice(l));break}i.push(u)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;nObject.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` -`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=w4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=w4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Be.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Be.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new hfe(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),u=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&c===!1||l.presetArg!==void 0&&c===l.presetArg)?l:u||s},i=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=x4(e,i)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=x4(e,i)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e} `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>ffe(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=po.basename(e,po.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let r=!!e.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(Be.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s} -`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function x4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function VA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}WA.Command=ZA;WA.useColor=VA});var T4=v(Tn=>{var{Argument:k4}=Ey(),{Command:KA}=$4(),{CommanderError:gfe,InvalidArgumentError:E4}=lf(),{Help:yfe}=LA(),{Option:A4}=BA();Tn.program=new KA;Tn.createCommand=t=>new KA(t);Tn.createOption=(t,e)=>new A4(t,e);Tn.createArgument=(t,e)=>new k4(t,e);Tn.Command=KA;Tn.Option=A4;Tn.Argument=k4;Tn.Help=yfe;Tn.CommanderError=gfe;Tn.InvalidArgumentError=E4;Tn.InvalidOptionArgumentError=E4});var De=v(Qt=>{"use strict";var YA=Symbol.for("yaml.alias"),P4=Symbol.for("yaml.document"),Ty=Symbol.for("yaml.map"),C4=Symbol.for("yaml.pair"),XA=Symbol.for("yaml.scalar"),Oy=Symbol.for("yaml.seq"),mo=Symbol.for("yaml.node.type"),xfe=t=>!!t&&typeof t=="object"&&t[mo]===YA,$fe=t=>!!t&&typeof t=="object"&&t[mo]===P4,kfe=t=>!!t&&typeof t=="object"&&t[mo]===Ty,Efe=t=>!!t&&typeof t=="object"&&t[mo]===C4,D4=t=>!!t&&typeof t=="object"&&t[mo]===XA,Afe=t=>!!t&&typeof t=="object"&&t[mo]===Oy;function N4(t){if(t&&typeof t=="object")switch(t[mo]){case Ty:case Oy:return!0}return!1}function Tfe(t){if(t&&typeof t=="object")switch(t[mo]){case YA:case Ty:case XA:case Oy:return!0}return!1}var Ofe=t=>(D4(t)||N4(t))&&!!t.anchor;Qt.ALIAS=YA;Qt.DOC=P4;Qt.MAP=Ty;Qt.NODE_TYPE=mo;Qt.PAIR=C4;Qt.SCALAR=XA;Qt.SEQ=Oy;Qt.hasAnchor=Ofe;Qt.isAlias=xfe;Qt.isCollection=N4;Qt.isDocument=$fe;Qt.isMap=kfe;Qt.isNode=Tfe;Qt.isPair=Efe;Qt.isScalar=D4;Qt.isSeq=Afe});var uf=v(QA=>{"use strict";var Ut=De(),Nr=Symbol("break visit"),j4=Symbol("skip children"),Ti=Symbol("remove node");function Ry(t,e){let r=M4(e);Ut.isDocument(t)?el(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):el(null,t,r,Object.freeze([]))}Ry.BREAK=Nr;Ry.SKIP=j4;Ry.REMOVE=Ti;function el(t,e,r,n){let i=F4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return L4(t,n,i),el(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var z4=De(),Rfe=uf(),Ife={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pfe=t=>t.replace(/[!,[\]{}]/g,e=>Ife[e]),df=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Pfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&z4.isNode(e.contents)){let o={};Rfe.visit(e.contents,(s,a)=>{z4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` -`)}};df.defaultYaml={explicit:!1,version:"1.2"};df.defaultTags={"!!":"tag:yaml.org,2002:"};U4.Directives=df});var Py=v(ff=>{"use strict";var q4=De(),Cfe=uf();function Dfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function B4(t){let e=new Set;return Cfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function H4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Nfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=B4(t));let s=H4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(q4.isScalar(s.node)||q4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}ff.anchorIsValid=Dfe;ff.anchorNames=B4;ff.createNodeAnchors=Nfe;ff.findNewAnchor=H4});var tT=v(G4=>{"use strict";function pf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var jfe=De();function Z4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Z4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!jfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}V4.toJS=Z4});var Cy=v(K4=>{"use strict";var Mfe=tT(),W4=De(),Ffe=Vo(),rT=class{constructor(e){Object.defineProperty(this,W4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!W4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Ffe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Mfe.applyReviver(o,{"":a},"",a):a}};K4.NodeBase=rT});var mf=v(J4=>{"use strict";var Lfe=Py(),zfe=uf(),rl=De(),Ufe=Cy(),qfe=Vo(),nT=class extends Ufe.NodeBase{constructor(e){super(rl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],zfe.visit(e,{Node:(o,s)=>{(rl.isAlias(s)||rl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(qfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Dy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Lfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Dy(t,e,r){if(rl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(rl.isCollection(e)){let n=0;for(let i of e.items){let o=Dy(t,i,r);o>n&&(n=o)}return n}else if(rl.isPair(e)){let n=Dy(t,e.key,r),i=Dy(t,e.value,r);return Math.max(n,i)}return 1}J4.Alias=nT});var Dt=v(iT=>{"use strict";var Bfe=De(),Hfe=Cy(),Gfe=Vo(),Zfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends Hfe.NodeBase{constructor(e){super(Bfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Gfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";iT.Scalar=Wo;iT.isScalarValue=Zfe});var hf=v(X4=>{"use strict";var Vfe=mf(),fa=De(),Y4=Dt(),Wfe="tag:yaml.org,2002:";function Kfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Jfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Vfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Wfe+e.slice(2));let l=Kfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Y4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Y4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}X4.createNode=Jfe});var jy=v(Ny=>{"use strict";var Yfe=hf(),Oi=De(),Xfe=Cy();function oT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Yfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Q4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,sT=class extends Xfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Q4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ny.Collection=sT;Ny.collectionFromPath=oT;Ny.isEmptyPath=Q4});var gf=v(My=>{"use strict";var Qfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function aT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var epe=(t,e,r)=>t.endsWith(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function $4(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function VA(){if(Be.env.NO_COLOR||Be.env.FORCE_COLOR==="0"||Be.env.FORCE_COLOR==="false")return!1;if(Be.env.FORCE_COLOR||Be.env.CLICOLOR_FORCE!==void 0)return!0}WA.Command=ZA;WA.useColor=VA});var O4=v(Tn=>{var{Argument:E4}=Ey(),{Command:KA}=k4(),{CommanderError:gfe,InvalidArgumentError:A4}=lf(),{Help:yfe}=LA(),{Option:T4}=BA();Tn.program=new KA;Tn.createCommand=t=>new KA(t);Tn.createOption=(t,e)=>new T4(t,e);Tn.createArgument=(t,e)=>new E4(t,e);Tn.Command=KA;Tn.Option=T4;Tn.Argument=E4;Tn.Help=yfe;Tn.CommanderError=gfe;Tn.InvalidArgumentError=A4;Tn.InvalidOptionArgumentError=A4});var De=v(Qt=>{"use strict";var YA=Symbol.for("yaml.alias"),C4=Symbol.for("yaml.document"),Ty=Symbol.for("yaml.map"),D4=Symbol.for("yaml.pair"),XA=Symbol.for("yaml.scalar"),Oy=Symbol.for("yaml.seq"),mo=Symbol.for("yaml.node.type"),xfe=t=>!!t&&typeof t=="object"&&t[mo]===YA,$fe=t=>!!t&&typeof t=="object"&&t[mo]===C4,kfe=t=>!!t&&typeof t=="object"&&t[mo]===Ty,Efe=t=>!!t&&typeof t=="object"&&t[mo]===D4,N4=t=>!!t&&typeof t=="object"&&t[mo]===XA,Afe=t=>!!t&&typeof t=="object"&&t[mo]===Oy;function j4(t){if(t&&typeof t=="object")switch(t[mo]){case Ty:case Oy:return!0}return!1}function Tfe(t){if(t&&typeof t=="object")switch(t[mo]){case YA:case Ty:case XA:case Oy:return!0}return!1}var Ofe=t=>(N4(t)||j4(t))&&!!t.anchor;Qt.ALIAS=YA;Qt.DOC=C4;Qt.MAP=Ty;Qt.NODE_TYPE=mo;Qt.PAIR=D4;Qt.SCALAR=XA;Qt.SEQ=Oy;Qt.hasAnchor=Ofe;Qt.isAlias=xfe;Qt.isCollection=j4;Qt.isDocument=$fe;Qt.isMap=kfe;Qt.isNode=Tfe;Qt.isPair=Efe;Qt.isScalar=N4;Qt.isSeq=Afe});var uf=v(QA=>{"use strict";var Ut=De(),Nr=Symbol("break visit"),M4=Symbol("skip children"),Ti=Symbol("remove node");function Ry(t,e){let r=F4(e);Ut.isDocument(t)?tl(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):tl(null,t,r,Object.freeze([]))}Ry.BREAK=Nr;Ry.SKIP=M4;Ry.REMOVE=Ti;function tl(t,e,r,n){let i=L4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return z4(t,n,i),tl(t,i,r,n);if(typeof i!="symbol"){if(Ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var U4=De(),Rfe=uf(),Ife={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pfe=t=>t.replace(/[!,[\]{}]/g,e=>Ife[e]),df=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Pfe(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&U4.isNode(e.contents)){let o={};Rfe.visit(e.contents,(s,a)=>{U4.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(` +`)}};df.defaultYaml={explicit:!1,version:"1.2"};df.defaultTags={"!!":"tag:yaml.org,2002:"};q4.Directives=df});var Py=v(ff=>{"use strict";var B4=De(),Cfe=uf();function Dfe(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function H4(t){let e=new Set;return Cfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function G4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Nfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=H4(t));let s=G4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(B4.isScalar(s.node)||B4.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}ff.anchorIsValid=Dfe;ff.anchorNames=H4;ff.createNodeAnchors=Nfe;ff.findNewAnchor=G4});var tT=v(Z4=>{"use strict";function pf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var jfe=De();function V4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>V4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!jfe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}W4.toJS=V4});var Cy=v(J4=>{"use strict";var Mfe=tT(),K4=De(),Ffe=Vo(),rT=class{constructor(e){Object.defineProperty(this,K4.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!K4.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Ffe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Mfe.applyReviver(o,{"":a},"",a):a}};J4.NodeBase=rT});var mf=v(Y4=>{"use strict";var Lfe=Py(),zfe=uf(),nl=De(),Ufe=Cy(),qfe=Vo(),nT=class extends Ufe.NodeBase{constructor(e){super(nl.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],zfe.visit(e,{Node:(o,s)=>{(nl.isAlias(s)||nl.hasAnchor(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(s);if(a||(qfe.toJS(s,null,r),a=n.get(s)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Dy(i,s,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(Lfe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Dy(t,e,r){if(nl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(nl.isCollection(e)){let n=0;for(let i of e.items){let o=Dy(t,i,r);o>n&&(n=o)}return n}else if(nl.isPair(e)){let n=Dy(t,e.key,r),i=Dy(t,e.value,r);return Math.max(n,i)}return 1}Y4.Alias=nT});var Dt=v(iT=>{"use strict";var Bfe=De(),Hfe=Cy(),Gfe=Vo(),Zfe=t=>!t||typeof t!="function"&&typeof t!="object",Wo=class extends Hfe.NodeBase{constructor(e){super(Bfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Gfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Wo.BLOCK_FOLDED="BLOCK_FOLDED";Wo.BLOCK_LITERAL="BLOCK_LITERAL";Wo.PLAIN="PLAIN";Wo.QUOTE_DOUBLE="QUOTE_DOUBLE";Wo.QUOTE_SINGLE="QUOTE_SINGLE";iT.Scalar=Wo;iT.isScalarValue=Zfe});var hf=v(Q4=>{"use strict";var Vfe=mf(),fa=De(),X4=Dt(),Wfe="tag:yaml.org,2002:";function Kfe(t,e,r){if(e){let n=r.filter(o=>o.tag===e),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function Jfe(t,e,r){if(fa.isDocument(t)&&(t=t.contents),fa.isNode(t))return t;if(fa.isPair(t)){let d=r.schema[fa.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new Vfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Wfe+e.slice(2));let l=Kfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new X4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[fa.MAP]:Symbol.iterator in Object(t)?s[fa.SEQ]:s[fa.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new X4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Q4.createNode=Jfe});var jy=v(Ny=>{"use strict";var Yfe=hf(),Oi=De(),Xfe=Cy();function oT(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return Yfe.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var e6=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,sT=class extends Xfe.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Oi.isNode(n)||Oi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(e6(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Oi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(Oi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,o=this.get(n,!0);return i.length===0?!r&&Oi.isScalar(o)?o.value:o:Oi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Oi.isPair(r))return!1;let n=r.value;return n==null||e&&Oi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return Oi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Oi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,oT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ny.Collection=sT;Ny.collectionFromPath=oT;Ny.isEmptyPath=e6});var gf=v(My=>{"use strict";var Qfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function aT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var epe=(t,e,r)=>t.endsWith(` `)?aT(r,e):r.includes(` `)?` -`+aT(r,e):(t.endsWith(" ")?"":" ")+r;My.indentComment=aT;My.lineComment=epe;My.stringifyComment=Qfe});var t6=v(yf=>{"use strict";var tpe="flow",cT="block",Fy="quoted";function rpe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===cT&&(h=e6(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Fy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` -`)r===cT&&(h=e6(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+aT(r,e):(t.endsWith(" ")?"":" ")+r;My.indentComment=aT;My.lineComment=epe;My.stringifyComment=Qfe});var r6=v(yf=>{"use strict";var tpe="flow",cT="block",Fy="quoted";function rpe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,o)?l.push(0):d=i-n);let f,p,m=!1,h=-1,g=-1,b=-1;r===cT&&(h=t6(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Fy&&S==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(S===` +`)r===cT&&(h=t6(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` `&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==` `&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Fy){for(;p===" "||p===" ";)p=S,S=t[h+=1],m=!0;let x=h>b+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=S}if(m&&a&&a(),l.length===0)return t;s&&s();let _=t.slice(0,l[0]);for(let S=0;S{"use strict";var Yn=Dt(),Ko=t6(),zy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Uy=t=>/^(%|---|\.\.\.)/m.test(t);function npe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;o{"use strict";var Yn=Dt(),Ko=r6(),zy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Uy=t=>/^(%|---|\.\.\.)/m.test(t);function npe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let o=0,s=0;on)return!0;if(s=o+1,i-s<=n)return!1}return!0}function _f(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Uy(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length `;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==` `&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(` @@ -58,12 +58,12 @@ ${r}`)+"'";return e.implicitKey?n:Ko.foldFlowLines(n,r,Ko.FOLD_FLOW,zy(e,!1))}fu $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=zy(n,!0);s!=="folded"&&e!==Yn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Ko.foldFlowLines(`${_}${w}${p}`,l,Ko.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function ipe(t,e,r,n){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(` -`)||u&&/[[\]{},]/.test(o))return nl(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?nl(o,e):Ly(t,e,r,n);if(!a&&!u&&i!==Yn.Scalar.PLAIN&&o.includes(` -`))return Ly(t,e,r,n);if(Uy(o)){if(c==="")return e.forceBlockIndent=!0,Ly(t,e,r,n);if(a&&c===l)return nl(o,e)}let d=o.replace(/\n+/g,`$& -${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return nl(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,zy(e,!1))}function ope(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Yn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Yn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Yn.Scalar.BLOCK_FOLDED:case Yn.Scalar.BLOCK_LITERAL:return i||o?nl(s.value,e):Ly(s,e,r,n);case Yn.Scalar.QUOTE_DOUBLE:return _f(s.value,e);case Yn.Scalar.QUOTE_SINGLE:return lT(s.value,e);case Yn.Scalar.PLAIN:return ipe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}r6.stringifyString=ope});var vf=v(dT=>{"use strict";var spe=Py(),Jo=De(),ape=gf(),cpe=bf();function lpe(t,e){let r=Object.assign({blockQuote:!0,commentString:ape.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function upe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function dpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&spe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function fpe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=upe(e.doc.schema.tags,o));let s=dpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?cpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}dT.createStringifyContext=lpe;dT.stringify=fpe});var s6=v(o6=>{"use strict";var ho=De(),n6=Dt(),i6=vf(),Sf=gf();function ppe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=ho.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ho.isCollection(t)||!ho.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||ho.isCollection(t)||(ho.isScalar(t)?t.type===n6.Scalar.BLOCK_FOLDED||t.type===n6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=i6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=Sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Sf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=Sf.lineComment(g,r.indent,l(f))));let b,_,S;ho.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&ho.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ho.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=i6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +`)||u&&/[[\]{},]/.test(o))return il(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?il(o,e):Ly(t,e,r,n);if(!a&&!u&&i!==Yn.Scalar.PLAIN&&o.includes(` +`))return Ly(t,e,r,n);if(Uy(o)){if(c==="")return e.forceBlockIndent=!0,Ly(t,e,r,n);if(a&&c===l)return il(o,e)}let d=o.replace(/\n+/g,`$& +${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return il(o,e)}return a?d:Ko.foldFlowLines(d,c,Ko.FOLD_FLOW,zy(e,!1))}function ope(t,e,r,n){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Yn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Yn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Yn.Scalar.BLOCK_FOLDED:case Yn.Scalar.BLOCK_LITERAL:return i||o?il(s.value,e):Ly(s,e,r,n);case Yn.Scalar.QUOTE_DOUBLE:return _f(s.value,e);case Yn.Scalar.QUOTE_SINGLE:return lT(s.value,e);case Yn.Scalar.PLAIN:return ipe(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}n6.stringifyString=ope});var vf=v(dT=>{"use strict";var spe=Py(),Jo=De(),ape=gf(),cpe=bf();function lpe(t,e){let r=Object.assign({blockQuote:!0,commentString:ape.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function upe(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let r,n;if(Jo.isScalar(e)){n=e.value;let i=t.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function dpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Jo.isScalar(t)||Jo.isCollection(t))&&t.anchor;o&&spe.anchorIsValid(o)&&(r.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function fpe(t,e,r,n){if(Jo.isPair(t))return t.toString(e,r,n);if(Jo.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=Jo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=upe(e.doc.schema.tags,o));let s=dpe(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,r,n):Jo.isScalar(o)?cpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Jo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}dT.createStringifyContext=lpe;dT.stringify=fpe});var a6=v(s6=>{"use strict";var ho=De(),i6=Dt(),o6=vf(),Sf=gf();function ppe({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=ho.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ho.isCollection(t)||!ho.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||ho.isCollection(t)||(ho.isScalar(t)?t.type===i6.Scalar.BLOCK_FOLDED||t.type===i6.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=o6.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=Sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Sf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=Sf.lineComment(g,r.indent,l(f))));let b,_,S;ho.isNode(e)?(b=!!e.spaceBefore,_=e.commentBefore,S=e.comment):(b=!1,_=null,S=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!f&&ho.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ho.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=o6.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` ${Sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` @@ -72,32 +72,32 @@ ${Sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` ${r.indent}`}else if(!p&&ho.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let re=!1;if(D&&(T==="&"||T==="!")){let K=w.indexOf(" ");T==="&"&&K!==-1&&K{"use strict";var a6=Ge("process");function mpe(t,...e){t==="debug"&&console.log(...e)}function hpe(t,e){(t==="debug"||t==="warn")&&(typeof a6.emitWarning=="function"?a6.emitWarning(e):console.warn(e))}fT.debug=mpe;fT.warn=hpe});var Zy=v(Gy=>{"use strict";var Hy=De(),c6=Dt(),qy="<<",By={identify:t=>t===qy||typeof t=="symbol"&&t.description===qy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c6.Scalar(Symbol(qy)),{addToJSMap:l6}),stringify:()=>qy},gpe=(t,e)=>(By.identify(e)||Hy.isScalar(e)&&(!e.type||e.type===c6.Scalar.PLAIN)&&By.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===By.tag&&r.default);function l6(t,e,r){let n=u6(t,r);if(Hy.isSeq(n))for(let i of n.items)mT(t,e,i);else if(Array.isArray(n))for(let i of n)mT(t,e,i);else mT(t,e,n)}function mT(t,e,r){let n=u6(t,r);if(!Hy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function u6(t,e){return t&&Hy.isAlias(e)?e.resolve(t.doc,t):e}Gy.addMergeToJSMap=l6;Gy.isMergeKey=gpe;Gy.merge=By});var gT=v(p6=>{"use strict";var ype=pT(),d6=Zy(),_pe=vf(),f6=De(),hT=Vo();function bpe(t,e,{key:r,value:n}){if(f6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(d6.isMergeKey(t,r))d6.addMergeToJSMap(t,e,n);else{let i=hT.toJS(r,"",t);if(e instanceof Map)e.set(i,hT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=vpe(r,i,t),s=hT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function vpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(f6.isNode(t)&&r?.doc){let n=_pe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),ype.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}p6.addPairToJSMap=bpe});var Yo=v(yT=>{"use strict";var m6=hf(),Spe=s6(),wpe=gT(),Vy=De();function xpe(t,e,r){let n=m6.createNode(t,void 0,r),i=m6.createNode(e,void 0,r);return new Wy(n,i)}var Wy=class t{constructor(e,r=null){Object.defineProperty(this,Vy.NODE_TYPE,{value:Vy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Vy.isNode(r)&&(r=r.clone(e)),Vy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return wpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Spe.stringifyPair(this,e,r,n):JSON.stringify(this)}};yT.Pair=Wy;yT.createPair=xpe});var _T=v(g6=>{"use strict";var pa=De(),h6=vf(),Ky=gf();function $pe(t,e,r){return(e.inFlow??t.flow?Epe:kpe)(t,e,r)}function kpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Ky.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m{"use strict";var c6=Ge("process");function mpe(t,...e){t==="debug"&&console.log(...e)}function hpe(t,e){(t==="debug"||t==="warn")&&(typeof c6.emitWarning=="function"?c6.emitWarning(e):console.warn(e))}fT.debug=mpe;fT.warn=hpe});var Zy=v(Gy=>{"use strict";var Hy=De(),l6=Dt(),qy="<<",By={identify:t=>t===qy||typeof t=="symbol"&&t.description===qy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new l6.Scalar(Symbol(qy)),{addToJSMap:u6}),stringify:()=>qy},gpe=(t,e)=>(By.identify(e)||Hy.isScalar(e)&&(!e.type||e.type===l6.Scalar.PLAIN)&&By.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===By.tag&&r.default);function u6(t,e,r){let n=d6(t,r);if(Hy.isSeq(n))for(let i of n.items)mT(t,e,i);else if(Array.isArray(n))for(let i of n)mT(t,e,i);else mT(t,e,n)}function mT(t,e,r){let n=d6(t,r);if(!Hy.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function d6(t,e){return t&&Hy.isAlias(e)?e.resolve(t.doc,t):e}Gy.addMergeToJSMap=u6;Gy.isMergeKey=gpe;Gy.merge=By});var gT=v(m6=>{"use strict";var ype=pT(),f6=Zy(),_pe=vf(),p6=De(),hT=Vo();function bpe(t,e,{key:r,value:n}){if(p6.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(f6.isMergeKey(t,r))f6.addMergeToJSMap(t,e,n);else{let i=hT.toJS(r,"",t);if(e instanceof Map)e.set(i,hT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=vpe(r,i,t),s=hT.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function vpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(p6.isNode(t)&&r?.doc){let n=_pe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),ype.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}m6.addPairToJSMap=bpe});var Yo=v(yT=>{"use strict";var h6=hf(),Spe=a6(),wpe=gT(),Vy=De();function xpe(t,e,r){let n=h6.createNode(t,void 0,r),i=h6.createNode(e,void 0,r);return new Wy(n,i)}var Wy=class t{constructor(e,r=null){Object.defineProperty(this,Vy.NODE_TYPE,{value:Vy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Vy.isNode(r)&&(r=r.clone(e)),Vy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return wpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Spe.stringifyPair(this,e,r,n):JSON.stringify(this)}};yT.Pair=Wy;yT.createPair=xpe});var _T=v(y6=>{"use strict";var pa=De(),g6=vf(),Ky=gf();function $pe(t,e,r){return(e.inFlow??t.flow?Epe:kpe)(t,e,r)}function kpe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;mg=null,()=>d=!0);g&&(b+=Ky.lineComment(b,o,l(g))),d&&g&&(d=!1),f.push(n+b)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;mg=null);l||(l=d.length>u||b.includes(` +`+Ky.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Epe({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;mg=null);l||(l=d.length>u||b.includes(` `)),m0&&(l||(l=d.reduce((_,S)=>_+S.length+2,2)+(b.length+2)>e.options.lineWidth)),l&&(b+=",")),g&&(b+=Ky.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` ${o}${i}${h}`:` `;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Jy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ky.indentComment(e(n),t);r.push(o.trimStart())}}g6.stringifyCollection=$pe});var Qo=v(vT=>{"use strict";var Ape=_T(),Tpe=gT(),Ope=jy(),Xo=De(),Yy=Yo(),Rpe=Dt();function wf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var bT=class extends Ope.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Yy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yy.Pair(e,e?.value):n=new Yy.Pair(e.key,e.value);let i=wf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Rpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=wf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=wf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!wf(this.items,e)}set(e,r){this.add(new Yy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Tpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ape.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};vT.YAMLMap=bT;vT.findPair=wf});var il=v(_6=>{"use strict";var Ipe=De(),y6=Qo(),Ppe={collection:"map",default:!0,nodeClass:y6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ipe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>y6.YAMLMap.from(t,e,r)};_6.map=Ppe});var es=v(b6=>{"use strict";var Cpe=hf(),Dpe=_T(),Npe=jy(),Qy=De(),jpe=Dt(),Mpe=Vo(),ST=class extends Npe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Xy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Xy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Qy.isScalar(i)?i.value:i}has(e){let r=Xy(e);return typeof r=="number"&&r=0?e:null}b6.YAMLSeq=ST});var ol=v(S6=>{"use strict";var Fpe=De(),v6=es(),Lpe={collection:"seq",default:!0,nodeClass:v6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Fpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>v6.YAMLSeq.from(t,e,r)};S6.seq=Lpe});var xf=v(w6=>{"use strict";var zpe=bf(),Upe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),zpe.stringifyString(t,e,r,n)}};w6.string=Upe});var e_=v(k6=>{"use strict";var x6=Dt(),$6={identify:t=>t==null,createNode:()=>new x6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new x6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&$6.test.test(t)?t:e.options.nullStr};k6.nullTag=$6});var wT=v(A6=>{"use strict";var qpe=Dt(),E6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new qpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&E6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};A6.boolTag=E6});var sl=v(T6=>{"use strict";function Bpe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}T6.stringifyNumber=Bpe});var $T=v(t_=>{"use strict";var Hpe=Dt(),xT=sl(),Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xT.stringifyNumber},Zpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():xT.stringifyNumber(t)}},Vpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Hpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:xT.stringifyNumber};t_.float=Vpe;t_.floatExp=Zpe;t_.floatNaN=Gpe});var ET=v(n_=>{"use strict";var O6=sl(),r_=t=>typeof t=="bigint"||Number.isInteger(t),kT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R6(t,e,r){let{value:n}=t;return r_(n)&&n>=0?r+n.toString(e):O6.stringifyNumber(t)}var Wpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>kT(t,2,8,r),stringify:t=>R6(t,8,"0o")},Kpe={identify:r_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>kT(t,0,10,r),stringify:O6.stringifyNumber},Jpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>kT(t,2,16,r),stringify:t=>R6(t,16,"0x")};n_.int=Kpe;n_.intHex=Jpe;n_.intOct=Wpe});var P6=v(I6=>{"use strict";var Ype=il(),Xpe=e_(),Qpe=ol(),eme=xf(),tme=wT(),AT=$T(),TT=ET(),rme=[Ype.map,Qpe.seq,eme.string,Xpe.nullTag,tme.boolTag,TT.intOct,TT.int,TT.intHex,AT.floatNaN,AT.floatExp,AT.float];I6.schema=rme});var N6=v(D6=>{"use strict";var nme=Dt(),ime=il(),ome=ol();function C6(t){return typeof t=="bigint"||Number.isInteger(t)}var i_=({value:t})=>JSON.stringify(t),sme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:i_},{identify:t=>t==null,createNode:()=>new nme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:i_},{identify:C6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>C6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:i_}],ame={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},cme=[ime.map,ome.seq].concat(sme,ame);D6.schema=cme});var RT=v(j6=>{"use strict";var $f=Ge("buffer"),OT=Dt(),lme=bf(),ume={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $f.Buffer=="function")return $f.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var o_=De(),IT=Yo(),dme=Dt(),fme=es();function M6(t,e){if(o_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new IT.Pair(new dme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Jy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ky.indentComment(e(n),t);r.push(o.trimStart())}}y6.stringifyCollection=$pe});var Qo=v(vT=>{"use strict";var Ape=_T(),Tpe=gT(),Ope=jy(),Xo=De(),Yy=Yo(),Rpe=Dt();function wf(t,e){let r=Xo.isScalar(e)?e.value:e;for(let n of t)if(Xo.isPair(n)&&(n.key===e||n.key===r||Xo.isScalar(n.key)&&n.key.value===r))return n}var bT=class extends Ope.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Xo.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||i)&&s.items.push(Yy.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,r){let n;Xo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Yy.Pair(e,e?.value):n=new Yy.Pair(e.key,e.value);let i=wf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Xo.isScalar(i.value)&&Rpe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let r=wf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=wf(this.items,e)?.value;return(!r&&Xo.isScalar(i)?i.value:i)??void 0}has(e){return!!wf(this.items,e)}set(e,r){this.add(new Yy.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)Tpe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xo.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ape.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};vT.YAMLMap=bT;vT.findPair=wf});var ol=v(b6=>{"use strict";var Ipe=De(),_6=Qo(),Ppe={collection:"map",default:!0,nodeClass:_6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Ipe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>_6.YAMLMap.from(t,e,r)};b6.map=Ppe});var es=v(v6=>{"use strict";var Cpe=hf(),Dpe=_T(),Npe=jy(),Qy=De(),jpe=Dt(),Mpe=Vo(),ST=class extends Npe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Qy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Xy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Xy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Qy.isScalar(i)?i.value:i}has(e){let r=Xy(e);return typeof r=="number"&&r=0?e:null}v6.YAMLSeq=ST});var sl=v(w6=>{"use strict";var Fpe=De(),S6=es(),Lpe={collection:"seq",default:!0,nodeClass:S6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Fpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>S6.YAMLSeq.from(t,e,r)};w6.seq=Lpe});var xf=v(x6=>{"use strict";var zpe=bf(),Upe={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),zpe.stringifyString(t,e,r,n)}};x6.string=Upe});var e_=v(E6=>{"use strict";var $6=Dt(),k6={identify:t=>t==null,createNode:()=>new $6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new $6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&k6.test.test(t)?t:e.options.nullStr};E6.nullTag=k6});var wT=v(T6=>{"use strict";var qpe=Dt(),A6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new qpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&A6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};T6.boolTag=A6});var al=v(O6=>{"use strict";function Bpe({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}O6.stringifyNumber=Bpe});var $T=v(t_=>{"use strict";var Hpe=Dt(),xT=al(),Gpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xT.stringifyNumber},Zpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():xT.stringifyNumber(t)}},Vpe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Hpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:xT.stringifyNumber};t_.float=Vpe;t_.floatExp=Zpe;t_.floatNaN=Gpe});var ET=v(n_=>{"use strict";var R6=al(),r_=t=>typeof t=="bigint"||Number.isInteger(t),kT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function I6(t,e,r){let{value:n}=t;return r_(n)&&n>=0?r+n.toString(e):R6.stringifyNumber(t)}var Wpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>kT(t,2,8,r),stringify:t=>I6(t,8,"0o")},Kpe={identify:r_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>kT(t,0,10,r),stringify:R6.stringifyNumber},Jpe={identify:t=>r_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>kT(t,2,16,r),stringify:t=>I6(t,16,"0x")};n_.int=Kpe;n_.intHex=Jpe;n_.intOct=Wpe});var C6=v(P6=>{"use strict";var Ype=ol(),Xpe=e_(),Qpe=sl(),eme=xf(),tme=wT(),AT=$T(),TT=ET(),rme=[Ype.map,Qpe.seq,eme.string,Xpe.nullTag,tme.boolTag,TT.intOct,TT.int,TT.intHex,AT.floatNaN,AT.floatExp,AT.float];P6.schema=rme});var j6=v(N6=>{"use strict";var nme=Dt(),ime=ol(),ome=sl();function D6(t){return typeof t=="bigint"||Number.isInteger(t)}var i_=({value:t})=>JSON.stringify(t),sme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:i_},{identify:t=>t==null,createNode:()=>new nme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:i_},{identify:D6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>D6(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:i_}],ame={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},cme=[ime.map,ome.seq].concat(sme,ame);N6.schema=cme});var RT=v(M6=>{"use strict";var $f=Ge("buffer"),OT=Dt(),lme=bf(),ume={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $f.Buffer=="function")return $f.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i{"use strict";var o_=De(),IT=Yo(),dme=Dt(),fme=es();function F6(t,e){if(o_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new IT.Pair(new dme.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} ${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment} -${o.comment}`:n.comment}n=i}t.items[r]=o_.isPair(n)?n:new IT.Pair(n)}}else e("Expected a sequence for this tag");return t}function F6(t,e,r){let{replacer:n}=r,i=new fme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(IT.createPair(a,c,r))}return i}var pme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:M6,createNode:F6};s_.createPairs=F6;s_.pairs=pme;s_.resolvePairs=M6});var DT=v(CT=>{"use strict";var L6=De(),PT=Vo(),kf=Qo(),mme=es(),z6=a_(),ma=class t extends mme.YAMLSeq{constructor(){super(),this.add=kf.YAMLMap.prototype.add.bind(this),this.delete=kf.YAMLMap.prototype.delete.bind(this),this.get=kf.YAMLMap.prototype.get.bind(this),this.has=kf.YAMLMap.prototype.has.bind(this),this.set=kf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(L6.isPair(i)?(o=PT.toJS(i.key,"",r),s=PT.toJS(i.value,o,r)):o=PT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=z6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var hme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=z6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)L6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};CT.YAMLOMap=ma;CT.omap=hme});var G6=v(NT=>{"use strict";var U6=Dt();function q6({value:t,source:e},r){return e&&(t?B6:H6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var B6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new U6.Scalar(!0),stringify:q6},H6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new U6.Scalar(!1),stringify:q6};NT.falseTag=H6;NT.trueTag=B6});var Z6=v(c_=>{"use strict";var gme=Dt(),jT=sl(),yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jT.stringifyNumber},_me={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():jT.stringifyNumber(t)}},bme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new gme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:jT.stringifyNumber};c_.float=bme;c_.floatExp=_me;c_.floatNaN=yme});var W6=v(Af=>{"use strict";var V6=sl(),Ef=t=>typeof t=="bigint"||Number.isInteger(t);function l_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function MT(t,e,r){let{value:n}=t;if(Ef(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return V6.stringifyNumber(t)}var vme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>l_(t,2,2,r),stringify:t=>MT(t,2,"0b")},Sme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>l_(t,1,8,r),stringify:t=>MT(t,8,"0")},wme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>l_(t,0,10,r),stringify:V6.stringifyNumber},xme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>l_(t,2,16,r),stringify:t=>MT(t,16,"0x")};Af.int=wme;Af.intBin=vme;Af.intHex=xme;Af.intOct=Sme});var LT=v(FT=>{"use strict";var f_=De(),u_=Yo(),d_=Qo(),ha=class t extends d_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;f_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new u_.Pair(e.key,null):r=new u_.Pair(e,null),d_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=d_.findPair(this.items,e);return!r&&f_.isPair(n)?f_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=d_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new u_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(u_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var $me={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(f_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};FT.YAMLSet=ha;FT.set=$me});var UT=v(p_=>{"use strict";var kme=sl();function zT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function K6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return kme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Eme={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>zT(t,r),stringify:K6},Ame={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zT(t,!1),stringify:K6},J6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(J6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=zT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};p_.floatTime=Ame;p_.intTime=Eme;p_.timestamp=J6});var Q6=v(X6=>{"use strict";var Tme=il(),Ome=e_(),Rme=ol(),Ime=xf(),Pme=RT(),Y6=G6(),qT=Z6(),m_=W6(),Cme=Zy(),Dme=DT(),Nme=a_(),jme=LT(),BT=UT(),Mme=[Tme.map,Rme.seq,Ime.string,Ome.nullTag,Y6.trueTag,Y6.falseTag,m_.intBin,m_.intOct,m_.int,m_.intHex,qT.floatNaN,qT.floatExp,qT.float,Pme.binary,Cme.merge,Dme.omap,Nme.pairs,jme.set,BT.intTime,BT.floatTime,BT.timestamp];X6.schema=Mme});var lB=v(ZT=>{"use strict";var nB=il(),Fme=e_(),iB=ol(),Lme=xf(),zme=wT(),HT=$T(),GT=ET(),Ume=P6(),qme=N6(),oB=RT(),Tf=Zy(),sB=DT(),aB=a_(),eB=Q6(),cB=LT(),h_=UT(),tB=new Map([["core",Ume.schema],["failsafe",[nB.map,iB.seq,Lme.string]],["json",qme.schema],["yaml11",eB.schema],["yaml-1.1",eB.schema]]),rB={binary:oB.binary,bool:zme.boolTag,float:HT.float,floatExp:HT.floatExp,floatNaN:HT.floatNaN,floatTime:h_.floatTime,int:GT.int,intHex:GT.intHex,intOct:GT.intOct,intTime:h_.intTime,map:nB.map,merge:Tf.merge,null:Fme.nullTag,omap:sB.omap,pairs:aB.pairs,seq:iB.seq,set:cB.set,timestamp:h_.timestamp},Bme={"tag:yaml.org,2002:binary":oB.binary,"tag:yaml.org,2002:merge":Tf.merge,"tag:yaml.org,2002:omap":sB.omap,"tag:yaml.org,2002:pairs":aB.pairs,"tag:yaml.org,2002:set":cB.set,"tag:yaml.org,2002:timestamp":h_.timestamp};function Hme(t,e,r){let n=tB.get(e);if(n&&!t)return r&&!n.includes(Tf.merge)?n.concat(Tf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(tB.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Tf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?rB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(rB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ZT.coreKnownTags=Bme;ZT.getTags=Hme});var KT=v(uB=>{"use strict";var VT=De(),Gme=il(),Zme=ol(),Vme=xf(),g_=lB(),Wme=(t,e)=>t.keye.key?1:0,WT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?g_.getTags(e,"compat"):e?g_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?g_.coreKnownTags:{},this.tags=g_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,VT.MAP,{value:Gme.map}),Object.defineProperty(this,VT.SCALAR,{value:Vme.string}),Object.defineProperty(this,VT.SEQ,{value:Zme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Wme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};uB.Schema=WT});var fB=v(dB=>{"use strict";var Kme=De(),JT=vf(),Of=gf();function Jme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=JT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Of.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Kme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Of.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=JT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Of.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(JT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +${o.comment}`:n.comment}n=i}t.items[r]=o_.isPair(n)?n:new IT.Pair(n)}}else e("Expected a sequence for this tag");return t}function L6(t,e,r){let{replacer:n}=r,i=new fme.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof n=="function"&&(s=n.call(e,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(IT.createPair(a,c,r))}return i}var pme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:F6,createNode:L6};s_.createPairs=L6;s_.pairs=pme;s_.resolvePairs=F6});var DT=v(CT=>{"use strict";var z6=De(),PT=Vo(),kf=Qo(),mme=es(),U6=a_(),ma=class t extends mme.YAMLSeq{constructor(){super(),this.add=kf.YAMLMap.prototype.add.bind(this),this.delete=kf.YAMLMap.prototype.delete.bind(this),this.get=kf.YAMLMap.prototype.get.bind(this),this.has=kf.YAMLMap.prototype.has.bind(this),this.set=kf.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(z6.isPair(i)?(o=PT.toJS(i.key,"",r),s=PT.toJS(i.value,o,r)):o=PT.toJS(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(e,r,n){let i=U6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ma.tag="tag:yaml.org,2002:omap";var hme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=U6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)z6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ma,r)},createNode:(t,e,r)=>ma.from(t,e,r)};CT.YAMLOMap=ma;CT.omap=hme});var Z6=v(NT=>{"use strict";var q6=Dt();function B6({value:t,source:e},r){return e&&(t?H6:G6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var H6={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new q6.Scalar(!0),stringify:B6},G6={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new q6.Scalar(!1),stringify:B6};NT.falseTag=G6;NT.trueTag=H6});var V6=v(c_=>{"use strict";var gme=Dt(),jT=al(),yme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jT.stringifyNumber},_me={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():jT.stringifyNumber(t)}},bme={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new gme.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:jT.stringifyNumber};c_.float=bme;c_.floatExp=_me;c_.floatNaN=yme});var K6=v(Af=>{"use strict";var W6=al(),Ef=t=>typeof t=="bigint"||Number.isInteger(t);function l_(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,r);return i==="-"?-1*o:o}function MT(t,e,r){let{value:n}=t;if(Ef(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return W6.stringifyNumber(t)}var vme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>l_(t,2,2,r),stringify:t=>MT(t,2,"0b")},Sme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>l_(t,1,8,r),stringify:t=>MT(t,8,"0")},wme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>l_(t,0,10,r),stringify:W6.stringifyNumber},xme={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>l_(t,2,16,r),stringify:t=>MT(t,16,"0x")};Af.int=wme;Af.intBin=vme;Af.intHex=xme;Af.intOct=Sme});var LT=v(FT=>{"use strict";var f_=De(),u_=Yo(),d_=Qo(),ha=class t extends d_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;f_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new u_.Pair(e.key,null):r=new u_.Pair(e,null),d_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=d_.findPair(this.items,e);return!r&&f_.isPair(n)?f_.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=d_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new u_.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(u_.createPair(s,null,n));return o}};ha.tag="tag:yaml.org,2002:set";var $me={collection:"map",identify:t=>t instanceof Set,nodeClass:ha,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ha.from(t,e,r),resolve(t,e){if(f_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ha,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};FT.YAMLSet=ha;FT.set=$me});var UT=v(p_=>{"use strict";var kme=al();function zT(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function J6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return kme.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Eme={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>zT(t,r),stringify:J6},Ame={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>zT(t,!1),stringify:J6},Y6={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Y6.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=zT(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};p_.floatTime=Ame;p_.intTime=Eme;p_.timestamp=Y6});var eB=v(Q6=>{"use strict";var Tme=ol(),Ome=e_(),Rme=sl(),Ime=xf(),Pme=RT(),X6=Z6(),qT=V6(),m_=K6(),Cme=Zy(),Dme=DT(),Nme=a_(),jme=LT(),BT=UT(),Mme=[Tme.map,Rme.seq,Ime.string,Ome.nullTag,X6.trueTag,X6.falseTag,m_.intBin,m_.intOct,m_.int,m_.intHex,qT.floatNaN,qT.floatExp,qT.float,Pme.binary,Cme.merge,Dme.omap,Nme.pairs,jme.set,BT.intTime,BT.floatTime,BT.timestamp];Q6.schema=Mme});var uB=v(ZT=>{"use strict";var iB=ol(),Fme=e_(),oB=sl(),Lme=xf(),zme=wT(),HT=$T(),GT=ET(),Ume=C6(),qme=j6(),sB=RT(),Tf=Zy(),aB=DT(),cB=a_(),tB=eB(),lB=LT(),h_=UT(),rB=new Map([["core",Ume.schema],["failsafe",[iB.map,oB.seq,Lme.string]],["json",qme.schema],["yaml11",tB.schema],["yaml-1.1",tB.schema]]),nB={binary:sB.binary,bool:zme.boolTag,float:HT.float,floatExp:HT.floatExp,floatNaN:HT.floatNaN,floatTime:h_.floatTime,int:GT.int,intHex:GT.intHex,intOct:GT.intOct,intTime:h_.intTime,map:iB.map,merge:Tf.merge,null:Fme.nullTag,omap:aB.omap,pairs:cB.pairs,seq:oB.seq,set:lB.set,timestamp:h_.timestamp},Bme={"tag:yaml.org,2002:binary":sB.binary,"tag:yaml.org,2002:merge":Tf.merge,"tag:yaml.org,2002:omap":aB.omap,"tag:yaml.org,2002:pairs":cB.pairs,"tag:yaml.org,2002:set":lB.set,"tag:yaml.org,2002:timestamp":h_.timestamp};function Hme(t,e,r){let n=rB.get(e);if(n&&!t)return r&&!n.includes(Tf.merge)?n.concat(Tf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(rB.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Tf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?nB[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(nB).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}ZT.coreKnownTags=Bme;ZT.getTags=Hme});var KT=v(dB=>{"use strict";var VT=De(),Gme=ol(),Zme=sl(),Vme=xf(),g_=uB(),Wme=(t,e)=>t.keye.key?1:0,WT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?g_.getTags(e,"compat"):e?g_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?g_.coreKnownTags:{},this.tags=g_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,VT.MAP,{value:Gme.map}),Object.defineProperty(this,VT.SCALAR,{value:Vme.string}),Object.defineProperty(this,VT.SEQ,{value:Zme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Wme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};dB.Schema=WT});var pB=v(fB=>{"use strict";var Kme=De(),JT=vf(),Of=gf();function Jme(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=JT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Of.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Kme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Of.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=JT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Of.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(JT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(Of.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Of.indentComment(o(c),"")))}return r.join(` `)+` -`}dB.stringifyDocument=Jme});var Rf=v(pB=>{"use strict";var Yme=mf(),al=jy(),On=De(),Xme=Yo(),Qme=Vo(),ehe=KT(),the=fB(),YT=Py(),rhe=tT(),nhe=hf(),XT=eT(),QT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,On.NODE_TYPE,{value:On.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new XT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[On.NODE_TYPE]:{value:On.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=On.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){cl(this.contents)&&this.contents.add(e)}addIn(e,r){cl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=YT.anchorNames(this);e.anchor=!r||n.has(r)?YT.findNewAnchor(r||"a",n):r}return new Yme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=YT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=nhe.createNode(e,u,m);return a&&On.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Xme.Pair(i,o)}delete(e){return cl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return al.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):cl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return On.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return al.isEmptyPath(e)?!r&&On.isScalar(this.contents)?this.contents.value:this.contents:On.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return On.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return al.isEmptyPath(e)?this.contents!==void 0:On.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=al.collectionFromPath(this.schema,[e],r):cl(this.contents)&&this.contents.set(e,r)}setIn(e,r){al.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=al.collectionFromPath(this.schema,Array.from(e),r):cl(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new XT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new XT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new ehe.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Qme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?rhe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return the.stringifyDocument(this,e)}};function cl(t){if(On.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}pB.Document=QT});var Cf=v(Pf=>{"use strict";var If=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},eO=class extends If{constructor(e,r,n){super("YAMLParseError",e,r,n)}},tO=class extends If{constructor(e,r,n){super("YAMLWarning",e,r,n)}},ihe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`}fB.stringifyDocument=Jme});var Rf=v(mB=>{"use strict";var Yme=mf(),cl=jy(),On=De(),Xme=Yo(),Qme=Vo(),ehe=KT(),the=pB(),YT=Py(),rhe=tT(),nhe=hf(),XT=eT(),QT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,On.NODE_TYPE,{value:On.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new XT.Directives({version:s}),this.setSchema(s,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[On.NODE_TYPE]:{value:On.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=On.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ll(this.contents)&&this.contents.add(e)}addIn(e,r){ll(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=YT.anchorNames(this);e.anchor=!r||n.has(r)?YT.findNewAnchor(r||"a",n):r}return new Yme.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let g=_=>typeof _=="number"||_ instanceof String||_ instanceof Number,b=r.filter(g).map(String);b.length>0&&(r=r.concat(b)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=YT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=nhe.createNode(e,u,m);return a&&On.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Xme.Pair(i,o)}delete(e){return ll(this.contents)?this.contents.delete(e):!1}deleteIn(e){return cl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ll(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return On.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return cl.isEmptyPath(e)?!r&&On.isScalar(this.contents)?this.contents.value:this.contents:On.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return On.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return cl.isEmptyPath(e)?this.contents!==void 0:On.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=cl.collectionFromPath(this.schema,[e],r):ll(this.contents)&&this.contents.set(e,r)}setIn(e,r){cl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=cl.collectionFromPath(this.schema,Array.from(e),r):ll(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new XT.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new XT.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new ehe.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Qme.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?rhe.applyReviver(s,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return the.stringifyDocument(this,e)}};function ll(t){if(On.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}mB.Document=QT});var Cf=v(Pf=>{"use strict";var If=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},eO=class extends If{constructor(e,r,n){super("YAMLParseError",e,r,n)}},tO=class extends If{constructor(e,r,n){super("YAMLWarning",e,r,n)}},ihe=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`: ${s} ${l} -`}};Pf.YAMLError=If;Pf.YAMLParseError=eO;Pf.YAMLWarning=tO;Pf.prettifyError=ihe});var Df=v(mB=>{"use strict";function ohe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}mB.resolveProps=ohe});var y_=v(hB=>{"use strict";function rO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` -`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(rO(e.key)||rO(e.value))return!0}return!1;default:return!0}}hB.containsNewline=rO});var nO=v(gB=>{"use strict";var she=y_();function ahe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&she.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}gB.flowIndentCheck=ahe});var iO=v(_B=>{"use strict";var yB=De();function che(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||yB.isScalar(o)&&yB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}_B.mapIncludes=che});var $B=v(xB=>{"use strict";var bB=Yo(),lhe=Qo(),vB=Df(),uhe=y_(),SB=nO(),dhe=iO(),wB="All mapping items must start at the same column";function fhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??lhe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=vB.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",wB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||uhe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",wB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&SB.flowIndentCheck(n.indent,f,i),r.atKey=!1,dhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=vB.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var phe=es(),mhe=Df(),hhe=nO();function ghe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??phe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=mhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&hhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}kB.resolveBlockSeq=ghe});var ll=v(AB=>{"use strict";function yhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}AB.resolveEnd=yhe});var IB=v(RB=>{"use strict";var _he=De(),bhe=Yo(),TB=Qo(),vhe=es(),She=ll(),OB=Df(),whe=y_(),xhe=iO(),oO="Block collections are not allowed within flow collections",sO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function $he({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?TB.YAMLMap:vhe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g{"use strict";function ohe(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,b=null,_=null,S=null,x=null,w=null;for(let A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:T,start:w??T}}hB.resolveProps=ohe});var y_=v(gB=>{"use strict";function rO(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` +`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(rO(e.key)||rO(e.value))return!0}return!1;default:return!0}}gB.containsNewline=rO});var nO=v(yB=>{"use strict";var she=y_();function ahe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&she.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}yB.flowIndentCheck=ahe});var iO=v(bB=>{"use strict";var _B=De();function che(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||_B.isScalar(o)&&_B.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}bB.mapIncludes=che});var kB=v($B=>{"use strict";var vB=Yo(),lhe=Qo(),SB=Df(),uhe=y_(),wB=nO(),dhe=iO(),xB="All mapping items must start at the same column";function fhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??lhe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=SB.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&i(c,"BAD_INDENT",xB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||uhe.containsNewline(f))&&i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&i(c,"BAD_INDENT",xB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&wB.flowIndentCheck(n.indent,f,i),r.atKey=!1,dhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=SB.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start{"use strict";var phe=es(),mhe=Df(),hhe=nO();function ghe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??phe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=mhe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,i):e(r,f.end,u,null,f,i);r.schema.compat&&hhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}EB.resolveBlockSeq=ghe});var ul=v(TB=>{"use strict";function yhe(t,e,r,n){let i="";if(t){let o=!1,s="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=s+u:i=u,s="";break}case"newline":i&&(s+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}TB.resolveEnd=yhe});var PB=v(IB=>{"use strict";var _he=De(),bhe=Yo(),OB=Qo(),vhe=es(),She=ul(),RB=Df(),whe=y_(),xhe=iO(),oO="Block collections are not allowed within flow collections",sO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function $he({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?OB.YAMLMap:vhe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g0){let g=She.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}RB.resolveFlowCollection=$he});var CB=v(PB=>{"use strict";var khe=De(),Ehe=Dt(),Ahe=Qo(),The=es(),Ohe=$B(),Rhe=EB(),Ihe=IB();function aO(t,e,r,n,i,o){let s=r.type==="block-map"?Ohe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Rhe.resolveBlockSeq(t,e,r,n,o):Ihe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Phe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),aO(t,e,r,i,s)}let l=aO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=khe.isNode(u)?u:new Ehe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}PB.composeCollection=Phe});var lO=v(DB=>{"use strict";var cO=Dt();function Che(t,e,r){let n=e.offset,i=Dhe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?cO.Scalar.BLOCK_FOLDED:cO.Scalar.BLOCK_LITERAL,s=e.source?Nhe(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`+T:A.comment=T,O.comment=O.comment.substring(T.length+1)}}if(!s&&!x&&!O.found){let T=w?t(r,w,O,i):e(r,O.end,x,null,O,i);l.items.push(T),d=T.range[2],sO(w)&&i(T.range,"BLOCK_IN_FLOW",oO)}else{r.atKey=!0;let T=O.end,A=S?t(r,S,O,i):e(r,T,_,null,O,i);sO(S)&&i(A.range,"BLOCK_IN_FLOW",oO),r.atKey=!1;let D=RB.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:w,offset:A.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(D.found){if(!s&&!O.found&&r.options.strict){if(x)for(let K of x){if(K===D.found)break;if(K.type==="newline"){i(K,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start0){let g=She.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}IB.resolveFlowCollection=$he});var DB=v(CB=>{"use strict";var khe=De(),Ehe=Dt(),Ahe=Qo(),The=es(),Ohe=kB(),Rhe=AB(),Ihe=PB();function aO(t,e,r,n,i,o){let s=r.type==="block-map"?Ohe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Rhe.resolveBlockSeq(t,e,r,n,o):Ihe.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Phe(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),aO(t,e,r,i,s)}let l=aO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=khe.isNode(u)?u:new Ehe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}CB.composeCollection=Phe});var lO=v(NB=>{"use strict";var cO=Dt();function Che(t,e,r){let n=e.offset,i=Dhe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?cO.Scalar.BLOCK_FOLDED:cO.Scalar.BLOCK_LITERAL,s=e.source?Nhe(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` @@ -112,7 +112,7 @@ ${l} `+s[h][0].slice(c);d[d.length-1]!==` `&&(d+=` `);break;default:d+=` -`}let m=n+i.length+e.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function Dhe({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let f=1;f{"use strict";var uO=Dt(),jhe=ll();function Mhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=uO.Scalar.PLAIN,c=Fhe(o,l);break;case"single-quoted-scalar":a=uO.Scalar.QUOTE_SINGLE,c=Lhe(o,l);break;case"double-quoted-scalar":a=uO.Scalar.QUOTE_DOUBLE,c=zhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=jhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Fhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),NB(t)}function Lhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),NB(t.slice(1,-1)).replace(/''/g,"'")}function NB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var uO=Dt(),jhe=ul();function Mhe(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=uO.Scalar.PLAIN,c=Fhe(o,l);break;case"single-quoted-scalar":a=uO.Scalar.QUOTE_SINGLE,c=Lhe(o,l);break;case"double-quoted-scalar":a=uO.Scalar.QUOTE_DOUBLE,c=zhe(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=jhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Fhe(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),jB(t)}function Lhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),jB(t.slice(1,-1)).replace(/''/g,"'")}function jB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var ga=De(),MB=Dt(),Hhe=lO(),Ghe=dO();function Zhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Hhe.resolveBlockScalar(t,e,n):Ghe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Vhe(t.schema,i,c,r,n):e.type==="scalar"?l=Whe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new MB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new MB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Vhe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Whe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}FB.composeScalar=Zhe});var UB=v(zB=>{"use strict";function Khe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}zB.emptyScalarPosition=Khe});var HB=v(pO=>{"use strict";var Jhe=mf(),Yhe=De(),Xhe=CB(),qB=LB(),Qhe=ll(),ege=UB(),tge={composeNode:BB,composeEmptyNode:fO};function BB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=rge(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=qB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Xhe.composeCollection(tge,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=fO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Yhe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function fO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ege.emptyScalarPosition(e,r,n),indent:-1,source:""},d=qB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function rge({options:t},{offset:e,source:r,end:n},i){let o=new Jhe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Qhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}pO.composeEmptyNode=fO;pO.composeNode=BB});var VB=v(ZB=>{"use strict";var nge=Rf(),GB=HB(),ige=ll(),oge=Df();function sge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new nge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=oge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?GB.composeNode(l,i,u,s):GB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=ige.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}ZB.composeDoc=sge});var hO=v(JB=>{"use strict";var age=Ge("process"),cge=eT(),lge=Rf(),Nf=Cf(),WB=De(),uge=VB(),dge=ll();function jf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function KB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ga=De(),FB=Dt(),Hhe=lO(),Ghe=dO();function Zhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Hhe.resolveBlockScalar(t,e,n):Ghe.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[ga.SCALAR]:c?l=Vhe(t.schema,i,c,r,n):e.type==="scalar"?l=Whe(t,i,e,n):l=t.schema[ga.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ga.isScalar(d)?d:new FB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new FB.Scalar(i)}return u.range=a,u.source=i,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Vhe(t,e,r,n,i){if(r==="!")return t[ga.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[r];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ga.SCALAR])}function Whe({atKey:t,directives:e,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ga.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ga.SCALAR];if(s.tag!==a.tag){let c=e.tagString(s.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}LB.composeScalar=Zhe});var qB=v(UB=>{"use strict";function Khe(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++n];i?.type==="space";)t+=i.source.length,i=e[++n];break}}return t}UB.emptyScalarPosition=Khe});var GB=v(pO=>{"use strict";var Jhe=mf(),Yhe=De(),Xhe=DB(),BB=zB(),Qhe=ul(),ege=qB(),tge={composeNode:HB,composeEmptyNode:fO};function HB(t,e,r,n){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=rge(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=BB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Xhe.composeCollection(tge,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=fO(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Yhe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?l.comment=s:l.commentBefore=s),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function fO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ege.emptyScalarPosition(e,r,n),indent:-1,source:""},d=BB.composeScalar(t,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function rge({options:t},{offset:e,source:r,end:n},i){let o=new Jhe.Alias(r.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+r.length,a=Qhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}pO.composeEmptyNode=fO;pO.composeNode=HB});var WB=v(VB=>{"use strict";var nge=Rf(),ZB=GB(),ige=ul(),oge=Df();function sge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new nge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=oge.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?ZB.composeNode(l,i,u,s):ZB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=ige.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}VB.composeDoc=sge});var hO=v(YB=>{"use strict";var age=Ge("process"),cge=eT(),lge=Rf(),Nf=Cf(),KB=De(),uge=WB(),dge=ul();function jf(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function JB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=jf(r);o?this.warnings.push(new Nf.YAMLWarning(s,n,i)):this.errors.push(new Nf.YAMLParseError(s,n,i))},this.directives=new cge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=KB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(WB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];WB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} +`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var mO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=jf(r);o?this.warnings.push(new Nf.YAMLWarning(s,n,i)):this.errors.push(new Nf.YAMLParseError(s,n,i))},this.directives=new cge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=JB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(KB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];KB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} ${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=jf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=uge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=dge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} -${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new lge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};JB.Composer=mO});var QB=v(__=>{"use strict";var fge=lO(),pge=dO(),mge=Cf(),YB=bf();function hge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new mge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return pge.resolveFlowScalar(t,e,n);case"block-scalar":return fge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function gge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=YB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` +${s}`:n}}if(r){for(let o=0;o{let o=jf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=uge.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=dge.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n} +${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Nf.YAMLParseError(jf(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new lge.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};YB.Composer=mO});var eH=v(__=>{"use strict";var fge=lO(),pge=dO(),mge=Cf(),XB=bf();function hge(t,e=!0,r){if(t){let n=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new mge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return pge.resolveFlowScalar(t,e,n);case"block-scalar":return fge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function gge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=XB.stringifyString({type:s,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:` `}];switch(a[0]){case"|":case">":{let l=a.indexOf(` `),u=a.substring(0,l),d=a.substring(l+1)+` -`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return XB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function yge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=YB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":_ge(t,c);break;case'"':gO(t,c,"double-quoted-scalar");break;case"'":gO(t,c,"single-quoted-scalar");break;default:gO(t,c,"scalar")}}function _ge(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return QB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function yge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=XB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":_ge(t,c);break;case'"':gO(t,c,"double-quoted-scalar");break;case"'":gO(t,c,"single-quoted-scalar");break;default:gO(t,c,"scalar")}}function _ge(t,e){let r=e.indexOf(` `),n=e.substring(0,r),i=e.substring(r+1)+` -`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];XB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` -`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function XB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function gO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` -`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}__.createScalarToken=gge;__.resolveAsScalar=hge;__.setScalarValue=yge});var tH=v(eH=>{"use strict";var bge=t=>"type"in t?v_(t):b_(t);function v_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=v_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=b_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=b_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=b_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function b_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=v_(e)),r)for(let o of r)i+=o.source;return n&&(i+=v_(n)),i}eH.stringify=bge});var oH=v(iH=>{"use strict";var yO=Symbol("break visit"),vge=Symbol("skip children"),rH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nH(Object.freeze([]),t,e)}ya.BREAK=yO;ya.SKIP=vge;ya.REMOVE=rH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function nH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var _O=QB(),Sge=tH(),wge=oH(),bO="\uFEFF",vO="",SO="",wO="",xge=t=>!!t&&"items"in t,$ge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function kge(t){switch(t){case bO:return"";case vO:return"";case SO:return"";case wO:return"";default:return JSON.stringify(t)}}function Ege(t){switch(t){case bO:return"byte-order-mark";case vO:return"doc-mode";case SO:return"flow-error-end";case wO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];QB(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function QB(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function gO(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of n)o.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}__.createScalarToken=gge;__.resolveAsScalar=hge;__.setScalarValue=yge});var rH=v(tH=>{"use strict";var bge=t=>"type"in t?v_(t):b_(t);function v_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=v_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=b_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=b_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=b_(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function b_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=v_(e)),r)for(let o of r)i+=o.source;return n&&(i+=v_(n)),i}tH.stringify=bge});var sH=v(oH=>{"use strict";var yO=Symbol("break visit"),vge=Symbol("skip children"),nH=Symbol("remove item");function ya(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),iH(Object.freeze([]),t,e)}ya.BREAK=yO;ya.SKIP=vge;ya.REMOVE=nH;ya.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};ya.parentCollection=(t,e)=>{let r=ya.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function iH(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s{"use strict";var _O=eH(),Sge=rH(),wge=sH(),bO="\uFEFF",vO="",SO="",wO="",xge=t=>!!t&&"items"in t,$ge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function kge(t){switch(t){case bO:return"";case vO:return"";case SO:return"";case wO:return"";default:return JSON.stringify(t)}}function Ege(t){switch(t){case bO:return"byte-order-mark";case vO:return"doc-mode";case SO:return"flow-error-end";case wO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}jr.createScalarToken=_O.createScalarToken;jr.resolveAsScalar=_O.resolveAsScalar;jr.setScalarValue=_O.setScalarValue;jr.stringify=Sge.stringify;jr.visit=wge.visit;jr.BOM=bO;jr.DOCUMENT=vO;jr.FLOW_END=SO;jr.SCALAR=wO;jr.isCollection=xge;jr.isScalar=$ge;jr.prettyToken=kge;jr.tokenType=Ege});var kO=v(aH=>{"use strict";var Mf=S_();function Xn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var sH=new Set("0123456789ABCDEFabcdef"),Age=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),w_=new Set(",[]{}"),Tge=new Set(` ,[]{} +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}jr.createScalarToken=_O.createScalarToken;jr.resolveAsScalar=_O.resolveAsScalar;jr.setScalarValue=_O.setScalarValue;jr.stringify=Sge.stringify;jr.visit=wge.visit;jr.BOM=bO;jr.DOCUMENT=vO;jr.FLOW_END=SO;jr.SCALAR=wO;jr.isCollection=xge;jr.isScalar=$ge;jr.prettyToken=kge;jr.tokenType=Ege});var kO=v(cH=>{"use strict";var Mf=S_();function Xn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var aH=new Set("0123456789ABCDEFabcdef"),Age=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),w_=new Set(",[]{}"),Tge=new Set(` ,[]{} \r `),xO=t=>!t||Tge.has(t),$O=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===` `?!0:r==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===` @@ -161,43 +161,43 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Mf.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Xn(o)||e&&w_.has(o))break;r=n}else if(Xn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` `,o=this.buffer[n+1]):r=n),o==="#"||e&&w_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&w_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Mf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(xO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Xn(n)||r&&w_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Xn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Age.has(r))r=this.buffer[++e];else if(r==="%"&&sH.has(this.buffer[e+1])&&sH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&w_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Mf.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(xO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Xn(n)||r&&w_.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Xn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(Age.has(r))r=this.buffer[++e];else if(r==="%"&&aH.has(this.buffer[e+1])&&aH.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};aH.Lexer=$O});var AO=v(cH=>{"use strict";var EO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Oge=Ge("process"),lH=S_(),Rge=kO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function $_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&dH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&uH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};cH.Lexer=$O});var AO=v(lH=>{"use strict";var EO=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r>1;this.lineStarts[o]{"use strict";var Oge=Ge("process"),uH=S_(),Rge=kO();function ts(t,e){for(let r=0;r=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function $_(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&fH(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&dH(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ts(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(fH(r.key)&&!ts(r.sep,"newline")){let s=ul(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ul(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ts(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!ts(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){$_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||ts(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=x_(n),o=ul(i);dH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` +`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){$_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;ae.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ts(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(pH(r.key)&&!ts(r.sep,"newline")){let s=dl(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(ts(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=dl(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):ts(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!ts(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){$_(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||ts(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=x_(n),o=dl(i);fH(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(` `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(` -`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=x_(e),n=ul(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};pH.Parser=TO});var _H=v(Lf=>{"use strict";var mH=hO(),Ige=Rf(),Ff=Cf(),Pge=pT(),Cge=De(),Dge=AO(),hH=OO();function gH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Dge.LineCounter||null,prettyErrors:e}}function Nge(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ff.prettifyError(t,r)),a.warnings.forEach(Ff.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yH(t,e={}){let{lineCounter:r,prettyErrors:n}=gH(e),i=new hH.Parser(r?.addNewLine),o=new mH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ff.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ff.prettifyError(t,r)),s.warnings.forEach(Ff.prettifyError(t,r))),s}function jge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=yH(t,r);if(!i)return null;if(i.warnings.forEach(o=>Pge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Mge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Cge.isDocument(t)&&!n?t.toString(r):new Ige.Document(t,n,r).toString(r)}Lf.parse=jge;Lf.parseAllDocuments=Nge;Lf.parseDocument=yH;Lf.stringify=Mge});var er=v(Ze=>{"use strict";var Fge=hO(),Lge=Rf(),zge=KT(),RO=Cf(),Uge=mf(),rs=De(),qge=Yo(),Bge=Dt(),Hge=Qo(),Gge=es(),Zge=S_(),Vge=kO(),Wge=AO(),Kge=OO(),k_=_H(),bH=uf();Ze.Composer=Fge.Composer;Ze.Document=Lge.Document;Ze.Schema=zge.Schema;Ze.YAMLError=RO.YAMLError;Ze.YAMLParseError=RO.YAMLParseError;Ze.YAMLWarning=RO.YAMLWarning;Ze.Alias=Uge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=qge.Pair;Ze.Scalar=Bge.Scalar;Ze.YAMLMap=Hge.YAMLMap;Ze.YAMLSeq=Gge.YAMLSeq;Ze.CST=Zge;Ze.Lexer=Vge.Lexer;Ze.LineCounter=Wge.LineCounter;Ze.Parser=Kge.Parser;Ze.parse=k_.parse;Ze.parseAllDocuments=k_.parseAllDocuments;Ze.parseDocument=k_.parseDocument;Ze.stringify=k_.stringify;Ze.visit=bH.visit;Ze.visitAsync=bH.visitAsync});import{execFileSync as IO}from"node:child_process";import{existsSync as E_}from"node:fs";import{join as A_,resolve as Jge}from"node:path";function Yge(t){try{let e=IO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Jge(t,e):null}catch{return null}}function PO(t){let e=Yge(t);if(!e)return null;try{if(E_(A_(e,"MERGE_HEAD")))return"merge";if(E_(A_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(E_(A_(e,"rebase-merge"))||E_(A_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return PO(t)!==null}function zf(t,e){try{let r=IO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function T_(t,e){return zf(t,e)!==null}function vH(t,e){try{let r=IO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Xge}from"node:child_process";import{existsSync as Qge,readFileSync as eye}from"node:fs";import{join as wH}from"node:path";function pl(t,e){return Xge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=pl(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){xH(t,e);let r=pl(t,["rev-parse","HEAD"]).trim(),n=tye(t,e);return{groups:rye(t,n),head:r,inventory:{after:SH(R_(t,"spec.yaml")),before:SH(Uf(t,e,"spec.yaml"))},since:e,unsharded_commits:sye(t,e)}}function CO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function xH(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!T_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function tye(t,e){let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!O_(c)&&!O_(a)))if(s.startsWith("A")){let l=fl(R_(t,c));if(!l)continue;l.status==="done"?n.push(dl(l,"added-as-done")):l.status==="archived"&&n.push(dl(l,"archived"))}else if(s.startsWith("D")){let l=fl(Uf(t,e,a));l&&n.push(dl(l,"archived"))}else{let l=fl(R_(t,c));if(!l)continue;let d=fl(Uf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(dl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(dl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(dl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function O_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function $H(t,e){xH(t,e);let r=pl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!O_(c)&&!O_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?fl(Uf(t,"HEAD",c)):null,f=l?null:fl(Uf(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function dl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>CO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function fl(t){if(t===null)return null;let e;try{e=(0,I_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function R_(t,e){let r=wH(t,e);if(!Qge(r))return null;try{return eye(r,"utf8")}catch{return null}}function Uf(t,e,r){try{return pl(t,["show",`${e}:${r}`])}catch{return null}}function rye(t,e){let r=nye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function nye(t){let e=R_(t,wH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,I_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function SH(t){let e={};if(t!==null)try{let n=(0,I_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function sye(t,e){let r=pl(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` -`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);iye.test(a)&&(oye.test(a)||n.push({hash:s,subject:a}))}return n}var I_,iye,oye,ml=y(()=>{"use strict";I_=St(er(),1);ba();iye=/^(feat|fix)(\([^)]*\))?!?:/,oye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as kH}from"node:child_process";import{appendFileSync as aye,existsSync as DO,mkdirSync as cye,readFileSync as lye,renameSync as uye,statSync as dye}from"node:fs";import{userInfo as fye}from"node:os";import{dirname as pye,join as jO}from"node:path";function MO(t){return jO(t,EH,mye)}function tn(t,e){let r=MO(t),n=pye(r);DO(n)||cye(n,{recursive:!0});try{DO(r)&&dye(r).size>hye&&uye(r,jO(n,AH))}catch{}aye(r,`${JSON.stringify(e)} +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=x_(e),n=dl(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=x_(e),n=dl(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};mH.Parser=TO});var bH=v(Lf=>{"use strict";var hH=hO(),Ige=Rf(),Ff=Cf(),Pge=pT(),Cge=De(),Dge=AO(),gH=OO();function yH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Dge.LineCounter||null,prettyErrors:e}}function Nge(t,e={}){let{lineCounter:r,prettyErrors:n}=yH(e),i=new gH.Parser(r?.addNewLine),o=new hH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Ff.prettifyError(t,r)),a.warnings.forEach(Ff.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function _H(t,e={}){let{lineCounter:r,prettyErrors:n}=yH(e),i=new gH.Parser(r?.addNewLine),o=new hH.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ff.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Ff.prettifyError(t,r)),s.warnings.forEach(Ff.prettifyError(t,r))),s}function jge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=_H(t,r);if(!i)return null;if(i.warnings.forEach(o=>Pge.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function Mge(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return Cge.isDocument(t)&&!n?t.toString(r):new Ige.Document(t,n,r).toString(r)}Lf.parse=jge;Lf.parseAllDocuments=Nge;Lf.parseDocument=_H;Lf.stringify=Mge});var er=v(Ze=>{"use strict";var Fge=hO(),Lge=Rf(),zge=KT(),RO=Cf(),Uge=mf(),rs=De(),qge=Yo(),Bge=Dt(),Hge=Qo(),Gge=es(),Zge=S_(),Vge=kO(),Wge=AO(),Kge=OO(),k_=bH(),vH=uf();Ze.Composer=Fge.Composer;Ze.Document=Lge.Document;Ze.Schema=zge.Schema;Ze.YAMLError=RO.YAMLError;Ze.YAMLParseError=RO.YAMLParseError;Ze.YAMLWarning=RO.YAMLWarning;Ze.Alias=Uge.Alias;Ze.isAlias=rs.isAlias;Ze.isCollection=rs.isCollection;Ze.isDocument=rs.isDocument;Ze.isMap=rs.isMap;Ze.isNode=rs.isNode;Ze.isPair=rs.isPair;Ze.isScalar=rs.isScalar;Ze.isSeq=rs.isSeq;Ze.Pair=qge.Pair;Ze.Scalar=Bge.Scalar;Ze.YAMLMap=Hge.YAMLMap;Ze.YAMLSeq=Gge.YAMLSeq;Ze.CST=Zge;Ze.Lexer=Vge.Lexer;Ze.LineCounter=Wge.LineCounter;Ze.Parser=Kge.Parser;Ze.parse=k_.parse;Ze.parseAllDocuments=k_.parseAllDocuments;Ze.parseDocument=k_.parseDocument;Ze.stringify=k_.stringify;Ze.visit=vH.visit;Ze.visitAsync=vH.visitAsync});import{execFileSync as IO}from"node:child_process";import{existsSync as E_}from"node:fs";import{join as A_,resolve as Jge}from"node:path";function Yge(t){try{let e=IO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Jge(t,e):null}catch{return null}}function PO(t){let e=Yge(t);if(!e)return null;try{if(E_(A_(e,"MERGE_HEAD")))return"merge";if(E_(A_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(E_(A_(e,"rebase-merge"))||E_(A_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function _a(t){return PO(t)!==null}function zf(t,e){try{let r=IO("git",["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:null}catch{return null}}function T_(t,e){return zf(t,e)!==null}function SH(t,e){try{let r=IO("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var ba=y(()=>{"use strict"});import{execFileSync as Xge}from"node:child_process";import{existsSync as Qge,readFileSync as eye}from"node:fs";import{join as xH}from"node:path";function ml(t,e){return Xge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ns(t){try{let e=ml(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function is(t,e){$H(t,e);let r=ml(t,["rev-parse","HEAD"]).trim(),n=tye(t,e);return{groups:rye(t,n),head:r,inventory:{after:wH(R_(t,"spec.yaml")),before:wH(Uf(t,e,"spec.yaml"))},since:e,unsharded_commits:sye(t,e)}}function CO(t){if(t.text&&t.text.trim().length>0)return t.text.trim();let e=t.action?.trim();if(!e)return null;let r=t.condition?.trim(),n=t.response?.trim(),i=r?`${r.charAt(0).toUpperCase()}${r.slice(1)}, the system shall ${e}`:`The system shall ${e}`;return n?`${i} \u2014 ${n}.`:`${i}.`}function $H(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!T_(t,r))throw new Error(`changelog: '${r}' does not resolve to a commit in this repository \u2014 pass --since that exists. An unknown ref is an error, never a silently empty changelog.`)}function tye(t,e){let r=ml(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]:a;if(!(!O_(c)&&!O_(a)))if(s.startsWith("A")){let l=pl(R_(t,c));if(!l)continue;l.status==="done"?n.push(fl(l,"added-as-done")):l.status==="archived"&&n.push(fl(l,"archived"))}else if(s.startsWith("D")){let l=pl(Uf(t,e,a));l&&n.push(fl(l,"archived"))}else{let l=pl(R_(t,c));if(!l)continue;let d=pl(Uf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(fl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(fl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(fl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function O_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function kH(t,e){$H(t,e);let r=ml(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.split(" "),s=o[0]??"",a=o[1]??"",c=o.length>2?o[2]??"":a;if(!O_(c)&&!O_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?pl(Uf(t,"HEAD",c)):null,f=l?null:pl(Uf(t,e,a)),p=d??f;p&&n.push({path:u?a:c,id:p.id,...p.slug?{slug:p.slug}:{},title:p.title,statusBefore:f?f.status:null,statusAfter:d?d.status:null,baseAcs:f?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function fl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>CO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function pl(t){if(t===null)return null;let e;try{e=(0,I_.parse)(t)}catch{return null}let r=e;return!r||typeof r.id!="string"||typeof r.status!="string"?null:{id:r.id,slug:typeof r.slug=="string"?r.slug:void 0,title:typeof r.title=="string"?r.title:r.id,status:r.status,acceptance_criteria:r.acceptance_criteria}}function R_(t,e){let r=xH(t,e);if(!Qge(r))return null;try{return eye(r,"utf8")}catch{return null}}function Uf(t,e,r){try{return ml(t,["show",`${e}:${r}`])}catch{return null}}function rye(t,e){let r=nye(t).filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=[],i=new Set;for(let s of r){let a=new Set(s.features??[]),c=e.filter(l=>a.has(l.id)&&!i.has(l.id));if(c.length!==0){for(let l of c)i.add(l.id);n.push({capability:s.id,features:c,title:s.title??s.id})}}let o=e.filter(s=>!i.has(s.id));return o.length>0&&n.push({capability:"uncategorized",features:o,title:"Uncategorized"}),n}function nye(t){let e=R_(t,xH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,I_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function wH(t){let e={};if(t!==null)try{let n=(0,I_.parse)(t);n&&typeof n.inventory=="object"&&n.inventory!==null&&(e=n.inventory)}catch{}let r=n=>typeof e[n]=="number"?e[n]:0;return{capabilities:r("capabilities"),features:r("features"),scenarios:r("scenarios"),test_files:r("test_files")}}function sye(t,e){let r=ml(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let o=i.indexOf(" ");if(o<0)continue;let s=i.slice(0,o),a=i.slice(o+1);iye.test(a)&&(oye.test(a)||n.push({hash:s,subject:a}))}return n}var I_,iye,oye,hl=y(()=>{"use strict";I_=St(er(),1);ba();iye=/^(feat|fix)(\([^)]*\))?!?:/,oye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as EH}from"node:child_process";import{appendFileSync as aye,existsSync as DO,mkdirSync as cye,readFileSync as lye,renameSync as uye,statSync as dye}from"node:fs";import{userInfo as fye}from"node:os";import{dirname as pye,join as jO}from"node:path";function MO(t){return jO(t,AH,mye)}function tn(t,e){let r=MO(t),n=pye(r);DO(n)||cye(n,{recursive:!0});try{DO(r)&&dye(r).size>hye&&uye(r,jO(n,TH))}catch{}aye(r,`${JSON.stringify(e)} `,"utf8")}function NO(t){if(!DO(t))return[];let e=lye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return NO(MO(t))}function P_(t){return[...NO(jO(t,EH,AH)),...NO(MO(t))]}function rn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function gye(t){let e;try{e=kH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=fye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function yye(t){try{return kH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function qf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=yye(t),i=gye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=qf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}tn(t,rn(e,o))}catch{}}var EH,mye,AH,hye,Mr=y(()=>{"use strict";EH=".cladding",mye="events.log.jsonl",AH="events.log.1.jsonl",hye=5*1024*1024});import{execFileSync as _ye}from"node:child_process";import{existsSync as TH,readdirSync as bye,readFileSync as vye,statSync as OH}from"node:fs";import{createHash as Sye}from"node:crypto";import{join as FO}from"node:path";function Sa(t){try{return _ye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function LO(t){let e=[],r=FO(t,"spec.yaml");TH(r)&&OH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=FO(t,"spec",i);if(!(!TH(o)||!OH(o).isDirectory()))for(let s of bye(o))s.endsWith(".yaml")&&e.push(FO(o,s))}e.sort();let n=Sye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(vye(i)),n.update("\0")}return n.digest("hex")}function C_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:LO(t),timestamp:new Date().toISOString()};return tn(t,rn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function D_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function N_(t,e,r,n){let i=rn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return tn(t,i),i}var Bf=y(()=>{"use strict";Mr()});import{readFileSync as wye,statSync as xye}from"node:fs";import{extname as $ye,resolve as zO,sep as kye}from"node:path";function nn(t){return Math.ceil(t.length/4)}function Tye(t,e){let r=zO(e),n=zO(r,t);return n===r||n.startsWith(r+kye)}function IH(t,e,r,n){if(!Tye(t,e))return{path:t,omitted:"unsafe-path"};if(!Eye.has($ye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>RH)return{path:t,omitted:"too-large",bytes:o}}else{let l=zO(e,t);try{o=xye(l).size}catch{return{path:t,omitted:"missing"}}if(o>RH)return{path:t,omitted:"too-large",bytes:o};try{i=wye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Aye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function va(t){return NO(MO(t))}function P_(t){return[...NO(jO(t,AH,TH)),...NO(MO(t))]}function rn(t,e){return{id:`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,timestamp:new Date().toISOString(),type:t,payload:e}}function gye(t){let e;try{e=EH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=fye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function yye(t){try{return EH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function qf(t,e){try{let r=va(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function tr(t,e,r){try{let n=yye(t),i=gye(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=qf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}tn(t,rn(e,o))}catch{}}var AH,mye,TH,hye,Mr=y(()=>{"use strict";AH=".cladding",mye="events.log.jsonl",TH="events.log.1.jsonl",hye=5*1024*1024});import{execFileSync as _ye}from"node:child_process";import{existsSync as OH,readdirSync as bye,readFileSync as vye,statSync as RH}from"node:fs";import{createHash as Sye}from"node:crypto";import{join as FO}from"node:path";function Sa(t){try{return _ye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function LO(t){let e=[],r=FO(t,"spec.yaml");OH(r)&&RH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=FO(t,"spec",i);if(!(!OH(o)||!RH(o).isDirectory()))for(let s of bye(o))s.endsWith(".yaml")&&e.push(FO(o,s))}e.sort();let n=Sye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(vye(i)),n.update("\0")}return n.digest("hex")}function C_(t,e){let r={featureId:e,gitHead:Sa(t),specDigest:LO(t),timestamp:new Date().toISOString()};return tn(t,rn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function D_(t,e){let r=va(t);for(let n=r.length-1;n>=0;n--){let i=r[n];if(i.type==="feature_checkpoint"&&i.payload.feature===e)return{featureId:e,gitHead:i.payload.git_head??null,specDigest:String(i.payload.spec_digest??""),timestamp:i.timestamp}}return null}function N_(t,e,r,n){let i=rn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return tn(t,i),i}var Bf=y(()=>{"use strict";Mr()});import{readFileSync as wye,statSync as xye}from"node:fs";import{extname as $ye,resolve as zO,sep as kye}from"node:path";function nn(t){return Math.ceil(t.length/4)}function Tye(t,e){let r=zO(e),n=zO(r,t);return n===r||n.startsWith(r+kye)}function PH(t,e,r,n){if(!Tye(t,e))return{path:t,omitted:"unsafe-path"};if(!Eye.has($ye(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,o;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,o=Buffer.byteLength(l,"utf8"),o>IH)return{path:t,omitted:"too-large",bytes:o}}else{let l=zO(e,t);try{o=xye(l).size}catch{return{path:t,omitted:"missing"}}if(o>IH)return{path:t,omitted:"too-large",bytes:o};try{i=wye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Aye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` /* ... clipped (${o} bytes total) ... */ -`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var Eye,RH,Aye,j_=y(()=>{"use strict";Eye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),RH=2e6,Aye="\0"});function Hf(t){for(let i of Oye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function UO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Rye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])UO(e,s,o);for(let s of i.modules??[])UO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Hf(a);c&&UO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Rn(t){let e=PH.get(t);return e||(e=Rye(t),PH.set(t,e)),e}var Oye,PH,os=y(()=>{"use strict";Oye=["derived:","fixture:","script:","self-dogfood:"];PH=new WeakMap});function qO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=Rn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Iye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=qO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:BO(i)}}var wa=y(()=>{"use strict";os()});function CH(t){return t.impacted.length}function F_(t,e,r={}){let n=r.initialDepth??M_.initialDepth,i=r.maxDepth??M_.maxDepth,o=r.coverageThreshold??M_.coverageThreshold,s=r.marginYieldThreshold??M_.marginYieldThreshold,a=Rn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=qO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=CH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var M_,HO=y(()=>{"use strict";wa();os();M_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Pye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function DH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Pye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var NH=y(()=>{"use strict"});function Cye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function hl(t,e){let r=Cye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=DH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var L_=y(()=>{"use strict";NH()});import{existsSync as MH,readdirSync as Dye,readFileSync as Nye}from"node:fs";import{join as ZO}from"node:path";function VO(t,e=Mye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Fye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:VO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:VO(`done reverted \u2014 pre-push strict gate red${r}`)}}function jH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Lye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return VO(n)}function zye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>jH(m)-jH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-jye).map(Fye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Lye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function GO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Uye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` -`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function qye(t,e,r){let n=GO(t,/_Rolled back at_\s*`([^`]+)`/),i=GO(t,/Last failed gate:\s*`([^`]+)`/),o=GO(t,/Retry attempts:\s*(\d+)/),s=Uye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Bye(t,e){let r=ZO(t,".cladding","post-mortems");if(!MH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Dye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(qye(Nye(ZO(r,o),"utf8"),e,o))}catch{}return i}function FH(t,e){try{let r=P_(t),n=Bye(t,e),i=MH(ZO(t,".cladding","events.log.1.jsonl"));return zye(r,n,e,{truncated:i})}catch{return}}var jye,Mye,LH=y(()=>{"use strict";Mr();jye=5,Mye=120});function z_(t,e,r){return nn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Hye,o=e,s,a=Rn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=hl(t,o);if("not_found"in c)return c;let l=c.focus,u=FH(n,l.id),d=a&&a.size>0?e:l.id,f=F_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Gye&&z_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],uo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return nn(JSON.stringify(uo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],uo=0;for(;Xt.length>Ce.size&&$(Xt,K,uo,0);)Xt=Xt.slice(0,-1),uo++;let ki=[...h],en=0;for(;$(Xt,ki,uo,en);){let de=-1;for(let fo=ki.length-1;fo>=0;fo--)if(!Kt.has(ki[fo])){de=fo;break}if(de<0)break;ki.splice(de,1),en++}re=Xt,K=ki,uo+en>0&&x.push(`breaks: omitted ${uo} feature(s) / ${en} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};nn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Cr=nn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Cr,truncated:x}}}var Hye,Gye,U_=y(()=>{"use strict";j_();L_();HO();LH();wa();os();Hye=3e3,Gye=3});function Qn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Zye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function zH(t,e,r="."){let n=Rn(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=F_(t,f.id),g=!("not_found"in h),b=nn(JSON.stringify(p)),_="not_found"in m?b:nn(JSON.stringify(m)),S=nn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=nn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Qn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Qn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Qn(a(c))*10)/10,medianShrinkTruncated:Math.round(Qn(a(l))*10)/10,medianStructuralRatio:Math.round(Qn(u)*100)/100,medianSliceTokens:Math.round(Qn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Qn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Qn(o.map(f=>f.searchDepth)),p95Depth:Zye(o.map(f=>f.searchDepth),95),medianEdges:Qn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Qn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Qn(o.map(f=>f.regressionTests))},features:o}}var gl,q_=y(()=>{"use strict";j_();HO();U_();os();gl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Vye,existsSync as WO,mkdirSync as Wye,readFileSync as UH}from"node:fs";import{dirname as Kye,join as Jye}from"node:path";function KO(t){return Jye(t,Yye,Xye)}function Qye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:LO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function qH(t,e){try{let r=Qye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=JO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=KO(t),s=Kye(o);return WO(s)||Wye(s,{recursive:!0}),Vye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function BH(t){let e=[];for(let r of t.split(` -`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function JO(t,e){let r=KO(t);if(!WO(r))return[];let n;try{n=UH(r,"utf8")}catch{return[]}let i=BH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function HH(t){let e=KO(t);if(!WO(e))return{snapshots:[],unreadable:!1};let r;try{r=UH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=BH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Gf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function GH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Gf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${gl}`),i.join(` -`)}var Yye,Xye,Zf=y(()=>{"use strict";Bf();q_();Yye=".cladding",Xye="measure.jsonl"});import{existsSync as e_e}from"node:fs";import{join as t_e}from"node:path";function yl(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${r_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` -`)}function VH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` -`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Gf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Gf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Gf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",gl),r.join(` -`)}function _l(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${i_e(l,r)} |`)}return n.join(` -`)}function i_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of n_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${e_e(t_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function bl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),ZH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)ZH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function ZH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=CO(r);n&&t.push(`- ${n}`)}t.push("")}var r_e,n_e,B_=y(()=>{"use strict";Zf();q_();ml();r_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};n_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as o_e}from"node:fs";function Ri(t="./spec.yaml"){let e=o_e(t,"utf8");return(0,WH.parse)(e)}var WH,H_=y(()=>{"use strict";WH=St(er(),1)});var ss=v((Fr,eR)=>{"use strict";var YO=Fr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+JH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};YO.prototype.toString=function(){return this.property+" "+this.message};var G_=Fr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};G_.prototype.addError=function(e){var r;if(typeof e=="string")r=new YO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new YO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};G_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function s_e(t,e){return e+": "+t.toString()+` -`}G_.prototype.toString=function(e){return this.errors.map(s_e).join("")};Object.defineProperty(G_.prototype,"valid",{get:function(){return!this.errors.length}});eR.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var KH=Fr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};KH.prototype=Object.create(Error.prototype,{constructor:{value:KH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XO=Fr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+JH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XO.prototype.resolve=function(e){return YH(this.base,e)};XO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=YH(this.base,i||"");var s=new XO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ei=Fr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ei.regexp=ei.regex;ei.pattern=ei.regex;ei.ipv4=ei["ip-address"];Fr.isFormat=function(e,r,n){if(typeof e=="string"&&ei[r]!==void 0){if(ei[r]instanceof RegExp)return ei[r].test(e);if(typeof ei[r]=="function")return ei[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var JH=Fr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Fr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function a_e(t,e,r,n){typeof r=="object"?e[n]=QO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function c_e(t,e,r){e[r]=t[r]}function l_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QO(t[n],e[n]):r[n]=e[n]}function QO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(a_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(c_e.bind(null,t,n)),Object.keys(e).forEach(l_e.bind(null,t,e,n))),n}eR.exports.deepMerge=QO;Fr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function u_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Fr.encodePath=function(e){return e.map(u_e).join("")};Fr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Fr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var YH=Fr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var tG=v((G7e,eG)=>{"use strict";var on=ss(),Le=on.ValidatorResult,as=on.SchemaError,tR={};tR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=tR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function rR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(rR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(rR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!on.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!on.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!on.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function nR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!on.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function XH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&XH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)XH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!on.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function d_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iR=ss();oR.exports.SchemaScanResult=rG;function rG(t,e){this.id=t,this.ref=e}oR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var nG=tG(),cs=ss(),iG=Z_().scan,oG=cs.ValidatorResult,f_e=cs.ValidatorResultError,Vf=cs.SchemaError,sG=cs.SchemaContext,p_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(nG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=iG(r||p_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Vf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Vf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Jt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};cG.exports=Jt});var uG=v((W7e,go)=>{"use strict";var m_e=go.exports.Validator=lG();go.exports.ValidatorResult=ss().ValidatorResult;go.exports.ValidatorResultError=ss().ValidatorResultError;go.exports.ValidationError=ss().ValidationError;go.exports.SchemaError=ss().SchemaError;go.exports.SchemaScanResult=Z_().SchemaScanResult;go.exports.scan=Z_().scan;go.exports.validate=function(t,e,r){var n=new m_e;return n.validate(t,e,r)}});import{readFileSync as h_e}from"node:fs";import{dirname as g_e,join as y_e}from"node:path";import{fileURLToPath as __e}from"node:url";function x_e(t){let e=w_e.validate(t,S_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function fG(t){let e=x_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var Eye,IH,Aye,j_=y(()=>{"use strict";Eye=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".java",".kt",".kts",".cs",".rb",".php",".swift",".c",".h",".cpp",".hpp",".css",".scss",".sql",".sh",".yaml",".yml",".json",".md",".toml"]),IH=2e6,Aye="\0"});function Hf(t){for(let i of Oye)if(t.startsWith(i))return null;let e=t.indexOf("#"),n=(e>=0?t.slice(0,e):t).trim();return n.length>0?n:null}function UO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Rye(t){let e=new Map,r=new Map,n=new Map;for(let i of t.features??[]){let o=i.id;for(let s of i.depends_on??[])UO(e,s,o);for(let s of i.modules??[])UO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Hf(a);c&&UO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function Rn(t){let e=CH.get(t);return e||(e=Rye(t),CH.set(t,e)),e}var Oye,CH,os=y(()=>{"use strict";Oye=["derived:","fixture:","script:","self-dogfood:"];CH=new WeakMap});function qO(t,e,r=1/0){let n=new Set,i=new Set(t),o=[...i],s=0;for(;o.length>0&&sn.id===e)??r.find(n=>n.slug===e)??null}function Sr(t,e,r={}){let n=r.depth??1/0,i=Rn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Iye(t,e);if(c)s=[c];else{let _=i.moduleOwners.get(e);_&&_.size>0&&(a=e,s=[..._].map(S=>o.get(S)).filter(S=>!!S))}if(s.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); module paths live in each shard\u2019s modules:; if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let l=s.map(_=>_.id),u=qO(l,i.dependents,n),d=[...u].map(_=>o.get(_)).filter(_=>!!_).map(_=>({id:_.id,title:_.title,status:_.status})).sort((_,S)=>_.id.localeCompare(S.id)),f=new Set([...l,...u]),p=[...f].map(_=>o.get(_)).filter(_=>!!_),m=[...new Set(p.flatMap(_=>_.modules??[]))].sort(),h=(t.scenarios??[]).filter(_=>(_.features??[]).some(S=>f.has(S))).map(_=>({id:_.id,title:_.title})).sort((_,S)=>_.id.localeCompare(S.id)),g=[...new Set(p.flatMap(_=>(_.acceptance_criteria??[]).flatMap(S=>S.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:s[0].id,title:s[0].title,status:s[0].status},impacted:d,impacted_modules:m,scenarios:h,test_refs:g,ledger:BO(i)}}var wa=y(()=>{"use strict";os()});function DH(t){return t.impacted.length}function F_(t,e,r={}){let n=r.initialDepth??M_.initialDepth,i=r.maxDepth??M_.maxDepth,o=r.coverageThreshold??M_.coverageThreshold,s=r.marginYieldThreshold??M_.marginYieldThreshold,a=Rn(t),c=new Map((t.features??[]).map(b=>[b.id,b])),l=[],u=(t.features??[]).find(b=>b.id===e||b.slug===e);if(u)l=[u.id];else{let b=a.moduleOwners.get(e);b&&b.size>0&&(l=[...b].filter(_=>c.has(_)))}if(l.length===0){let b=Sr(t,e,{depth:1});return"not_found"in b,b}let d=qO(l,a.dependents,1/0).size;if(d===0){let b=Sr(t,e,{depth:n});return"not_found"in b?b:{slice:b,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let f=[],p=0,m=null;for(let b=n;b<=i;b++){let _=Sr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=DH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var M_,HO=y(()=>{"use strict";wa();os();M_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Pye(t,e){let r=new Set,n=[t];for(;n.length>0;){let i=n.pop();if(!i||r.has(i))continue;r.add(i);let o=e.get(i);for(let s of o?.depends_on??[])n.push(s)}return r}function NH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Pye(e,r),i=t.features.filter(a=>n.has(a.id)),o=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:o}}var jH=y(()=>{"use strict"});function Cye(t,e){let r=t.features??[];return r.find(n=>n.id===e)??r.find(n=>n.slug===e)??r.find(n=>(n.modules??[]).includes(e))??null}function gl(t,e){let r=Cye(t,e);if(!r)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/auth/login.ts)"],discovery:"grep spec/index.yaml \u2014 one line per feature (id, slug, status; run clad sync if missing); if the query is a file, fall back to normal code search \u2014 the graph only knows declared modules"};let n=NH(t,r.id),i=(n.features??[]).filter(c=>c.id!==r.id).map(c=>({id:c.id,title:c.title,status:c.status})).sort((c,l)=>c.id.localeCompare(l.id)),o=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),s=(t.project?.ai_hints?.preferred_patterns??[]).map(c=>({when:c.when,prefer:c.prefer,...c.over!==void 0?{over:c.over}:{}})),a=[...new Set((r.acceptance_criteria??[]).flatMap(c=>c.test_refs??[]))].sort();return{focus:r,ancestors:i,scenarios:o,preferred_patterns:s,test_refs:a}}var L_=y(()=>{"use strict";jH()});import{existsSync as FH,readdirSync as Dye,readFileSync as Nye}from"node:fs";import{join as ZO}from"node:path";function VO(t,e=Mye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Fye(t){let e=t.payload??{};if(t.type==="drift_detected"){let n=typeof e.gate=="string"&&e.gate?e.gate:"drift";return{detector:n,message:VO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:VO(`done reverted \u2014 pre-push strict gate red${r}`)}}function MH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Lye(t){let e=[];t.lastFailedGate&&e.push(`failed ${t.lastFailedGate}`),typeof t.retryCount=="number"&&e.push(`${t.retryCount} retries`);let r=e.length?` (${e.join(", ")})`:"",n=t.recovery?`recover: ${t.recovery}${r}`:`rolled back${r}`;return VO(n)}function zye(t,e,r,n={}){let i=t.filter(m=>m&&m.payload&&m.payload.feature===r),o=e.filter(m=>m&&m.featureId===r).slice().sort((m,h)=>MH(m)-MH(h)),s=i.filter(m=>m.type==="drift_detected"||m.type==="done_attempted"&&m.payload.kept===!1),a=i.filter(m=>m.type==="feature_rolled_back");if(s.length===0&&a.length===0&&o.length===0)return;let c=o.length?o[o.length-1]:void 0,l;for(let m=s.length-1;m>=0;m--){let h=s[m].payload.gate;if(s[m].type==="drift_detected"&&typeof h=="string"&&h){l=h;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=s.slice(-jye).map(Fye),d;for(let m=a.length-1;m>=0;m--){let h=a[m].payload.to_git_head;if(typeof h=="string"&&h){d=h;break}}let f=typeof c?.retryCount=="number"?c.retryCount:void 0,p=c?Lye(c):void 0;return{attempts:s.length,...l?{last_failed_gate:l}:{},...f!==void 0?{retry_count:f}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...p?{recovery_hint:p}:{},...n.truncated?{truncated_history:!0}:{}}}function GO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Uye(t){let e=t.indexOf("## Recommended recovery");if(e<0)return;let r=t.slice(e).match(/```[^\n]*\n([\s\S]*?)```/);return r&&r[1].split(` +`).map(i=>i.trim()).find(i=>i.length>0)||void 0}function qye(t,e,r){let n=GO(t,/_Rolled back at_\s*`([^`]+)`/),i=GO(t,/Last failed gate:\s*`([^`]+)`/),o=GO(t,/Retry attempts:\s*(\d+)/),s=Uye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Bye(t,e){let r=ZO(t,".cladding","post-mortems");if(!FH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Dye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(qye(Nye(ZO(r,o),"utf8"),e,o))}catch{}return i}function LH(t,e){try{let r=P_(t),n=Bye(t,e),i=FH(ZO(t,".cladding","events.log.1.jsonl"));return zye(r,n,e,{truncated:i})}catch{return}}var jye,Mye,zH=y(()=>{"use strict";Mr();jye=5,Mye=120});function z_(t,e,r){return nn(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Hye,o=e,s,a=Rn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=gl(t,o);if("not_found"in c)return c;let l=c.focus,u=LH(n,l.id),d=a&&a.size>0?e:l.id,f=F_(t,d),p="not_found"in f?null:f.slice,m=p?p.impacted:[],h=p?p.test_refs:[],g="not_found"in f?null:{depth:f.depthUsed,stopped_by:f.stoppedBy,coverage:f.analysis.coverage===null?null:Math.round(f.analysis.coverage*100)/100,total_known_dependents:f.analysis.totalKnownDependents},b=l.acceptance_criteria??[],_=b.filter(se=>se.ears==="unwanted"||se.ears==="state").map(se=>({id:se.id,ears:String(se.ears)})),S=[...new Set(b.flatMap(se=>se.oracle_refs??[]))].sort(),x=[],w={must_edit:{id:l.id,title:l.title,status:l.status,modules:l.modules??[],acceptance_criteria:b,code:[],...s?{co_owners:s}:{}},needs:c.ancestors,breaks_if_changed:{impacted:m,regression_tests:h,...g?{radius:g}:{}},verify:{scenarios:c.scenarios,test_refs:c.test_refs,oracle_refs:S,high_risk_acs:_},guidance:{preferred_patterns:c.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},O=[...c.ancestors];for(;O.length>Gye&&z_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Ce)=>({impacted:se,regression_tests:Ce,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Ce,Kt,dr)=>{let Xt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],uo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Xt]}};return nn(JSON.stringify(uo))>i},re=m,K=h;if($(re,K,0,0)){let se=Sr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Xt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],uo=0;for(;Xt.length>Ce.size&&$(Xt,K,uo,0);)Xt=Xt.slice(0,-1),uo++;let ki=[...h],en=0;for(;$(Xt,ki,uo,en);){let de=-1;for(let fo=ki.length-1;fo>=0;fo--)if(!Kt.has(ki[fo])){de=fo;break}if(de<0)break;ki.splice(de,1),en++}re=Xt,K=ki,uo+en>0&&x.push(`breaks: omitted ${uo} feature(s) / ${en} test(s)`),$(re,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(re,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};nn(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Cr=nn(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Cr,truncated:x}}}var Hye,Gye,U_=y(()=>{"use strict";j_();L_();HO();zH();wa();os();Hye=3e3,Gye=3});function Qn(t){if(t.length===0)return 0;let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2?e[r]:(e[r-1]+e[r])/2}function Zye(t,e){if(t.length===0)return 0;let r=[...t].sort((n,i)=>n-i);return r[Math.min(r.length-1,Math.floor(e/100*r.length))]}function UH(t,e,r="."){let n=Rn(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=F_(t,f.id),g=!("not_found"in h),b=nn(JSON.stringify(p)),_="not_found"in m?b:nn(JSON.stringify(m)),S=nn(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=nn(T))}let x=(f.depends_on??[]).length,w=n.dependents.get(f.id)?.size??0;o.push({id:f.id,sliceTokens:b,structuralTokens:_,naiveTokens:S,contextRatio:S>0?b/S:1,budgetSaturated:p.budget.truncated.length>0,searchDepth:g?h.depthUsed:1,edgesResolved:x+w,stoppedBy:g?h.stoppedBy:"n/a",coverage:g?h.analysis.coverage:1,regressionTests:p.breaks_if_changed.regression_tests.length})}o.sort((f,p)=>f.id.localeCompare(p.id));let s=o.map(f=>f.contextRatio),a=f=>f.filter(p=>p.sliceTokens>0).map(p=>p.naiveTokens/p.sliceTokens),c=o.filter(f=>!f.budgetSaturated),l=o.filter(f=>f.budgetSaturated),u=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),d={};for(let f of o)d[f.stoppedBy]=(d[f.stoppedBy]??0)+1;return{featureCount:i.length,measured:o.length,context:{medianContextRatio:Math.round(Qn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Qn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Qn(a(c))*10)/10,medianShrinkTruncated:Math.round(Qn(a(l))*10)/10,medianStructuralRatio:Math.round(Qn(u)*100)/100,medianSliceTokens:Math.round(Qn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Qn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Qn(o.map(f=>f.searchDepth)),p95Depth:Zye(o.map(f=>f.searchDepth),95),medianEdges:Qn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Qn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Qn(o.map(f=>f.regressionTests))},features:o}}var yl,q_=y(()=>{"use strict";j_();HO();U_();os();yl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Vye,existsSync as WO,mkdirSync as Wye,readFileSync as qH}from"node:fs";import{dirname as Kye,join as Jye}from"node:path";function KO(t){return Jye(t,Yye,Xye)}function Qye(t,e){return{timestamp:new Date().toISOString(),head:Sa(t),spec_digest:LO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function BH(t,e){try{let r=Qye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=JO(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let o=KO(t),s=Kye(o);return WO(s)||Wye(s,{recursive:!0}),Vye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function HH(t){let e=[];for(let r of t.split(` +`)){let n=r.trim();if(n.length!==0)try{let i=JSON.parse(n);i&&typeof i=="object"&&i.context&&i.search&&i.stability&&e.push(i)}catch{}}return e}function JO(t,e){let r=KO(t);if(!WO(r))return[];let n;try{n=qH(r,"utf8")}catch{return[]}let i=HH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function GH(t){let e=KO(t);if(!WO(e))return{snapshots:[],unreadable:!1};let r;try{r=qH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=HH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Gf(t,e=0){let r=e>0?Math.round(t*10**e)/10**e:Math.round(t),n=r.toFixed(e);return r>0?`+${n}`:n}function ZH(t,e=5){let r=Math.max(0,t.length-e),i=[`measure trend \xB7 last ${t.slice(r).length} of ${t.length} snapshot(s)`];for(let o=r;o0?t[o-1]:null,c=(d,f=0)=>a?` (${Gf(d(s)-d(a),f)})`:"",l=s.timestamp.slice(0,19),u=s.head?s.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${s.featureCount} feat \xB7 slice ${s.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${s.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${s.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${s.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${s.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${yl}`),i.join(` +`)}var Yye,Xye,Zf=y(()=>{"use strict";Bf();q_();Yye=".cladding",Xye="measure.jsonl"});import{existsSync as e_e}from"node:fs";import{join as t_e}from"node:path";function _l(t){if(t.groups.reduce((i,o)=>i+o.features.length,0)===0&&t.unsharded_commits.length===0)return`no shipped changes since ${t.since}`;let r=[`# Changes since ${t.since}`,""];for(let i of t.groups){r.push(`## ${i.title}`,"");for(let o of i.features){r.push(`- **${o.title}** (${r_e[o.change]})`);for(let s of o.acceptance)r.push(` - ${s}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function WH(t){let e=t.snapshot,r=["## Measured (this release)",""];if(!e||!e.head)return r.push("not measured at this commit \u2014 run clad measure before tagging"),r.join(` +`);let n=e.context,i=e.stability;r.push(`- features measured: ${e.measured} of ${e.featureCount}`),r.push(`- median slice tokens: ${n.medianSliceTokens} vs ${n.medianNaiveTokens} naive`),r.push(`- median structural ratio: ${n.medianStructuralRatio.toFixed(2)}`),r.push(`- median coverage: ${i.medianCoverage.toFixed(2)}`),r.push(`- regression tests surfaced: ${i.medianRegressionTests}`);let o=t.sinceSnapshot;if(o){let s=t.sinceRef??(o.head?o.head.slice(0,7):"previous");r.push(`- since ${s}: slice ${Gf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Gf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Gf(i.medianCoverage-o.stability.medianCoverage,2)}`)}return r.push("",`head ${e.head.slice(0,7)} \xB7 spec_digest ${e.spec_digest}`,`reproduce: git checkout ${e.head} && clad measure`,"",yl),r.join(` +`)}function bl(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(o=>[o.id,o]));for(let o of t.groups)for(let s of o.features){let a=i.get(s.id);if(!a){n.push(`| ${s.id} | \u2014 | \u2014 | (removed from spec \u2014 see git history at ${t.since}) |`);continue}let c=a.acceptance_criteria??[];if(c.length===0){n.push(`| ${a.id} | \u2014 | \u2014 | (no acceptance criteria) |`);continue}for(let l of c)n.push(`| ${a.id} | ${l.id} | ${l.ears??"\u2014"} | ${i_e(l,r)} |`)}return n.join(` +`)}function i_e(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[o,s]of n_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${e_e(t_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function vl(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(s=>typeof s.id=="string"&&s.id.length>0).sort((s,a)=>s.id.localeCompare(a.id)),n=new Map(t.features.map(s=>[s.id,s])),i=new Set;for(let s of r){e.push(`## ${s.title??s.id}`,""),s.summary&&e.push(s.summary,"");for(let a of s.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),VH(e,c))}}let o=t.features.filter(s=>!i.has(s.id)&&s.status!=="archived").sort((s,a)=>s.id.localeCompare(a.id));if(o.length>0){e.push("## Uncategorized","");for(let s of o)VH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function VH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=CO(r);n&&t.push(`- ${n}`)}t.push("")}var r_e,n_e,B_=y(()=>{"use strict";Zf();q_();hl();r_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};n_e=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as o_e}from"node:fs";function Ri(t="./spec.yaml"){let e=o_e(t,"utf8");return(0,KH.parse)(e)}var KH,H_=y(()=>{"use strict";KH=St(er(),1)});var ss=v((Fr,eR)=>{"use strict";var YO=Fr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+YH(l)},"instance")):i!==void 0&&(this.property=i),e&&(this.message=e),n){var a=n.$id||n.id;this.schema=a||n}r!==void 0&&(this.instance=r),this.name=o,this.argument=s,this.stack=this.toString()};YO.prototype.toString=function(){return this.property+" "+this.message};var G_=Fr.ValidatorResult=function(e,r,n,i){this.instance=e,this.schema=r,this.options=n,this.path=i.path,this.propertyPath=i.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.throwFirst=n&&n.throwFirst,this.throwAll=n&&n.throwAll,this.disableFormat=n&&n.disableFormat===!0};G_.prototype.addError=function(e){var r;if(typeof e=="string")r=new YO(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");r=new YO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};G_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function s_e(t,e){return e+": "+t.toString()+` +`}G_.prototype.toString=function(e){return this.errors.map(s_e).join("")};Object.defineProperty(G_.prototype,"valid",{get:function(){return!this.errors.length}});eR.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var JH=Fr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};JH.prototype=Object.create(Error.prototype,{constructor:{value:JH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var XO=Fr.SchemaContext=function(e,r,n,i,o){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(s,a){return s+YH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};XO.prototype.resolve=function(e){return XH(this.base,e)};XO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=XH(this.base,i||"");var s=new XO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ei=Fr.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[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]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(t){return typeof t=="string"&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch{e=!1}return e},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ei.regexp=ei.regex;ei.pattern=ei.regex;ei.ipv4=ei["ip-address"];Fr.isFormat=function(e,r,n){if(typeof e=="string"&&ei[r]!==void 0){if(ei[r]instanceof RegExp)return ei[r].test(e);if(typeof ei[r]=="function")return ei[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var YH=Fr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Fr.deepCompareStrict=function t(e,r){if(typeof e!=typeof r)return!1;if(Array.isArray(e))return!Array.isArray(r)||e.length!==r.length?!1:e.every(function(o,s){return t(e[s],r[s])});if(typeof e=="object"){if(!e||!r)return e===r;var n=Object.keys(e),i=Object.keys(r);return n.length!==i.length?!1:n.every(function(o){return t(e[o],r[o])})}return e===r};function a_e(t,e,r,n){typeof r=="object"?e[n]=QO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function c_e(t,e,r){e[r]=t[r]}function l_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=QO(t[n],e[n]):r[n]=e[n]}function QO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(a_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(c_e.bind(null,t,n)),Object.keys(e).forEach(l_e.bind(null,t,e,n))),n}eR.exports.deepMerge=QO;Fr.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var o=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in e))return;e=e[o]}return e};function u_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Fr.encodePath=function(e){return e.map(u_e).join("")};Fr.getDecimalPlaces=function(e){var r=0;if(isNaN(e))return r;typeof e!="number"&&(e=Number(e));var n=e.toString().split("e");if(n.length===2){if(n[1][0]!=="-")return r;r=Number(n[1].slice(1))}var i=n[0].split(".");return i.length===2&&(r+=i[1].length),r};Fr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var XH=Fr.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:o,hash:s}=n;return i+o+s}return n.toString()}});var rG=v((G7e,tG)=>{"use strict";var on=ss(),Le=on.ValidatorResult,as=on.SchemaError,tR={};tR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=tR.validators={};ze.type=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=Array.isArray(r.type)?r.type:[r.type];if(!s.some(this.testType.bind(this,e,r,n,i))){var a=s.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o};function rR(t,e,r,n,i){var o=e.throwError,s=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=o,e.throwAll=s,!a.valid&&n instanceof Function&&n(a),a.valid}ze.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Le(e,r,n,i),s=new Le(e,r,n,i);if(!Array.isArray(r.anyOf))throw new as("anyOf must be an array");if(!r.anyOf.some(rR.bind(this,e,n,i,function(c){s.importErrors(c)}))){var a=r.anyOf.map(function(c,l){var u=c.$id||c.id;return u?"<"+u+">":c.title&&JSON.stringify(c.title)||c.$ref&&"<"+c.$ref+">"||"[subschema "+l+"]"});n.nestedErrors&&o.importErrors(s),o.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return o};ze.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new as("allOf must be an array");var o=new Le(e,r,n,i),s=this;return r.allOf.forEach(function(a,c){var l=s.validateSchema(e,a,n,i);if(!l.valid){var u=a.$id||a.id,d=u||a.title&&JSON.stringify(a.title)||a.$ref&&"<"+a.$ref+">"||"[subschema "+c+"]";o.addError({name:"allOf",argument:{id:d,length:l.errors.length,valid:l},message:"does not match allOf schema "+d+" with "+l.errors.length+" error[s]:"}),o.importErrors(l)}}),o};ze.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new as("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(rR.bind(this,e,n,i,function(l){s.importErrors(l)})).length,c=r.oneOf.map(function(l,u){var d=l.$id||l.id;return d||l.title&&JSON.stringify(l.title)||l.$ref&&"<"+l.$ref+">"||"[subschema "+u+"]"});return a!==1&&(n.nestedErrors&&o.importErrors(s),o.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),o};ze.if=function(e,r,n,i){if(e===void 0)return null;if(!on.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=rR.call(this,e,n,i,null,r.if),s=new Le(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!on.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),s.importErrors(a)}else{if(r.else===void 0)return;if(!on.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),s.importErrors(a)}return s};function nR(t,e){if(Object.hasOwnProperty.call(t,e))return t[e];if(e in t){for(;t=Object.getPrototypeOf(t);)if(Object.propertyIsEnumerable.call(t,e))return t[e]}}ze.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!on.isSchema(s))throw new as('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(nR(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};ze.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.properties||{};for(var a in s){var c=s[a];if(c!==void 0){if(c===null)throw new as('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=nR(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u)}}return o}};function QH(t,e,r,n,i,o){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var s=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,s,r,n);var a=this.validateSchema(t[i],s,r,n.makeChild(s,i));a.instance!==o.instance[i]&&(o.instance[i]=a.instance),o.importErrors(a)}}ze.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=r.patternProperties||{};for(var a in e){var c=!0;for(var l in s){var u=s[l];if(u!==void 0){if(u===null)throw new as('Unexpected null, expected schema in "patternProperties"');try{var d=new RegExp(l,"u")}catch{d=new RegExp(l)}if(d.test(a)){c=!1,typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,u,n,i);var f=this.validateSchema(e[a],u,n,i.makeChild(u,a));f.instance!==o.instance[a]&&(o.instance[a]=f.instance),o.importErrors(f)}}}c&&QH.call(this,e,r,n,i,a,o)}return o}};ze.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Le(e,r,n,i);for(var s in e)QH.call(this,e,r,n,i,s,o);return o}};ze.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length>=r.minProperties||o.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),o}};ze.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Le(e,r,n,i),s=Object.keys(e);return s.length<=r.maxProperties||o.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),o}};ze.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Le(e,r,n,i);return e.every(function(a,c){if(Array.isArray(r.items))var l=r.items[c]===void 0?r.additionalItems:r.items[c];else var l=r.items;if(l===void 0)return!0;if(l===!1)return s.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==s.instance[c]&&(s.instance[c]=u.instance),s.importErrors(u),!0}),s}};ze.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!on.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Le(e,r,n,i),a=e.some(function(c,l){var u=o.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&s.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),s}};ze.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||o.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),o}};ze.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Le(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return s||o.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),o}};ze.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Le(e,r,n,i),s=e=r.minLength||o.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),o}};ze.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Le(e,r,n,i),s=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(s?s.length:0);return a<=r.maxLength||o.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),o}};ze.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length>=r.minItems||o.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),o}};ze.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Le(e,r,n,i);return e.length<=r.maxItems||o.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),o}};function d_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var iR=ss();oR.exports.SchemaScanResult=nG;function nG(t,e){this.id=t,this.ref=e}oR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=iR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=iR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!iR.deepCompareStrict(s[f],l))throw new Error("Schema <"+f+"> already exists with different definition");return s[f]}s[f]=l,f[f.length-1]=="#"&&(s[f.substring(0,f.length-1)]=l)}i(f+"/items",Array.isArray(l.items)?l.items:[l.items]),i(f+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(f+"/additionalItems",l.additionalItems),o(f+"/properties",l.properties),n(f+"/additionalProperties",l.additionalProperties),o(f+"/definitions",l.definitions),o(f+"/patternProperties",l.patternProperties),o(f+"/dependencies",l.dependencies),i(f+"/disallow",l.disallow),i(f+"/allOf",l.allOf),i(f+"/anyOf",l.anyOf),i(f+"/oneOf",l.oneOf),n(f+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var iG=rG(),cs=ss(),oG=Z_().scan,sG=cs.ValidatorResult,f_e=cs.ValidatorResultError,Vf=cs.SchemaError,aG=cs.SchemaContext,p_e="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(iG.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=oG(r||p_e,e),o=r||e.$id||e.id;for(var s in i.id)this.schemas[s]=i.id[s];for(var s in i.ref)this.unresolvedRefs.push(s);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[o]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=cs.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Vf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Vf('Unexpected null in "type" keyword');if(typeof this.types[o]=="function")return this.types[o].call(this,e);if(o&&typeof o=="object"){var s=this.validateSchema(e,o,n,i);return s===void 0||!(s&&s.errors.length)}return!0}};var Ii=Jt.prototype.types={};Ii.string=function(e){return typeof e=="string"};Ii.number=function(e){return typeof e=="number"&&isFinite(e)};Ii.integer=function(e){return typeof e=="number"&&e%1===0};Ii.boolean=function(e){return typeof e=="boolean"};Ii.array=function(e){return Array.isArray(e)};Ii.null=function(e){return e===null};Ii.date=function(e){return e instanceof Date};Ii.any=function(e){return!0};Ii.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};lG.exports=Jt});var dG=v((W7e,go)=>{"use strict";var m_e=go.exports.Validator=uG();go.exports.ValidatorResult=ss().ValidatorResult;go.exports.ValidatorResultError=ss().ValidatorResultError;go.exports.ValidationError=ss().ValidationError;go.exports.SchemaError=ss().SchemaError;go.exports.SchemaScanResult=Z_().SchemaScanResult;go.exports.scan=Z_().scan;go.exports.validate=function(t,e,r){var n=new m_e;return n.validate(t,e,r)}});import{readFileSync as h_e}from"node:fs";import{dirname as g_e,join as y_e}from"node:path";import{fileURLToPath as __e}from"node:url";function x_e(t){let e=w_e.validate(t,S_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function pG(t){let e=x_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var dG,b_e,v_e,S_e,w_e,pG=y(()=>{"use strict";dG=St(uG(),1),b_e=g_e(__e(import.meta.url)),v_e=y_e(b_e,"schema.json"),S_e=JSON.parse(h_e(v_e,"utf8")),w_e=new dG.Validator});import{existsSync as sR,readdirSync as $_e}from"node:fs";import{dirname as k_e,join as ka,resolve as hG}from"node:path";function mG(t){return sR(t)?$_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(ka(t,r))):[]}function Ea(t,e){V_=e?{cwd:hG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return V_&&e==="spec.yaml"&&hG(t)===V_.cwd?V_.spec:E_e(t,e)}function E_e(t,e){let r=ka(t,e),n=Ri(r),i=ka(t,k_e(e),"spec");if(!n.features||n.features.length===0){let o=mG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=mG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");sR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(sR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return fG(n),n}var V_,Ue=y(()=>{"use strict";H_();pG();V_=null});import vl from"node:process";function lR(){return!!vl.stdout.isTTY}function L(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${aR[t]}${n}${cR} ${e}${i} -`):vl.stdout.write(`${n} ${e}${i} -`)}function Wf(t,e,r=""){if(!lR())return;let n=r?` ${r}`:"";vl.stdout.write(`${yG}${aR.start}\xB7${cR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=gG[t],i=r?` ${r}`:"";lR()?vl.stdout.write(`${yG}${aR[t]}${n}${cR} ${e}${i} -`):vl.stdout.write(`${n} ${e}${i} -`)}var gG,aR,cR,yG,Pi=y(()=>{"use strict";gG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cR="\x1B[0m",yG="\r\x1B[K"});import{createHash as qG}from"node:crypto";import{existsSync as ube,readFileSync as fR,writeFileSync as dbe}from"node:fs";import{join as W_}from"node:path";function fbe(t,e){let r=qG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(fR(W_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function HG(t,e){let r=qG("sha256");try{r.update(fR(W_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=W_(t,...BG);if(!ube(e))return null;let r;try{r=fR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function K_(t){return t.features?.size??t.v1?.size??0}function J_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==HG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===fbe(e,n)?{state:"fresh"}:{state:"stale"}}function GG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${HG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=pbe+`attested_modules: + `)}`)}var fG,b_e,v_e,S_e,w_e,mG=y(()=>{"use strict";fG=St(dG(),1),b_e=g_e(__e(import.meta.url)),v_e=y_e(b_e,"schema.json"),S_e=JSON.parse(h_e(v_e,"utf8")),w_e=new fG.Validator});import{existsSync as sR,readdirSync as $_e}from"node:fs";import{dirname as k_e,join as ka,resolve as gG}from"node:path";function hG(t){return sR(t)?$_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(ka(t,r))):[]}function Ea(t,e){V_=e?{cwd:gG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return V_&&e==="spec.yaml"&&gG(t)===V_.cwd?V_.spec:E_e(t,e)}function E_e(t,e){let r=ka(t,e),n=Ri(r),i=ka(t,k_e(e),"spec");if(!n.features||n.features.length===0){let o=hG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=hG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");sR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(sR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return pG(n),n}var V_,Ue=y(()=>{"use strict";H_();mG();V_=null});import Sl from"node:process";function lR(){return!!Sl.stdout.isTTY}function L(t,e,r=""){let n=yG[t],i=r?` ${r}`:"";lR()?Sl.stdout.write(`${aR[t]}${n}${cR} ${e}${i} +`):Sl.stdout.write(`${n} ${e}${i} +`)}function Wf(t,e,r=""){if(!lR())return;let n=r?` ${r}`:"";Sl.stdout.write(`${_G}${aR.start}\xB7${cR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=yG[t],i=r?` ${r}`:"";lR()?Sl.stdout.write(`${_G}${aR[t]}${n}${cR} ${e}${i} +`):Sl.stdout.write(`${n} ${e}${i} +`)}var yG,aR,cR,_G,Pi=y(()=>{"use strict";yG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},aR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},cR="\x1B[0m",_G="\r\x1B[K"});import{createHash as BG}from"node:crypto";import{existsSync as ube,readFileSync as fR,writeFileSync as dbe}from"node:fs";import{join as W_}from"node:path";function fbe(t,e){let r=BG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(fR(W_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function GG(t,e){let r=BG("sha256");try{r.update(fR(W_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ls(t){let e=W_(t,...HG);if(!ube(e))return null;let r;try{r=fR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function K_(t){return t.features?.size??t.v1?.size??0}function J_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==GG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===fbe(e,n)?{state:"fresh"}:{state:"stale"}}function ZG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${GG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=pbe+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return dbe(W_(t,...BG),s,"utf8"),!0}var BG,pbe,xl=y(()=>{"use strict";BG=["spec","attestation.yaml"];pbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return dbe(W_(t,...HG),s,"utf8"),!0}var HG,pbe,xl=y(()=>{"use strict";HG=["spec","attestation.yaml"];pbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN # \`clad check --tier=pre-push --strict\` gate \u2014 the file's one honest author. # Do not edit by hand. # @@ -212,53 +212,55 @@ attested_features: # Merge conflict here? NEVER hand-resolve the hashes \u2014 keep either side and run # \`clad check --tier=pre-push --strict\`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. -`});import{resolve as pR}from"node:path";function Y_(t){us={cwd:pR(t),results:new Map}}function ZG(t,e,r){!us||us.cwd!==pR(e)||us.results.set(t,r)}function X_(t,e){return!us||us.cwd!==pR(e)?null:us.results.get(t)??null}function Q_(){us=null}var us,$l=y(()=>{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var _o=y(()=>{});import{fileURLToPath as mbe}from"node:url";var kl,hbe,mR,hR,El=y(()=>{kl=(t,e)=>{let r=hR(hbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},hbe=t=>mR(t)?t.toString():t,mR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,hR=t=>t instanceof URL?mbe(t):t});var eb,gR=y(()=>{_o();El();eb=(t,e=[],r={})=>{let n=kl(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as gbe}from"node:string_decoder";var VG,WG,qt,bo,ybe,KG,_be,tb,JG,bbe,Jf,vbe,yR,Sbe,sn=y(()=>{({toString:VG}=Object.prototype),WG=t=>VG.call(t)==="[object ArrayBuffer]",qt=t=>VG.call(t)==="[object Uint8Array]",bo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ybe=new TextEncoder,KG=t=>ybe.encode(t),_be=new TextDecoder,tb=t=>_be.decode(t),JG=(t,e)=>bbe(t,e).join(""),bbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new gbe(e),n=t.map(o=>typeof o=="string"?KG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Jf=t=>t.length===1&&qt(t[0])?t[0]:yR(vbe(t)),vbe=t=>t.map(e=>typeof e=="string"?KG(e):e),yR=t=>{let e=new Uint8Array(Sbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Sbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as wbe}from"node:child_process";var eZ,tZ,xbe,$be,YG,kbe,XG,QG,Ebe,rZ=y(()=>{_o();sn();eZ=t=>Array.isArray(t)&&Array.isArray(t.raw),tZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=xbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},xbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=$be(i,t.raw[n]),c=XG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>QG(d)):[QG(l)];return XG(c,u,a)},$be=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=YG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],QG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return Ebe(t);throw t instanceof wbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Ebe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return tb(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import _R from"node:process";var ti,rb,In,nb,vo=y(()=>{ti=t=>rb.includes(t),rb=[_R.stdin,_R.stdout,_R.stderr],In=["stdin","stdout","stderr"],nb=t=>In[t]??`stdio[${t}]`});import{debuglog as Abe}from"node:util";var iZ,bR,Tbe,Obe,Rbe,Ibe,nZ,Pbe,vR,Cbe,Dbe,Nbe,jbe,SR,So,wo=y(()=>{_o();vo();iZ=t=>{let e={...t};for(let r of SR)e[r]=bR(t,r);return e},bR=(t,e)=>{let r=Array.from({length:Tbe(t)+1}),n=Obe(t[e],r,e);return Dbe(n,e)},Tbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,In.length):In.length,Obe=(t,e,r)=>Ot(t)?Rbe(t,e,r):e.fill(t),Rbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Ibe))for(let i of Pbe(n,r,e))e[i]=t[n];return e},Ibe=(t,e)=>nZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Pbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=vR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as pR}from"node:path";function Y_(t){us={cwd:pR(t),results:new Map}}function VG(t,e,r){!us||us.cwd!==pR(e)||us.results.set(t,r)}function X_(t,e){return!us||us.cwd!==pR(e)?null:us.results.get(t)??null}function Q_(){us=null}var us,$l=y(()=>{"use strict";us=null});function Ot(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}var _o=y(()=>{});import{fileURLToPath as mbe}from"node:url";var kl,hbe,mR,hR,El=y(()=>{kl=(t,e)=>{let r=hR(hbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},hbe=t=>mR(t)?t.toString():t,mR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,hR=t=>t instanceof URL?mbe(t):t});var eb,gR=y(()=>{_o();El();eb=(t,e=[],r={})=>{let n=kl(t,"First argument"),[i,o]=Ot(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let s=i.map(String),a=s.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Ot(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as gbe}from"node:string_decoder";var WG,KG,qt,bo,ybe,JG,_be,tb,YG,bbe,Jf,vbe,yR,Sbe,sn=y(()=>{({toString:WG}=Object.prototype),KG=t=>WG.call(t)==="[object ArrayBuffer]",qt=t=>WG.call(t)==="[object Uint8Array]",bo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ybe=new TextEncoder,JG=t=>ybe.encode(t),_be=new TextDecoder,tb=t=>_be.decode(t),YG=(t,e)=>bbe(t,e).join(""),bbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new gbe(e),n=t.map(o=>typeof o=="string"?JG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Jf=t=>t.length===1&&qt(t[0])?t[0]:yR(vbe(t)),vbe=t=>t.map(e=>typeof e=="string"?JG(e):e),yR=t=>{let e=new Uint8Array(Sbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Sbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as wbe}from"node:child_process";var tZ,rZ,xbe,$be,XG,kbe,QG,eZ,Ebe,nZ=y(()=>{_o();sn();tZ=t=>Array.isArray(t)&&Array.isArray(t.raw),rZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=xbe({templates:t,expressions:e,tokens:r,index:o,template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},xbe=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:o,leadingWhitespaces:s,trailingWhitespaces:a}=$be(i,t.raw[n]),c=QG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>eZ(d)):[eZ(l)];return QG(c,u,a)},$be=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=XG.has(e[0]);for(let s=0,a=0;sr||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],eZ=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Ot(t)&&("stdout"in t||"isMaxBuffer"in t))return Ebe(t);throw t instanceof wbe||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},Ebe=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return tb(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)}});import _R from"node:process";var ti,rb,In,nb,vo=y(()=>{ti=t=>rb.includes(t),rb=[_R.stdin,_R.stdout,_R.stderr],In=["stdin","stdout","stderr"],nb=t=>In[t]??`stdio[${t}]`});import{debuglog as Abe}from"node:util";var oZ,bR,Tbe,Obe,Rbe,Ibe,iZ,Pbe,vR,Cbe,Dbe,Nbe,jbe,SR,So,wo=y(()=>{_o();vo();oZ=t=>{let e={...t};for(let r of SR)e[r]=bR(t,r);return e},bR=(t,e)=>{let r=Array.from({length:Tbe(t)+1}),n=Obe(t[e],r,e);return Dbe(n,e)},Tbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,In.length):In.length,Obe=(t,e,r)=>Ot(t)?Rbe(t,e,r):e.fill(t),Rbe=(t,e,r)=>{for(let n of Object.keys(t).sort(Ibe))for(let i of Pbe(n,r,e))e[i]=t[n];return e},Ibe=(t,e)=>iZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,Pbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=vR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},vR=t=>{if(t==="all")return t;if(In.includes(t))return In.indexOf(t);let e=Cbe.exec(t);if(e!==null)return Number(e[1])},Cbe=/^fd(\d+)$/,Dbe=(t,e)=>t.map(r=>r===void 0?jbe[e]:r),Nbe=Abe("execa").enabled?"full":"none",jbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Nbe,stripFinalNewline:!0},SR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],So=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Al,Tl,oZ,wR,Mbe,ib,ob,ds=y(()=>{wo();Al=({verbose:t},e)=>wR(t,e)!=="none",Tl=({verbose:t},e)=>!["none","short"].includes(wR(t,e)),oZ=({verbose:t},e)=>{let r=wR(t,e);return ib(r)?r:void 0},wR=(t,e)=>e===void 0?Mbe(t):So(t,e),Mbe=t=>t.find(e=>ib(e))??ob.findLast(e=>t.includes(e)),ib=t=>typeof t=="function",ob=["none","short","full"]});import{platform as Fbe}from"node:process";import{stripVTControlCharacters as Lbe}from"node:util";var sZ,Yf,aZ,zbe,Ube,qbe,Bbe,Hbe,Gbe,Zbe,sb=y(()=>{sZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Gbe(aZ(o))).join(" ");return{command:n,escapedCommand:i}},Yf=t=>Lbe(t).split(` -`).map(e=>aZ(e)).join(` -`),aZ=t=>t.replaceAll(qbe,e=>zbe(e)),zbe=t=>{let e=Bbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Hbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Ube=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},qbe=Ube(),Bbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Hbe=65535,Gbe=t=>Zbe.test(t)?t:Fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Zbe=/^[\w./-]+$/});import cZ from"node:process";function xR(){let{env:t}=cZ,{TERM:e,TERM_PROGRAM:r}=t;return cZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var lZ=y(()=>{});var uZ,dZ,Vbe,Wbe,Kbe,Jbe,Ybe,ab,tet,fZ=y(()=>{lZ();uZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},dZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Vbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Wbe={...uZ,...dZ},Kbe={...uZ,...Vbe},Jbe=xR(),Ybe=Jbe?Wbe:Kbe,ab=Ybe,tet=Object.entries(dZ)});import Xbe from"node:tty";var Qbe,be,iet,pZ,oet,set,aet,cet,uet,det,fet,pet,met,het,get,yet,_et,bet,vet,cb,wet,xet,$et,ket,Eet,Aet,Tet,Oet,Ret,mZ,Iet,hZ,Pet,Cet,Det,Net,jet,Met,Fet,Let,zet,Uet,qet,$R=y(()=>{Qbe=Xbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Qbe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},iet=be(0,0),pZ=be(1,22),oet=be(2,22),set=be(3,23),aet=be(4,24),cet=be(53,55),uet=be(7,27),det=be(8,28),fet=be(9,29),pet=be(30,39),met=be(31,39),het=be(32,39),get=be(33,39),yet=be(34,39),_et=be(35,39),bet=be(36,39),vet=be(37,39),cb=be(90,39),wet=be(40,49),xet=be(41,49),$et=be(42,49),ket=be(43,49),Eet=be(44,49),Aet=be(45,49),Tet=be(46,49),Oet=be(47,49),Ret=be(100,49),mZ=be(91,39),Iet=be(92,39),hZ=be(93,39),Pet=be(94,39),Cet=be(95,39),Det=be(96,39),Net=be(97,39),jet=be(101,49),Met=be(102,49),Fet=be(103,49),Let=be(104,49),zet=be(105,49),Uet=be(106,49),qet=be(107,49)});var gZ=y(()=>{$R();$R()});var bZ,tve,lb,yZ,rve,_Z,nve,vZ=y(()=>{fZ();gZ();bZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=tve(r),c=rve[t]({failed:o,reject:s,piped:n}),l=nve[t]({reject:s});return`${cb(`[${a}]`)} ${cb(`[${i}]`)} ${l(c)} ${l(e)}`},tve=t=>`${lb(t.getHours(),2)}:${lb(t.getMinutes(),2)}:${lb(t.getSeconds(),2)}.${lb(t.getMilliseconds(),3)}`,lb=(t,e)=>String(t).padStart(e,"0"),yZ=({failed:t,reject:e})=>t?e?ab.cross:ab.warning:ab.tick,rve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:yZ,duration:yZ},_Z=t=>t,nve={command:()=>pZ,output:()=>_Z,ipc:()=>_Z,error:({reject:t})=>t?mZ:hZ,duration:()=>cb}});var SZ,ive,ove,wZ=y(()=>{ds();SZ=(t,e,r)=>{let n=oZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>ive(i,o,n)).filter(i=>i!==void 0).map(i=>ove(i)).join("")},ive=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ove=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},vR=t=>{if(t==="all")return t;if(In.includes(t))return In.indexOf(t);let e=Cbe.exec(t);if(e!==null)return Number(e[1])},Cbe=/^fd(\d+)$/,Dbe=(t,e)=>t.map(r=>r===void 0?jbe[e]:r),Nbe=Abe("execa").enabled?"full":"none",jbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Nbe,stripFinalNewline:!0},SR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],So=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Al,Tl,sZ,wR,Mbe,ib,ob,ds=y(()=>{wo();Al=({verbose:t},e)=>wR(t,e)!=="none",Tl=({verbose:t},e)=>!["none","short"].includes(wR(t,e)),sZ=({verbose:t},e)=>{let r=wR(t,e);return ib(r)?r:void 0},wR=(t,e)=>e===void 0?Mbe(t):So(t,e),Mbe=t=>t.find(e=>ib(e))??ob.findLast(e=>t.includes(e)),ib=t=>typeof t=="function",ob=["none","short","full"]});import{platform as Fbe}from"node:process";import{stripVTControlCharacters as Lbe}from"node:util";var aZ,Yf,cZ,zbe,Ube,qbe,Bbe,Hbe,Gbe,Zbe,sb=y(()=>{aZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Gbe(cZ(o))).join(" ");return{command:n,escapedCommand:i}},Yf=t=>Lbe(t).split(` +`).map(e=>cZ(e)).join(` +`),cZ=t=>t.replaceAll(qbe,e=>zbe(e)),zbe=t=>{let e=Bbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Hbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Ube=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},qbe=Ube(),Bbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Hbe=65535,Gbe=t=>Zbe.test(t)?t:Fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Zbe=/^[\w./-]+$/});import lZ from"node:process";function xR(){let{env:t}=lZ,{TERM:e,TERM_PROGRAM:r}=t;return lZ.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var uZ=y(()=>{});var dZ,fZ,Vbe,Wbe,Kbe,Jbe,Ybe,ab,tet,pZ=y(()=>{uZ();dZ={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},fZ={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Vbe={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Wbe={...dZ,...fZ},Kbe={...dZ,...Vbe},Jbe=xR(),Ybe=Jbe?Wbe:Kbe,ab=Ybe,tet=Object.entries(fZ)});import Xbe from"node:tty";var Qbe,be,iet,mZ,oet,set,aet,cet,uet,det,fet,pet,met,het,get,yet,_et,bet,vet,cb,wet,xet,$et,ket,Eet,Aet,Tet,Oet,Ret,hZ,Iet,gZ,Pet,Cet,Det,Net,jet,Met,Fet,Let,zet,Uet,qet,$R=y(()=>{Qbe=Xbe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Qbe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(n);if(s===-1)return r+o+n;let a=r,c=0,u=(e===22?n:"")+r;for(;s!==-1;)a+=o.slice(c,s)+u,c=s+n.length,s=o.indexOf(n,c);return a+=o.slice(c)+n,a}},iet=be(0,0),mZ=be(1,22),oet=be(2,22),set=be(3,23),aet=be(4,24),cet=be(53,55),uet=be(7,27),det=be(8,28),fet=be(9,29),pet=be(30,39),met=be(31,39),het=be(32,39),get=be(33,39),yet=be(34,39),_et=be(35,39),bet=be(36,39),vet=be(37,39),cb=be(90,39),wet=be(40,49),xet=be(41,49),$et=be(42,49),ket=be(43,49),Eet=be(44,49),Aet=be(45,49),Tet=be(46,49),Oet=be(47,49),Ret=be(100,49),hZ=be(91,39),Iet=be(92,39),gZ=be(93,39),Pet=be(94,39),Cet=be(95,39),Det=be(96,39),Net=be(97,39),jet=be(101,49),Met=be(102,49),Fet=be(103,49),Let=be(104,49),zet=be(105,49),Uet=be(106,49),qet=be(107,49)});var yZ=y(()=>{$R();$R()});var vZ,tve,lb,_Z,rve,bZ,nve,SZ=y(()=>{pZ();yZ();vZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=tve(r),c=rve[t]({failed:o,reject:s,piped:n}),l=nve[t]({reject:s});return`${cb(`[${a}]`)} ${cb(`[${i}]`)} ${l(c)} ${l(e)}`},tve=t=>`${lb(t.getHours(),2)}:${lb(t.getMinutes(),2)}:${lb(t.getSeconds(),2)}.${lb(t.getMilliseconds(),3)}`,lb=(t,e)=>String(t).padStart(e,"0"),_Z=({failed:t,reject:e})=>t?e?ab.cross:ab.warning:ab.tick,rve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:_Z,duration:_Z},bZ=t=>t,nve={command:()=>mZ,output:()=>bZ,ipc:()=>bZ,error:({reject:t})=>t?hZ:gZ,duration:()=>cb}});var wZ,ive,ove,xZ=y(()=>{ds();wZ=(t,e,r)=>{let n=sZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>ive(i,o,n)).filter(i=>i!==void 0).map(i=>ove(i)).join("")},ive=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ove=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as sve}from"node:util";var Ci,ave,cve,lve,ub,uve,Ol=y(()=>{sb();vZ();wZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ave({type:t,result:i,verboseInfo:n}),s=cve(e,o),a=SZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ave=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),cve=(t,e)=>t.split(` -`).map(r=>lve({...e,message:r})),lve=t=>({verboseLine:bZ(t),verboseObject:t}),ub=t=>{let e=typeof t=="string"?t:sve(t);return Yf(e).replaceAll(" "," ".repeat(uve))},uve=2});var xZ,$Z=y(()=>{ds();Ol();xZ=(t,e)=>{Al(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var kZ,dve,fve,pve,EZ=y(()=>{ds();kZ=(t,e,r)=>{pve(t);let n=dve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},dve=t=>Al({verbose:t})?fve++:void 0,fve=0n,pve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ob.includes(e)&&!ib(e)){let r=ob.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as AZ}from"node:process";var db,kR,fb=y(()=>{db=()=>AZ.bigint(),kR=t=>Number(AZ.bigint()-t)/1e6});var pb,ER=y(()=>{$Z();EZ();fb();sb();wo();pb=(t,e,r)=>{let n=db(),{command:i,escapedCommand:o}=sZ(t,e),s=bR(r,"verbose"),a=kZ(s,o,{...r});return xZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var PZ=v((mtt,IZ)=>{IZ.exports=RZ;RZ.sync=hve;var TZ=Ge("fs");function mve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{jZ.exports=DZ;DZ.sync=gve;var CZ=Ge("fs");function DZ(t,e,r){CZ.stat(t,function(n,i){r(n,n?!1:NZ(i,e))})}function gve(t,e){return NZ(CZ.statSync(t),e)}function NZ(t,e){return t.isFile()&&yve(t,e)}function yve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var LZ=v((ytt,FZ)=>{var gtt=Ge("fs"),mb;process.platform==="win32"||global.TESTING_WINDOWS?mb=PZ():mb=MZ();FZ.exports=AR;AR.sync=_ve;function AR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){AR(t,e||{},function(o,s){o?i(o):n(s)})})}mb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function _ve(t,e){try{return mb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var ZZ=v((_tt,GZ)=>{var Rl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zZ=Ge("path"),bve=Rl?";":":",UZ=LZ(),qZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),BZ=(t,e)=>{let r=e.colon||bve,n=t.match(/\//)||Rl&&t.match(/\\/)?[""]:[...Rl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Rl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Rl?i.split(r):[""];return Rl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},HZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=BZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(qZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=zZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];UZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},vve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=BZ(t,e),o=[];for(let s=0;s{"use strict";var VZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TR.exports=VZ;TR.exports.default=VZ});var XZ=v((vtt,YZ)=>{"use strict";var KZ=Ge("path"),Sve=ZZ(),wve=WZ();function JZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Sve.sync(t.command,{path:r[wve({env:r})],pathExt:e?KZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=KZ.resolve(i?t.options.cwd:"",s)),s}function xve(t){return JZ(t)||JZ(t,!0)}YZ.exports=xve});var QZ=v((Stt,RR)=>{"use strict";var OR=/([()\][%!^"`<>&|;, *?])/g;function $ve(t){return t=t.replace(OR,"^$1"),t}function kve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OR,"^$1"),e&&(t=t.replace(OR,"^$1")),t}RR.exports.command=$ve;RR.exports.argument=kve});var t9=v((wtt,e9)=>{"use strict";e9.exports=/^#!(.*)/});var n9=v((xtt,r9)=>{"use strict";var Eve=t9();r9.exports=(t="")=>{let e=t.match(Eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var o9=v(($tt,i9)=>{"use strict";var IR=Ge("fs"),Ave=n9();function Tve(t){let r=Buffer.alloc(150),n;try{n=IR.openSync(t,"r"),IR.readSync(n,r,0,150,0),IR.closeSync(n)}catch{}return Ave(r.toString())}i9.exports=Tve});var l9=v((ktt,c9)=>{"use strict";var Ove=Ge("path"),s9=XZ(),a9=QZ(),Rve=o9(),Ive=process.platform==="win32",Pve=/\.(?:com|exe)$/i,Cve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Dve(t){t.file=s9(t);let e=t.file&&Rve(t.file);return e?(t.args.unshift(t.file),t.command=e,s9(t)):t.file}function Nve(t){if(!Ive)return t;let e=Dve(t),r=!Pve.test(e);if(t.options.forceShell||r){let n=Cve.test(e);t.command=Ove.normalize(t.command),t.command=a9.command(t.command),t.args=t.args.map(o=>a9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function jve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Nve(n)}c9.exports=jve});var f9=v((Ett,d9)=>{"use strict";var PR=process.platform==="win32";function CR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Mve(t,e){if(!PR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=u9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function u9(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawn"):null}function Fve(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawnSync"):null}d9.exports={hookChildProcess:Mve,verifyENOENT:u9,verifyENOENTSync:Fve,notFoundError:CR}});var h9=v((Att,Il)=>{"use strict";var p9=Ge("child_process"),DR=l9(),NR=f9();function m9(t,e,r){let n=DR(t,e,r),i=p9.spawn(n.command,n.args,n.options);return NR.hookChildProcess(i,n),i}function Lve(t,e,r){let n=DR(t,e,r),i=p9.spawnSync(n.command,n.args,n.options);return i.error=i.error||NR.verifyENOENTSync(i.status,n),i}Il.exports=m9;Il.exports.spawn=m9;Il.exports.sync=Lve;Il.exports._parse=DR;Il.exports._enoent=NR});function hb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var g9=y(()=>{});var y9=y(()=>{});import{promisify as zve}from"node:util";import{execFile as Uve,execFileSync as Ptt}from"node:child_process";import _9 from"node:path";import{fileURLToPath as qve}from"node:url";function gb(t){return t instanceof URL?qve(t):t}function b9(t){return{*[Symbol.iterator](){let e=_9.resolve(gb(t)),r;for(;r!==e;)yield e,r=e,e=_9.resolve(e,"..")}}}var Ntt,jtt,v9=y(()=>{y9();Ntt=zve(Uve);jtt=10*1024*1024});import yb from"node:process";import Ra from"node:path";var Bve,Hve,Gve,S9,w9=y(()=>{g9();v9();Bve=({cwd:t=yb.cwd(),path:e=yb.env[hb()],preferLocal:r=!0,execPath:n=yb.execPath,addExecPath:i=!0}={})=>{let o=Ra.resolve(gb(t)),s=[],a=e.split(Ra.delimiter);return r&&Hve(s,a,o),i&&Gve(s,a,n,o),e===""||e===Ra.delimiter?`${s.join(Ra.delimiter)}${e}`:[...s,e].join(Ra.delimiter)},Hve=(t,e,r)=>{for(let n of b9(r)){let i=Ra.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Gve=(t,e,r,n)=>{let i=Ra.resolve(n,gb(r),"..");e.includes(i)||t.push(i)},S9=({env:t=yb.env,...e}={})=>{t={...t};let r=hb({env:t});return e.path=t[r],t[r]=Bve(e),t}});var x9,ri,$9,k9,E9,_b,Xf,Qf,Ia=y(()=>{x9=(t,e,r)=>{let n=r?Qf:Xf,i=t instanceof ri?{}:{cause:t};return new n(e,i)},ri=class extends Error{},$9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,E9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},k9=t=>_b(t)&&E9 in t,E9=Symbol("isExecaError"),_b=t=>Object.prototype.toString.call(t)==="[object Error]",Xf=class extends Error{};$9(Xf,Xf.name);Qf=class extends Error{};$9(Qf,Qf.name)});var A9,Zve,T9,O9,R9=y(()=>{A9=()=>{let t=O9-T9+1;return Array.from({length:t},Zve)},Zve=(t,e)=>({name:`SIGRT${e+1}`,number:T9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),T9=34,O9=64});var I9,P9=y(()=>{I9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Vve}from"node:os";var jR,Wve,C9=y(()=>{P9();R9();jR=()=>{let t=A9();return[...I9,...t].map(Wve)},Wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Vve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Kve}from"node:os";var Jve,Yve,D9,Xve,Qve,eSe,Qtt,N9=y(()=>{C9();Jve=()=>{let t=jR();return Object.fromEntries(t.map(Yve))},Yve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],D9=Jve(),Xve=()=>{let t=jR(),e=65,r=Array.from({length:e},(n,i)=>Qve(i,t));return Object.assign({},...r)},Qve=(t,e)=>{let r=eSe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},eSe=(t,e)=>{let r=e.find(({name:n})=>Kve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Qtt=Xve()});import{constants as ep}from"node:os";var M9,F9,L9,tSe,rSe,j9,nSe,MR,iSe,oSe,bb,tp=y(()=>{N9();M9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return L9(t,e)},F9=t=>t===0?t:L9(t,"`subprocess.kill()`'s argument"),L9=(t,e)=>{if(Number.isInteger(t))return tSe(t,e);if(typeof t=="string")return nSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${MR()}`)},tSe=(t,e)=>{if(j9.has(t))return j9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${MR()}`)},rSe=()=>new Map(Object.entries(ep.signals).reverse().map(([t,e])=>[e,t])),j9=rSe(),nSe=(t,e)=>{if(t in ep.signals)return t;throw t.toUpperCase()in ep.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +`});import{inspect as sve}from"node:util";var Ci,ave,cve,lve,ub,uve,Ol=y(()=>{sb();SZ();xZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=ave({type:t,result:i,verboseInfo:n}),s=cve(e,o),a=wZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},ave=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...o}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:o}),cve=(t,e)=>t.split(` +`).map(r=>lve({...e,message:r})),lve=t=>({verboseLine:vZ(t),verboseObject:t}),ub=t=>{let e=typeof t=="string"?t:sve(t);return Yf(e).replaceAll(" "," ".repeat(uve))},uve=2});var $Z,kZ=y(()=>{ds();Ol();$Z=(t,e)=>{Al(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var EZ,dve,fve,pve,AZ=y(()=>{ds();EZ=(t,e,r)=>{pve(t);let n=dve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},dve=t=>Al({verbose:t})?fve++:void 0,fve=0n,pve=t=>{for(let e of t){if(e===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(e===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!ob.includes(e)&&!ib(e)){let r=ob.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as TZ}from"node:process";var db,kR,fb=y(()=>{db=()=>TZ.bigint(),kR=t=>Number(TZ.bigint()-t)/1e6});var pb,ER=y(()=>{kZ();AZ();fb();sb();wo();pb=(t,e,r)=>{let n=db(),{command:i,escapedCommand:o}=aZ(t,e),s=bR(r,"verbose"),a=EZ(s,o,{...r});return $Z(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var CZ=v((mtt,PZ)=>{PZ.exports=IZ;IZ.sync=hve;var OZ=Ge("fs");function mve(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{MZ.exports=NZ;NZ.sync=gve;var DZ=Ge("fs");function NZ(t,e,r){DZ.stat(t,function(n,i){r(n,n?!1:jZ(i,e))})}function gve(t,e){return jZ(DZ.statSync(t),e)}function jZ(t,e){return t.isFile()&&yve(t,e)}function yve(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var zZ=v((ytt,LZ)=>{var gtt=Ge("fs"),mb;process.platform==="win32"||global.TESTING_WINDOWS?mb=CZ():mb=FZ();LZ.exports=AR;AR.sync=_ve;function AR(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){AR(t,e||{},function(o,s){o?i(o):n(s)})})}mb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function _ve(t,e){try{return mb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var VZ=v((_tt,ZZ)=>{var Rl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",UZ=Ge("path"),bve=Rl?";":":",qZ=zZ(),BZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),HZ=(t,e)=>{let r=e.colon||bve,n=t.match(/\//)||Rl&&t.match(/\\/)?[""]:[...Rl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Rl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Rl?i.split(r):[""];return Rl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},GZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=HZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(BZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=UZ.join(p,t),h=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;u(c(h,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let m=i[d];qZ(l+m,{pathExt:o},(h,g)=>{if(!h&&g)if(e.all)s.push(l+m);else return f(l+m);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},vve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=HZ(t,e),o=[];for(let s=0;s{"use strict";var WZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TR.exports=WZ;TR.exports.default=WZ});var QZ=v((vtt,XZ)=>{"use strict";var JZ=Ge("path"),Sve=VZ(),wve=KZ();function YZ(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=Sve.sync(t.command,{path:r[wve({env:r})],pathExt:e?JZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=JZ.resolve(i?t.options.cwd:"",s)),s}function xve(t){return YZ(t)||YZ(t,!0)}XZ.exports=xve});var e9=v((Stt,RR)=>{"use strict";var OR=/([()\][%!^"`<>&|;, *?])/g;function $ve(t){return t=t.replace(OR,"^$1"),t}function kve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OR,"^$1"),e&&(t=t.replace(OR,"^$1")),t}RR.exports.command=$ve;RR.exports.argument=kve});var r9=v((wtt,t9)=>{"use strict";t9.exports=/^#!(.*)/});var i9=v((xtt,n9)=>{"use strict";var Eve=r9();n9.exports=(t="")=>{let e=t.match(Eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var s9=v(($tt,o9)=>{"use strict";var IR=Ge("fs"),Ave=i9();function Tve(t){let r=Buffer.alloc(150),n;try{n=IR.openSync(t,"r"),IR.readSync(n,r,0,150,0),IR.closeSync(n)}catch{}return Ave(r.toString())}o9.exports=Tve});var u9=v((ktt,l9)=>{"use strict";var Ove=Ge("path"),a9=QZ(),c9=e9(),Rve=s9(),Ive=process.platform==="win32",Pve=/\.(?:com|exe)$/i,Cve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Dve(t){t.file=a9(t);let e=t.file&&Rve(t.file);return e?(t.args.unshift(t.file),t.command=e,a9(t)):t.file}function Nve(t){if(!Ive)return t;let e=Dve(t),r=!Pve.test(e);if(t.options.forceShell||r){let n=Cve.test(e);t.command=Ove.normalize(t.command),t.command=c9.command(t.command),t.args=t.args.map(o=>c9.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function jve(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Nve(n)}l9.exports=jve});var p9=v((Ett,f9)=>{"use strict";var PR=process.platform==="win32";function CR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function Mve(t,e){if(!PR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=d9(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function d9(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawn"):null}function Fve(t,e){return PR&&t===1&&!e.file?CR(e.original,"spawnSync"):null}f9.exports={hookChildProcess:Mve,verifyENOENT:d9,verifyENOENTSync:Fve,notFoundError:CR}});var g9=v((Att,Il)=>{"use strict";var m9=Ge("child_process"),DR=u9(),NR=p9();function h9(t,e,r){let n=DR(t,e,r),i=m9.spawn(n.command,n.args,n.options);return NR.hookChildProcess(i,n),i}function Lve(t,e,r){let n=DR(t,e,r),i=m9.spawnSync(n.command,n.args,n.options);return i.error=i.error||NR.verifyENOENTSync(i.status,n),i}Il.exports=h9;Il.exports.spawn=h9;Il.exports.sync=Lve;Il.exports._parse=DR;Il.exports._enoent=NR});function hb(t={}){let{env:e=process.env,platform:r=process.platform}=t;return r!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}var y9=y(()=>{});var _9=y(()=>{});import{promisify as zve}from"node:util";import{execFile as Uve,execFileSync as Ptt}from"node:child_process";import b9 from"node:path";import{fileURLToPath as qve}from"node:url";function gb(t){return t instanceof URL?qve(t):t}function v9(t){return{*[Symbol.iterator](){let e=b9.resolve(gb(t)),r;for(;r!==e;)yield e,r=e,e=b9.resolve(e,"..")}}}var Ntt,jtt,S9=y(()=>{_9();Ntt=zve(Uve);jtt=10*1024*1024});import yb from"node:process";import Ia from"node:path";var Bve,Hve,Gve,w9,x9=y(()=>{y9();S9();Bve=({cwd:t=yb.cwd(),path:e=yb.env[hb()],preferLocal:r=!0,execPath:n=yb.execPath,addExecPath:i=!0}={})=>{let o=Ia.resolve(gb(t)),s=[],a=e.split(Ia.delimiter);return r&&Hve(s,a,o),i&&Gve(s,a,n,o),e===""||e===Ia.delimiter?`${s.join(Ia.delimiter)}${e}`:[...s,e].join(Ia.delimiter)},Hve=(t,e,r)=>{for(let n of v9(r)){let i=Ia.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Gve=(t,e,r,n)=>{let i=Ia.resolve(n,gb(r),"..");e.includes(i)||t.push(i)},w9=({env:t=yb.env,...e}={})=>{t={...t};let r=hb({env:t});return e.path=t[r],t[r]=Bve(e),t}});var $9,ri,k9,E9,A9,_b,Xf,Qf,Pa=y(()=>{$9=(t,e,r)=>{let n=r?Qf:Xf,i=t instanceof ri?{}:{cause:t};return new n(e,i)},ri=class extends Error{},k9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,A9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},E9=t=>_b(t)&&A9 in t,A9=Symbol("isExecaError"),_b=t=>Object.prototype.toString.call(t)==="[object Error]",Xf=class extends Error{};k9(Xf,Xf.name);Qf=class extends Error{};k9(Qf,Qf.name)});var T9,Zve,O9,R9,I9=y(()=>{T9=()=>{let t=R9-O9+1;return Array.from({length:t},Zve)},Zve=(t,e)=>({name:`SIGRT${e+1}`,number:O9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),O9=34,R9=64});var P9,C9=y(()=>{P9=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as Vve}from"node:os";var jR,Wve,D9=y(()=>{C9();I9();jR=()=>{let t=T9();return[...P9,...t].map(Wve)},Wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Vve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Kve}from"node:os";var Jve,Yve,N9,Xve,Qve,eSe,Qtt,j9=y(()=>{D9();Jve=()=>{let t=jR();return Object.fromEntries(t.map(Yve))},Yve=({name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:o,standard:s}],N9=Jve(),Xve=()=>{let t=jR(),e=65,r=Array.from({length:e},(n,i)=>Qve(i,t));return Object.assign({},...r)},Qve=(t,e)=>{let r=eSe(t,e);if(r===void 0)return{};let{name:n,description:i,supported:o,action:s,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:o,action:s,forced:a,standard:c}}},eSe=(t,e)=>{let r=e.find(({name:n})=>Kve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Qtt=Xve()});import{constants as ep}from"node:os";var F9,L9,z9,tSe,rSe,M9,nSe,MR,iSe,oSe,bb,tp=y(()=>{j9();F9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return z9(t,e)},L9=t=>t===0?t:z9(t,"`subprocess.kill()`'s argument"),z9=(t,e)=>{if(Number.isInteger(t))return tSe(t,e);if(typeof t=="string")return nSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${MR()}`)},tSe=(t,e)=>{if(M9.has(t))return M9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${MR()}`)},rSe=()=>new Map(Object.entries(ep.signals).reverse().map(([t,e])=>[e,t])),M9=rSe(),nSe=(t,e)=>{if(t in ep.signals)return t;throw t.toUpperCase()in ep.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. ${MR()}`)},MR=()=>`Available signal names: ${iSe()}. -Available signal numbers: ${oSe()}.`,iSe=()=>Object.keys(ep.signals).sort().map(t=>`'${t}'`).join(", "),oSe=()=>[...new Set(Object.values(ep.signals).sort((t,e)=>t-e))].join(", "),bb=t=>D9[t].description});import{setTimeout as sSe}from"node:timers/promises";var z9,aSe,U9,cSe,lSe,uSe,FR,vb=y(()=>{Ia();tp();z9=t=>{if(t===!1)return t;if(t===!0)return aSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},aSe=1e3*5,U9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=cSe(s,a,r);lSe(l,n);let u=t(c);return uSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},cSe=(t,e,r)=>{let[n=r,i]=_b(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!_b(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:F9(n),error:i}},lSe=(t,e)=>{t!==void 0&&e.reject(t)},uSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await sSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as dSe}from"node:events";var Sb,LR=y(()=>{Sb=async(t,e)=>{t.aborted||await dSe(t,"abort",{signal:e})}});var q9,B9,fSe,zR=y(()=>{LR();q9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},B9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[fSe(t,e,n,i)],fSe=async(t,e,r,{signal:n})=>{throw await Sb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Pl,pSe,UR,H9,G9,wb,Z9,V9,W9,K9,J9,Y9,mSe,hSe,gSe,ni,ySe,fs,Cl,Dl=y(()=>{Pl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{pSe(t,e,r),UR(t,e,n)},pSe=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},UR=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},H9=t=>{throw new Error(`${ni("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},G9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. +Available signal numbers: ${oSe()}.`,iSe=()=>Object.keys(ep.signals).sort().map(t=>`'${t}'`).join(", "),oSe=()=>[...new Set(Object.values(ep.signals).sort((t,e)=>t-e))].join(", "),bb=t=>N9[t].description});import{setTimeout as sSe}from"node:timers/promises";var U9,aSe,q9,cSe,lSe,uSe,FR,vb=y(()=>{Pa();tp();U9=t=>{if(t===!1)return t;if(t===!0)return aSe;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},aSe=1e3*5,q9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=cSe(s,a,r);lSe(l,n);let u=t(c);return uSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},cSe=(t,e,r)=>{let[n=r,i]=_b(t)?[void 0,t]:[t,e];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(n)}`);if(i!==void 0&&!_b(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:L9(n),error:i}},lSe=(t,e)=>{t!==void 0&&e.reject(t)},uSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&FR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},FR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await sSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as dSe}from"node:events";var Sb,LR=y(()=>{Sb=async(t,e)=>{t.aborted||await dSe(t,"abort",{signal:e})}});var B9,H9,fSe,zR=y(()=>{LR();B9=({cancelSignal:t})=>{if(t!==void 0&&Object.prototype.toString.call(t)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(t)}`)},H9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[fSe(t,e,n,i)],fSe=async(t,e,r,{signal:n})=>{throw await Sb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Pl,pSe,UR,G9,Z9,wb,V9,W9,K9,J9,Y9,X9,mSe,hSe,gSe,ni,ySe,fs,Cl,Dl=y(()=>{Pl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{pSe(t,e,r),UR(t,e,n)},pSe=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},UR=(t,e,r)=>{if(!r)throw new Error(`${ni(t,e)} cannot be used: the ${fs(e)} has already exited or disconnected.`)},G9=t=>{throw new Error(`${ni("getOneMessage",t)} could not complete: the ${fs(t)} exited or disconnected.`)},Z9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is sending a message too, instead of listening to incoming messages. This can be fixed by both sending a message and listening to incoming messages at the same time: const [receivedMessage] = await Promise.all([ ${ni("getOneMessage",t)}, ${ni("sendMessage",t,"message, {strict: true}")}, -]);`)},wb=(t,e)=>new Error(`${ni("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),Z9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},V9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},W9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),K9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},J9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ni(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},Y9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(mSe(t))throw new Error(`${ni(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},mSe=({code:t,message:e})=>hSe.has(t)||gSe.some(r=>e.includes(r)),hSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),gSe=["could not be cloned","circular structure","call stack size exceeded"],ni=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${ySe(e)}${t}(${r})`,ySe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Cl=t=>{t.connected&&t.disconnect()}});var Di,Nl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var $b,jl,Ni,X9,_Se,bSe,Q9,vSe,eV,rp,xb,ps=y(()=>{wo();$b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(Q9(o,e,n,!0));return s},jl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=X9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(Q9(o,e,n,!1));return s},Ni=new WeakMap,X9=(t,e,r)=>{let n=_Se(e,r);return bSe(n,e,r,t),n},_Se=(t,e)=>{let r=vR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${rp(e)}" must not be "${t}". +]);`)},wb=(t,e)=>new Error(`${ni("sendMessage",e)} failed when sending an acknowledgment response to the ${fs(e)}.`,{cause:t}),V9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} is not listening to incoming messages.`)},W9=t=>{throw new Error(`${ni("sendMessage",t)} failed: the ${fs(t)} exited without listening to incoming messages.`)},K9=()=>new Error(`\`cancelSignal\` aborted: the ${fs(!0)} disconnected.`),J9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},Y9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ni(e,r)} cannot be used: the ${fs(r)} is disconnecting.`,{cause:t})},X9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(mSe(t))throw new Error(`${ni(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},mSe=({code:t,message:e})=>hSe.has(t)||gSe.some(r=>e.includes(r)),hSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),gSe=["could not be cloned","circular structure","call stack size exceeded"],ni=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${ySe(e)}${t}(${r})`,ySe=t=>t?"":"subprocess.",fs=t=>t?"parent process":"subprocess",Cl=t=>{t.connected&&t.disconnect()}});var Di,Nl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var $b,jl,Ni,Q9,_Se,bSe,eV,vSe,tV,rp,xb,ps=y(()=>{wo();$b=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=Q9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(eV(o,e,n,!0));return s},jl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=Q9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(eV(o,e,n,!1));return s},Ni=new WeakMap,Q9=(t,e,r)=>{let n=_Se(e,r);return bSe(n,e,r,t),n},_Se=(t,e)=>{let r=vR(t);if(r!==void 0)return r;let{validOptions:n,defaultValue:i}=e?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${rp(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},bSe=(t,e,r,n)=>{let i=n[eV(t)];if(i===void 0)throw new TypeError(`"${rp(r)}" must not be ${e}. That file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a writable stream, not readable.`)},Q9=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=vSe(t,r);return`The "${i}: ${xb(o)}" option is incompatible with using "${rp(n)}: ${xb(e)}". -Please set this option with "pipe" instead.`},vSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=eV(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},eV=t=>t==="all"?1:t,rp=t=>t?"to":"from",xb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as SSe}from"node:events";var Pa,kb=y(()=>{Pa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),SSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Eb,qR,Ab,BR,tV,rV,np=y(()=>{Eb=(t,e)=>{e&&qR(t)},qR=t=>{t.refCounted()},Ab=(t,e)=>{e&&BR(t)},BR=t=>{t.unrefCounted()},tV=(t,e)=>{e&&(BR(t),BR(t))},rV=(t,e)=>{e&&(qR(t),qR(t))}});import{once as wSe}from"node:events";import{scheduler as xSe}from"node:timers/promises";var nV,iV,Tb,oV=y(()=>{Rb();np();Ob();Ib();nV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(aV(i)||lV(i))return;Tb.has(t)||Tb.set(t,[]);let o=Tb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await cV(t,n,i),await xSe.yield();let s=await sV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},iV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HR();let o=Tb.get(t);for(;o?.length>0;)await wSe(n,"message:done");t.removeListener("message",i),rV(e,r),n.connected=!1,n.emit("disconnect")},Tb=new WeakMap});import{EventEmitter as $Se}from"node:events";var ms,Pb,kSe,Cb,ip=y(()=>{oV();np();ms=(t,e,r)=>{if(Pb.has(t))return Pb.get(t);let n=new $Se;return n.connected=!0,Pb.set(t,n),kSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Pb=new WeakMap,kSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=nV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",iV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),tV(r,n)},Cb=t=>{let e=Pb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as ESe}from"node:events";var uV,ASe,dV,sV,aV,fV,Db,TSe,Nb,pV,Ob=y(()=>{Nl();kb();Fb();Dl();ip();Rb();uV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=jb(t,o);return{id:ASe++,type:Nb,message:n,hasListeners:s}},ASe=0n,dV=(t,e)=>{if(!(e?.type!==Nb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Db[r].resolve({isDeadlock:!0,hasListeners:!1})},sV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Nb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:pV,message:jb(e,i)};try{await Mb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},aV=t=>{if(t?.type!==pV)return!1;let{id:e,message:r}=t;return Db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},fV=async(t,e,r)=>{if(t?.type!==Nb)return;let n=Di();Db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,TSe(e,r,i)]);o&&G9(r),s||Z9(r)}finally{i.abort(),delete Db[t.id]}},Db={},TSe=async(t,e,{signal:r})=>{Pa(t,1,r),await ESe(t,"disconnect",{signal:r}),V9(e)},Nb="execa:ipc:request",pV="execa:ipc:response"});var mV,hV,cV,op,jb,OSe,Rb=y(()=>{Nl();wo();ps();Ob();mV=(t,e,r)=>{op.has(t)||op.set(t,new Set);let n=op.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},hV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},cV=async(t,e,r)=>{for(;!jb(t,e)&&op.get(t)?.size>0;){let n=[...op.get(t)];dV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},op=new WeakMap,jb=(t,e)=>e.listenerCount("message")>OSe(t),OSe=t=>Ni.has(t)&&!So(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as RSe}from"node:util";var Mb,ISe,ZR,PSe,GR,Fb=y(()=>{Dl();Rb();Ob();Mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Pl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),ISe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ISe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=uV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=mV(t,s,o);try{await ZR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Cl(t),c}finally{hV(a)}},ZR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=PSe(t);try{await Promise.all([fV(n,t,r),o(n)])}catch(s){throw J9({error:s,methodName:e,isSubprocess:r}),Y9({error:s,methodName:e,isSubprocess:r,message:i}),s}},PSe=t=>{if(GR.has(t))return GR.get(t);let e=RSe(t.send.bind(t));return GR.set(t,e),e},GR=new WeakMap});import{scheduler as CSe}from"node:timers/promises";var yV,_V,DSe,gV,lV,bV,HR,VR,Ib=y(()=>{Fb();ip();Dl();yV=(t,e)=>{let r="cancelSignal";return UR(r,!1,t.connected),ZR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:bV,message:e},message:e})},_V=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await DSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),VR.signal),DSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!gV){if(gV=!0,!n){K9();return}if(e===null){HR();return}ms(t,e,r),await CSe.yield()}},gV=!1,lV=t=>t?.type!==bV?!1:(VR.abort(t.message),!0),bV="execa:ipc:cancel",HR=()=>{VR.abort(W9())},VR=new AbortController});var vV,SV,NSe,jSe,WR=y(()=>{LR();Ib();vb();vV=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},SV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[NSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],NSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Sb(e,i);let o=jSe(e);throw await yV(t,o),FR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},jSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as MSe}from"node:timers/promises";var wV,xV,FSe,KR=y(()=>{Ia();wV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},xV=(t,e,r,n)=>e===0||e===void 0?[]:[FSe(t,e,r,n)],FSe=async(t,e,r,{signal:n})=>{throw await MSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ri}});import{execPath as LSe,execArgv as zSe}from"node:process";import $V from"node:path";var kV,EV,JR=y(()=>{El();kV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},EV=(t,e,{node:r=!1,nodePath:n=LSe,nodeOptions:i=zSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=kl(n,'The "nodePath" option'),l=$V.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if($V.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as USe}from"node:v8";var AV,qSe,BSe,HSe,TV,YR=y(()=>{AV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");HSe[r](t)}},qSe=t=>{try{USe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},BSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},HSe={advanced:qSe,json:BSe},TV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var RV,GSe,an,XR,ZSe,OV,Lb,Ca=y(()=>{RV=({encoding:t})=>{if(XR.has(t))return;let e=ZSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. +It is optional and defaults to "${i}".`)},bSe=(t,e,r,n)=>{let i=n[tV(t)];if(i===void 0)throw new TypeError(`"${rp(r)}" must not be ${e}. That file descriptor does not exist. +Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction==="input"&&!r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${rp(r)}" must not be ${e}. It must be a writable stream, not readable.`)},eV=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:o}=vSe(t,r);return`The "${i}: ${xb(o)}" option is incompatible with using "${rp(n)}: ${xb(e)}". +Please set this option with "pipe" instead.`},vSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=tV(t);return o===0&&e!==void 0?{optionName:"stdin",optionValue:e}:o===1&&r!==void 0?{optionName:"stdout",optionValue:r}:o===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${o}]`,optionValue:i[o]}},tV=t=>t==="all"?1:t,rp=t=>t?"to":"from",xb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as SSe}from"node:events";var Ca,kb=y(()=>{Ca=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),SSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Eb,qR,Ab,BR,rV,nV,np=y(()=>{Eb=(t,e)=>{e&&qR(t)},qR=t=>{t.refCounted()},Ab=(t,e)=>{e&&BR(t)},BR=t=>{t.unrefCounted()},rV=(t,e)=>{e&&(BR(t),BR(t))},nV=(t,e)=>{e&&(qR(t),qR(t))}});import{once as wSe}from"node:events";import{scheduler as xSe}from"node:timers/promises";var iV,oV,Tb,sV=y(()=>{Rb();np();Ob();Ib();iV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(cV(i)||uV(i))return;Tb.has(t)||Tb.set(t,[]);let o=Tb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await lV(t,n,i),await xSe.yield();let s=await aV({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},oV=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{HR();let o=Tb.get(t);for(;o?.length>0;)await wSe(n,"message:done");t.removeListener("message",i),nV(e,r),n.connected=!1,n.emit("disconnect")},Tb=new WeakMap});import{EventEmitter as $Se}from"node:events";var ms,Pb,kSe,Cb,ip=y(()=>{sV();np();ms=(t,e,r)=>{if(Pb.has(t))return Pb.get(t);let n=new $Se;return n.connected=!0,Pb.set(t,n),kSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Pb=new WeakMap,kSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=iV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",oV.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),rV(r,n)},Cb=t=>{let e=Pb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as ESe}from"node:events";var dV,ASe,fV,aV,cV,pV,Db,TSe,Nb,mV,Ob=y(()=>{Nl();kb();Fb();Dl();ip();Rb();dV=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ms(t,e,r),s=jb(t,o);return{id:ASe++,type:Nb,message:n,hasListeners:s}},ASe=0n,fV=(t,e)=>{if(!(e?.type!==Nb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Db[r].resolve({isDeadlock:!0,hasListeners:!1})},aV=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Nb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:mV,message:jb(e,i)};try{await Mb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},cV=t=>{if(t?.type!==mV)return!1;let{id:e,message:r}=t;return Db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},pV=async(t,e,r)=>{if(t?.type!==Nb)return;let n=Di();Db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,TSe(e,r,i)]);o&&Z9(r),s||V9(r)}finally{i.abort(),delete Db[t.id]}},Db={},TSe=async(t,e,{signal:r})=>{Ca(t,1,r),await ESe(t,"disconnect",{signal:r}),W9(e)},Nb="execa:ipc:request",mV="execa:ipc:response"});var hV,gV,lV,op,jb,OSe,Rb=y(()=>{Nl();wo();ps();Ob();hV=(t,e,r)=>{op.has(t)||op.set(t,new Set);let n=op.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},gV=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},lV=async(t,e,r)=>{for(;!jb(t,e)&&op.get(t)?.size>0;){let n=[...op.get(t)];fV(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},op=new WeakMap,jb=(t,e)=>e.listenerCount("message")>OSe(t),OSe=t=>Ni.has(t)&&!So(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as RSe}from"node:util";var Mb,ISe,ZR,PSe,GR,Fb=y(()=>{Dl();Rb();Ob();Mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Pl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),ISe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ISe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=dV({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=hV(t,s,o);try{await ZR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Cl(t),c}finally{gV(a)}},ZR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=PSe(t);try{await Promise.all([pV(n,t,r),o(n)])}catch(s){throw Y9({error:s,methodName:e,isSubprocess:r}),X9({error:s,methodName:e,isSubprocess:r,message:i}),s}},PSe=t=>{if(GR.has(t))return GR.get(t);let e=RSe(t.send.bind(t));return GR.set(t,e),e},GR=new WeakMap});import{scheduler as CSe}from"node:timers/promises";var _V,bV,DSe,yV,uV,vV,HR,VR,Ib=y(()=>{Fb();ip();Dl();_V=(t,e)=>{let r="cancelSignal";return UR(r,!1,t.connected),ZR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:vV,message:e},message:e})},bV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await DSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),VR.signal),DSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!yV){if(yV=!0,!n){J9();return}if(e===null){HR();return}ms(t,e,r),await CSe.yield()}},yV=!1,uV=t=>t?.type!==vV?!1:(VR.abort(t.message),!0),vV="execa:ipc:cancel",HR=()=>{VR.abort(K9())},VR=new AbortController});var SV,wV,NSe,jSe,WR=y(()=>{LR();Ib();vb();SV=({gracefulCancel:t,cancelSignal:e,ipc:r,serialization:n})=>{if(t){if(e===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},wV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[NSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],NSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Sb(e,i);let o=jSe(e);throw await _V(t,o),FR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},jSe=({reason:t})=>{if(!(t instanceof DOMException))return t;let e=new Error(t.message);return Object.defineProperty(e,"stack",{value:t.stack,enumerable:!1,configurable:!0,writable:!0}),e}});import{setTimeout as MSe}from"node:timers/promises";var xV,$V,FSe,KR=y(()=>{Pa();xV=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},$V=(t,e,r,n)=>e===0||e===void 0?[]:[FSe(t,e,r,n)],FSe=async(t,e,r,{signal:n})=>{throw await MSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ri}});import{execPath as LSe,execArgv as zSe}from"node:process";import kV from"node:path";var EV,AV,JR=y(()=>{El();EV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},AV=(t,e,{node:r=!1,nodePath:n=LSe,nodeOptions:i=zSe.filter(c=>!c.startsWith("--inspect")),cwd:o,execPath:s,...a})=>{if(s!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=kl(n,'The "nodePath" option'),l=kV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(kV.basename(t,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...i,t,...e],{ipc:!0,...u,shell:!1}]}});import{serialize as USe}from"node:v8";var TV,qSe,BSe,HSe,OV,YR=y(()=>{TV=({ipcInput:t,ipc:e,serialization:r})=>{if(t!==void 0){if(!e)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");HSe[r](t)}},qSe=t=>{try{USe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},BSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},HSe={advanced:qSe,json:BSe},OV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var IV,GSe,an,XR,ZSe,RV,Lb,Da=y(()=>{IV=({encoding:t})=>{if(XR.has(t))return;let e=ZSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. Please rename it to ${Lb(e)}.`);let r=[...XR].map(n=>Lb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Lb(t)}\`. -Please rename it to one of: ${r}.`)},GSe=new Set(["utf8","utf16le"]),an=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),XR=new Set([...GSe,...an]),ZSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in OV)return OV[e];if(XR.has(e))return e},OV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Lb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as VSe}from"node:fs";import WSe from"node:path";import KSe from"node:process";var IV,PV,CV,QR=y(()=>{El();IV=(t=PV())=>{let e=kl(t,'The "cwd" option');return WSe.resolve(e)},PV=()=>{try{return KSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},CV=(t,e)=>{if(e===PV())return t;let r;try{r=VSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +Please rename it to one of: ${r}.`)},GSe=new Set(["utf8","utf16le"]),an=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),XR=new Set([...GSe,...an]),ZSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in RV)return RV[e];if(XR.has(e))return e},RV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Lb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as VSe}from"node:fs";import WSe from"node:path";import KSe from"node:process";var PV,CV,DV,QR=y(()=>{El();PV=(t=CV())=>{let e=kl(t,'The "cwd" option');return WSe.resolve(e)},CV=()=>{try{return KSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},DV=(t,e)=>{if(e===CV())return t;let r;try{r=VSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. ${n.message} ${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}. -${t}`}});import JSe from"node:path";import DV from"node:process";var NV,zb,YSe,XSe,eI=y(()=>{NV=St(h9(),1);w9();vb();tp();zR();WR();KR();JR();YR();Ca();QR();El();wo();zb=(t,e,r)=>{r.cwd=IV(r.cwd);let[n,i,o]=EV(t,e,r),{command:s,args:a,options:c}=NV.default._parse(n,i,o),l=iZ(c),u=YSe(l);return wV(u),RV(u),AV(u),q9(u),vV(u),u.shell=hR(u.shell),u.env=XSe(u),u.killSignal=M9(u.killSignal),u.forceKillAfterDelay=z9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!an.has(u.encoding)&&u.buffer[f]),DV.platform==="win32"&&JSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},YSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),XSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...DV.env,...t}:t;return r||n?S9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ub,tI=y(()=>{Ub=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ml(t){if(typeof t=="string")return QSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ewe(t)}var QSe,ewe,jV,twe,MV,rwe,rI=y(()=>{QSe=t=>t.at(-1)===jV?t.slice(0,t.at(-2)===MV?-2:-1):t,ewe=t=>t.at(-1)===twe?t.subarray(0,t.at(-2)===rwe?-2:-1):t,jV=` -`,twe=jV.codePointAt(0),MV="\r",rwe=MV.codePointAt(0)});function ii(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function nI(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Da(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function iI(t,e){return nI(t,e)&&Da(t,e)}var Na=y(()=>{});function FV(){return this[sI].next()}function LV(t){return this[sI].return(t)}function aI({preventCancel:t=!1}={}){let e=this.getReader(),r=new oI(e,t),n=Object.create(iwe);return n[sI]=r,n}var nwe,oI,sI,iwe,zV=y(()=>{nwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),oI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},sI=Symbol();Object.defineProperty(FV,"name",{value:"next"});Object.defineProperty(LV,"name",{value:"return"});iwe=Object.create(nwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:FV},return:{enumerable:!0,configurable:!0,writable:!0,value:LV}})});var UV=y(()=>{});var qV=y(()=>{zV();UV()});var BV,owe,swe,awe,sp,cI=y(()=>{Na();qV();BV=t=>{if(Da(t,{checkOpen:!1})&&sp.on!==void 0)return swe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(owe.call(t)==="[object ReadableStream]")return aI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:owe}=Object.prototype,swe=async function*(t){let e=new AbortController,r={};awe(t,e,r);try{for await(let[n]of sp.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},awe=async(t,e,r)=>{try{await sp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},sp={}});var Fl,cwe,ZV,HV,lwe,GV,ji,ap=y(()=>{cI();Fl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=BV(t),u=e();u.length=0;try{for await(let d of l){let f=lwe(d),p=r[f](d,u);ZV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return cwe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},cwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&ZV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},ZV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){HV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&HV(c,e,i,o),new ji},HV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},lwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=GV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&GV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:GV}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var xo,cp,qb,Bb,Hb,Gb=y(()=>{xo=t=>t,cp=()=>{},qb=({contents:t})=>t,Bb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Hb=t=>t.length});async function Zb(t,e){return Fl(t,pwe,e)}var uwe,dwe,fwe,pwe,VV=y(()=>{ap();Gb();uwe=()=>({contents:[]}),dwe=()=>1,fwe=(t,{contents:e})=>(e.push(t),e),pwe={init:uwe,convertChunk:{string:xo,buffer:xo,arrayBuffer:xo,dataView:xo,typedArray:xo,others:xo},getSize:dwe,truncateChunk:cp,addChunk:fwe,getFinalChunk:cp,finalize:qb}});async function Vb(t,e){return Fl(t,wwe,e)}var mwe,hwe,gwe,WV,KV,ywe,_we,bwe,vwe,YV,JV,Swe,XV,wwe,QV=y(()=>{ap();Gb();mwe=()=>({contents:new ArrayBuffer(0)}),hwe=t=>gwe.encode(t),gwe=new TextEncoder,WV=t=>new Uint8Array(t),KV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ywe=(t,e)=>t.slice(0,e),_we=(t,{contents:e,length:r},n)=>{let i=XV()?vwe(e,n):bwe(e,n);return new Uint8Array(i).set(t,r),i},bwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(YV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},vwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:YV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},YV=t=>JV**Math.ceil(Math.log(t)/Math.log(JV)),JV=2,Swe=({contents:t,length:e})=>XV()?t:t.slice(0,e),XV=()=>"resize"in ArrayBuffer.prototype,wwe={init:mwe,convertChunk:{string:hwe,buffer:WV,arrayBuffer:WV,dataView:KV,typedArray:KV,others:Bb},getSize:Hb,truncateChunk:ywe,addChunk:_we,getFinalChunk:cp,finalize:Swe}});async function Kb(t,e){return Fl(t,Awe,e)}var xwe,Wb,$we,kwe,Ewe,Awe,eW=y(()=>{ap();Gb();xwe=()=>({contents:"",textDecoder:new TextDecoder}),Wb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),$we=(t,{contents:e})=>e+t,kwe=(t,e)=>t.slice(0,e),Ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Awe={init:xwe,convertChunk:{string:xo,buffer:Wb,arrayBuffer:Wb,dataView:Wb,typedArray:Wb,others:Bb},getSize:Hb,truncateChunk:kwe,addChunk:$we,getFinalChunk:Ewe,finalize:qb}});var tW=y(()=>{VV();QV();eW();ap()});import{on as Twe}from"node:events";import{finished as Owe}from"node:stream/promises";var Jb=y(()=>{cI();tW();Object.assign(sp,{on:Twe,finished:Owe})});var rW,Rwe,nW,iW,Iwe,oW,sW,Yb,ja=y(()=>{Jb();vo();wo();rW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=Rwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Rwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",nW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},iW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Iwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Iwe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=So(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:nb(r),threshold:i,unit:n}},oW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Yb(r)),sW=(t,e,r)=>{if(!e)return t;let n=Yb(r);return t.length>n?t.slice(0,n):t},Yb=([,t])=>t});import{inspect as Pwe}from"node:util";var cW,Cwe,Dwe,Nwe,jwe,Mwe,aW,lW=y(()=>{rI();sn();QR();sb();ja();tp();Ia();cW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Cwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Nwe(n,b),w=x===void 0?"":` +${t}`}});import JSe from"node:path";import NV from"node:process";var jV,zb,YSe,XSe,eI=y(()=>{jV=St(g9(),1);x9();vb();tp();zR();WR();KR();JR();YR();Da();QR();El();wo();zb=(t,e,r)=>{r.cwd=PV(r.cwd);let[n,i,o]=AV(t,e,r),{command:s,args:a,options:c}=jV.default._parse(n,i,o),l=oZ(c),u=YSe(l);return xV(u),IV(u),TV(u),B9(u),SV(u),u.shell=hR(u.shell),u.env=XSe(u),u.killSignal=F9(u.killSignal),u.forceKillAfterDelay=U9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!an.has(u.encoding)&&u.buffer[f]),NV.platform==="win32"&&JSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},YSe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m="advanced",...h})=>({...h,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),XSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...NV.env,...t}:t;return r||n?w9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Ub,tI=y(()=>{Ub=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Ml(t){if(typeof t=="string")return QSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ewe(t)}var QSe,ewe,MV,twe,FV,rwe,rI=y(()=>{QSe=t=>t.at(-1)===MV?t.slice(0,t.at(-2)===FV?-2:-1):t,ewe=t=>t.at(-1)===twe?t.subarray(0,t.at(-2)===rwe?-2:-1):t,MV=` +`,twe=MV.codePointAt(0),FV="\r",rwe=FV.codePointAt(0)});function ii(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function nI(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.writable||!e)&&typeof t.write=="function"&&typeof t.end=="function"&&typeof t.writable=="boolean"&&typeof t.writableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function Na(t,{checkOpen:e=!0}={}){return ii(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}function iI(t,e){return nI(t,e)&&Na(t,e)}var ja=y(()=>{});function LV(){return this[sI].next()}function zV(t){return this[sI].return(t)}function aI({preventCancel:t=!1}={}){let e=this.getReader(),r=new oI(e,t),n=Object.create(iwe);return n[sI]=r,n}var nwe,oI,sI,iwe,UV=y(()=>{nwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),oI=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#o();return this.#n=this.#n?this.#n.then(e,e):e(),this.#n}return(e){let r=()=>this.#i(e);return this.#n?this.#n.then(r,r):r()}async#o(){if(this.#e)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(r){throw this.#n=void 0,this.#e=!0,this.#t.releaseLock(),r}return e.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),e}async#i(e){if(this.#e)return{done:!0,value:e};if(this.#e=!0,!this.#r){let r=this.#t.cancel(e);return this.#t.releaseLock(),await r,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},sI=Symbol();Object.defineProperty(LV,"name",{value:"next"});Object.defineProperty(zV,"name",{value:"return"});iwe=Object.create(nwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:LV},return:{enumerable:!0,configurable:!0,writable:!0,value:zV}})});var qV=y(()=>{});var BV=y(()=>{UV();qV()});var HV,owe,swe,awe,sp,cI=y(()=>{ja();BV();HV=t=>{if(Na(t,{checkOpen:!1})&&sp.on!==void 0)return swe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(owe.call(t)==="[object ReadableStream]")return aI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:owe}=Object.prototype,swe=async function*(t){let e=new AbortController,r={};awe(t,e,r);try{for await(let[n]of sp.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},awe=async(t,e,r)=>{try{await sp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},sp={}});var Fl,cwe,VV,GV,lwe,ZV,ji,ap=y(()=>{cI();Fl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=HV(t),u=e();u.length=0;try{for await(let d of l){let f=lwe(d),p=r[f](d,u);VV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return cwe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:c}),a(u)}catch(d){let f=typeof d=="object"&&d!==null?d:new Error(d);throw f.bufferedData=a(u),f}},cwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&VV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},VV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){GV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&GV(c,e,i,o),new ji},GV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},lwe=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=ZV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&ZV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:ZV}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var xo,cp,qb,Bb,Hb,Gb=y(()=>{xo=t=>t,cp=()=>{},qb=({contents:t})=>t,Bb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Hb=t=>t.length});async function Zb(t,e){return Fl(t,pwe,e)}var uwe,dwe,fwe,pwe,WV=y(()=>{ap();Gb();uwe=()=>({contents:[]}),dwe=()=>1,fwe=(t,{contents:e})=>(e.push(t),e),pwe={init:uwe,convertChunk:{string:xo,buffer:xo,arrayBuffer:xo,dataView:xo,typedArray:xo,others:xo},getSize:dwe,truncateChunk:cp,addChunk:fwe,getFinalChunk:cp,finalize:qb}});async function Vb(t,e){return Fl(t,wwe,e)}var mwe,hwe,gwe,KV,JV,ywe,_we,bwe,vwe,XV,YV,Swe,QV,wwe,eW=y(()=>{ap();Gb();mwe=()=>({contents:new ArrayBuffer(0)}),hwe=t=>gwe.encode(t),gwe=new TextEncoder,KV=t=>new Uint8Array(t),JV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ywe=(t,e)=>t.slice(0,e),_we=(t,{contents:e,length:r},n)=>{let i=QV()?vwe(e,n):bwe(e,n);return new Uint8Array(i).set(t,r),i},bwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(XV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},vwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:XV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},XV=t=>YV**Math.ceil(Math.log(t)/Math.log(YV)),YV=2,Swe=({contents:t,length:e})=>QV()?t:t.slice(0,e),QV=()=>"resize"in ArrayBuffer.prototype,wwe={init:mwe,convertChunk:{string:hwe,buffer:KV,arrayBuffer:KV,dataView:JV,typedArray:JV,others:Bb},getSize:Hb,truncateChunk:ywe,addChunk:_we,getFinalChunk:cp,finalize:Swe}});async function Kb(t,e){return Fl(t,Awe,e)}var xwe,Wb,$we,kwe,Ewe,Awe,tW=y(()=>{ap();Gb();xwe=()=>({contents:"",textDecoder:new TextDecoder}),Wb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),$we=(t,{contents:e})=>e+t,kwe=(t,e)=>t.slice(0,e),Ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Awe={init:xwe,convertChunk:{string:xo,buffer:Wb,arrayBuffer:Wb,dataView:Wb,typedArray:Wb,others:Bb},getSize:Hb,truncateChunk:kwe,addChunk:$we,getFinalChunk:Ewe,finalize:qb}});var rW=y(()=>{WV();eW();tW();ap()});import{on as Twe}from"node:events";import{finished as Owe}from"node:stream/promises";var Jb=y(()=>{cI();rW();Object.assign(sp,{on:Twe,finished:Owe})});var nW,Rwe,iW,oW,Iwe,sW,aW,Yb,Ma=y(()=>{Jb();vo();wo();nW=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof ji))throw t;if(o==="all")return t;let s=Rwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Rwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",iW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},oW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=Iwe(t,e);return`Command's ${r} was larger than ${n} ${i}`},Iwe=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=So(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:nb(r),threshold:i,unit:n}},sW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Yb(r)),aW=(t,e,r)=>{if(!e)return t;let n=Yb(r);return t.length>n?t.slice(0,n):t},Yb=([,t])=>t});import{inspect as Pwe}from"node:util";var lW,Cwe,Dwe,Nwe,jwe,Mwe,cW,uW=y(()=>{rI();sn();QR();sb();Ma();tp();Pa();lW=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:b})=>{let _=n?.code,S=Cwe({originalError:n,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:_,signal:i,signalDescription:o,exitCode:s,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),x=Nwe(n,b),w=x===void 0?"":` ${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>jwe(D)).join(` `)].map(D=>Yf(Ml(Mwe(D)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:O,message:A}},Cwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Dwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${iW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${bb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Dwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Nwe=(t,e)=>{if(t instanceof ri)return;let r=k9(t)?t.originalMessage:String(t?.message??t),n=Yf(CV(r,e));return n===""?void 0:n},jwe=t=>typeof t=="string"?t:Pwe(t),Mwe=t=>Array.isArray(t)?t.map(e=>Ml(aW(e))).filter(Boolean).join(` -`):aW(t),aW=t=>typeof t=="string"?t:qt(t)?tb(t):""});var Xb,Ll,lp,Fwe,uW,Lwe,up=y(()=>{tp();fb();Ia();lW();Xb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>uW({command:t,escapedCommand:e,cwd:o,durationMs:kR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ll=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>lp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),lp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Lwe(l,u),{originalMessage:A,shortMessage:D,message:$}=cW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=x9(t,$,x);return Object.assign(re,Fwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},Fwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>uW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:kR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),uW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Lwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:bb(e);return{exitCode:r,signal:n,signalDescription:i}}});function zwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(dW(t*1e3)%1e3),nanoseconds:Math.trunc(dW(t*1e6)%1e3)}}function Uwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function lI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return zwe(t);break}case"bigint":return Uwe(t)}throw new TypeError("Expected a finite number or bigint")}var dW,fW=y(()=>{dW=t=>Number.isFinite(t)?t:0});function uI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Hwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&qwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Bwe(d,u):f;i.push(p)}},a=lI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Gwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var qwe,Bwe,Hwe,Gwe,pW=y(()=>{fW();qwe=t=>t===0||t===0n,Bwe=(t,e)=>e===1||e===1n?t:`${t}s`,Hwe=1e-7,Gwe=24n*60n*60n*1000n});var mW,hW=y(()=>{Ol();mW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var gW,Zwe,yW=y(()=>{pW();ds();Ol();hW();gW=(t,e)=>{Al(e)&&(mW(t,e),Zwe(t,e))},Zwe=(t,e)=>{let r=`(done in ${uI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var zl,Qb=y(()=>{yW();zl=(t,e,{reject:r})=>{if(gW(t,e),t.failed&&r)throw t;return t}});var vW,Vwe,Wwe,SW,wW,_W,Kwe,dI,bW,Ma,xW,Jwe,ev,$W,Ywe,Xwe,fI,kW,Qwe,EW,tv,exe,pI,txe,rxe,AW,Pn,rv,mI,TW,OW,hs,wr=y(()=>{Na();_o();sn();vW=(t,e)=>Ma(t)?"asyncGenerator":xW(t)?"generator":ev(t)?"fileUrl":Ywe(t)?"filePath":exe(t)?"webStream":ii(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":txe(t)?"asyncIterable":rxe(t)?"iterable":pI(t)?SW({transform:t},e):Jwe(t)?Vwe(t,e):"native",Vwe=(t,e)=>iI(t.transform,{checkOpen:!1})?Wwe(t,e):pI(t.transform)?SW(t,e):Kwe(t,e),Wwe=(t,e)=>(wW(t,e,"Duplex stream"),"duplex"),SW=(t,e)=>(wW(t,e,"web TransformStream"),"webTransform"),wW=({final:t,binary:e,objectMode:r},n,i)=>{_W(t,`${n}.final`,i),_W(e,`${n}.binary`,i),dI(r,`${n}.objectMode`)},_W=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Kwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!bW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(iI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(pI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!bW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return dI(r,`${i}.binary`),dI(n,`${i}.objectMode`),Ma(t)||Ma(e)?"asyncGenerator":"generator"},dI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},bW=t=>Ma(t)||xW(t),Ma=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",xW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Jwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),ev=t=>Object.prototype.toString.call(t)==="[object URL]",$W=t=>ev(t)&&t.protocol!=="file:",Ywe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Xwe.has(e))&&fI(t.file),Xwe=new Set(["file","append"]),fI=t=>typeof t=="string",kW=(t,e)=>t==="native"&&typeof e=="string"&&!Qwe.has(e),Qwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),EW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",tv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",exe=t=>EW(t)||tv(t),pI=t=>EW(t?.readable)&&tv(t?.writable),txe=t=>AW(t)&&typeof t[Symbol.asyncIterator]=="function",rxe=t=>AW(t)&&typeof t[Symbol.iterator]=="function",AW=t=>typeof t=="object"&&t!==null,Pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),rv=new Set(["fileUrl","filePath","fileNumber"]),mI=new Set(["fileUrl","filePath"]),TW=new Set([...mI,"webStream","nodeStream"]),OW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var hI,nxe,ixe,RW,gI=y(()=>{wr();hI=(t,e,r,n)=>n==="output"?nxe(t,e,r):ixe(t,e,r),nxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},ixe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},RW=(t,e)=>{let r=t.findLast(({type:n})=>Pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var IW,oxe,sxe,axe,cxe,lxe,uxe,PW=y(()=>{_o();Ca();wr();gI();IW=(t,e,r,n)=>[...t.filter(({type:i})=>!Pn.has(i)),...oxe(t,e,r,n)],oxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=sxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return uxe(o,r)},sxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?axe({stdioItem:t,optionName:i}):e==="webTransform"?cxe({stdioItem:t,index:r,newTransforms:n,direction:o}):lxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),axe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=hI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},lxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||an.has(o),{writableObjectMode:f,readableObjectMode:p}=hI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},uxe=(t,e)=>e==="input"?t.reverse():t});import yI from"node:process";var CW,dxe,fxe,Ul,_I,DW,pxe,mxe,NW=y(()=>{Na();wr();CW=(t,e,r)=>{let n=t.map(i=>dxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??mxe},dxe=({type:t,value:e},r)=>fxe[r]??DW[t](e),fxe=["input","output","output"],Ul=()=>{},_I=()=>"input",DW={generator:Ul,asyncGenerator:Ul,fileUrl:Ul,filePath:Ul,iterable:_I,asyncIterable:_I,uint8Array:_I,webStream:t=>tv(t)?"output":"input",nodeStream(t){return Da(t,{checkOpen:!1})?nI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ul,duplex:Ul,native(t){let e=pxe(t);if(e!==void 0)return e;if(ii(t,{checkOpen:!1}))return DW.nodeStream(t)}},pxe=t=>{if([0,yI.stdin].includes(t))return"input";if([1,2,yI.stdout,yI.stderr].includes(t))return"output"},mxe="output"});var jW,MW=y(()=>{jW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var FW,hxe,gxe,LW,yxe,_xe,zW=y(()=>{vo();MW();ds();FW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=hxe(t,n).map((a,c)=>LW(a,c));return o?yxe(s,r,i):jW(s,e)},hxe=(t,e)=>{if(t===void 0)return In.map(n=>e[n]);if(gxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${In.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,In.length);return Array.from({length:r},(n,i)=>t[i])},gxe=t=>In.some(e=>t[e]!==void 0),LW=(t,e)=>Array.isArray(t)?t.map(r=>LW(r,e)):t??(e>=In.length?"ignore":"pipe"),yxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Tl(r,i)&&_xe(n)?"ignore":n),_xe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as bxe}from"node:fs";import vxe from"node:tty";var qW,Sxe,wxe,xxe,$xe,UW,BW=y(()=>{Na();vo();sn();ps();qW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Sxe({stdioItem:t,fdNumber:n,direction:i}):$xe({stdioItem:t,fdNumber:n}),Sxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=wxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ii(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},wxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=xxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(vxe.isatty(i))throw new TypeError(`The \`${e}: ${xb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:bo(bxe(i)),optionName:e}}},xxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=rb.indexOf(t);if(r!==-1)return r},$xe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:UW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:UW(e,e,r),optionName:r}:ii(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,UW=(t,e,r)=>{let n=rb[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var HW,kxe,Exe,Axe,Txe,GW=y(()=>{Na();sn();wr();HW=({input:t,inputFile:e},r)=>r===0?[...kxe(t),...Axe(e)]:[],kxe=t=>t===void 0?[]:[{type:Exe(t),value:t,optionName:"input"}],Exe=t=>{if(Da(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Axe=t=>t===void 0?[]:[{...Txe(t),optionName:"inputFile"}],Txe=t=>{if(ev(t))return{type:"fileUrl",value:t};if(fI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var ZW,VW,Oxe,Rxe,WW,Ixe,Pxe,KW,JW=y(()=>{wr();ZW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),VW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Oxe(i,t);if(s.length!==0){if(o){Rxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(TW.has(t))return WW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});OW.has(t)&&Pxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Oxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Rxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{mI.has(e)&&WW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},WW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Ixe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return KW(s,n,e),i==="output"?o[0].stream:void 0},Ixe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Pxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);KW(i,n,e)},KW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var nv,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,qxe,Bxe,bI,Hxe,iv=y(()=>{vo();PW();gI();wr();NW();zW();BW();GW();JW();nv=(t,e,r,n)=>{let o=FW(e,r,n).map((a,c)=>Cxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Uxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Hxe(a)),s},Cxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=nb(e),{stdioItems:o,isStdioArray:s}=Dxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=CW(o,e,i),c=o.map(d=>qW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=IW(c,i,a,r),u=RW(l,a);return zxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Dxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Nxe(c,n)),...HW(r,e)],s=ZW(o),a=s.length>1;return jxe(s,a,n),Fxe(s),{stdioItems:s,isStdioArray:a}},Nxe=(t,e)=>({type:vW(t,e),value:t,optionName:e}),jxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Mxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Mxe=new Set(["ignore","ipc"]),Fxe=t=>{for(let e of t)Lxe(e)},Lxe=({type:t,value:e,optionName:r})=>{if($W(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. -For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(kW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},zxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>rv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Uxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(qxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bI(i),o}},qxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Bxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Bxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=VW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ti(r)&&r.destroy()},Hxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as YW}from"node:fs";var QW,Mi,Gxe,e3,XW,Zxe,t3=y(()=>{sn();iv();wr();QW=(t,e)=>nv(Zxe,t,e,!0),Mi=({type:t,optionName:e})=>{e3(e,hs[t])},Gxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&e3(t,`"${e}"`),{}),e3=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},XW={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:Gxe},Zxe={input:{...XW,fileUrl:({value:t})=>({contents:[bo(YW(t))]}),filePath:({value:{file:t}})=>({contents:[bo(YW(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...XW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var $o,vI,dp=y(()=>{rI();$o=(t,{stripFinalNewline:e},r)=>vI(e,r)&&t!==void 0&&!Array.isArray(t)?Ml(t):t,vI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var ov,wI,r3,n3,Vxe,Wxe,Kxe,i3,Jxe,SI,Yxe,Xxe,Qxe,sv=y(()=>{ov=(t,e,r,n)=>t||r?void 0:n3(e,n),wI=(t,e,r)=>r?t.flatMap(n=>r3(n,e)):r3(t,e),r3=(t,e)=>{let{transform:r,final:n}=n3(e,{});return[...r(t),...n()]},n3=(t,e)=>(e.previousChunks="",{transform:Vxe.bind(void 0,e,t),final:Kxe.bind(void 0,e)}),Vxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=SI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=SI(n,r.slice(i+1))),t.previousChunks=n},Wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Kxe=function*({previousChunks:t}){t.length>0&&(yield t)},i3=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Jxe.bind(void 0,n)},Jxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Yxe:Qxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},SI=(t,e)=>`${t}${e}`,Yxe={windowsNewline:`\r +`);return{originalMessage:x,shortMessage:O,message:A}},Cwe=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:o,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Dwe(d,f);return e?`Command timed out after ${r} milliseconds${m}`:u?s===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${s} (${a})`:l?`Command was canceled${m}`:n?`${oW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${bb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Dwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",Nwe=(t,e)=>{if(t instanceof ri)return;let r=E9(t)?t.originalMessage:String(t?.message??t),n=Yf(DV(r,e));return n===""?void 0:n},jwe=t=>typeof t=="string"?t:Pwe(t),Mwe=t=>Array.isArray(t)?t.map(e=>Ml(cW(e))).filter(Boolean).join(` +`):cW(t),cW=t=>typeof t=="string"?t:qt(t)?tb(t):""});var Xb,Ll,lp,Fwe,dW,Lwe,up=y(()=>{tp();fb();Pa();uW();Xb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>dW({command:t,escapedCommand:e,cwd:o,durationMs:kR(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:i,pipedFrom:[]}),Ll=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>lp({error:t,command:e,escapedCommand:r,startTime:o,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:s}),lp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:O,signalDescription:T}=Lwe(l,u),{originalMessage:A,shortMessage:D,message:$}=lW({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),re=$9(t,$,x);return Object.assign(re,Fwe({error:re,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),re},Fwe=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:b})=>dW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:kR(n),failed:!0,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),dW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Lwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:bb(e);return{exitCode:r,signal:n,signalDescription:i}}});function zwe(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(fW(t*1e3)%1e3),nanoseconds:Math.trunc(fW(t*1e6)%1e3)}}function Uwe(t){return{days:t/86400000n,hours:t/3600000n%24n,minutes:t/60000n%60n,seconds:t/1000n%60n,milliseconds:t%1000n,microseconds:0n,nanoseconds:0n}}function lI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return zwe(t);break}case"bigint":return Uwe(t)}throw new TypeError("Expected a finite number or bigint")}var fW,pW=y(()=>{fW=t=>Number.isFinite(t)?t:0});function uI(t,e){let r=typeof t=="bigint";if(!r&&!Number.isFinite(t))throw new TypeError("Expected a finite number or bigint");e={...e};let n=t<0?"-":"";t=t<0?-t:t,e.colonNotation&&(e.compact=!1,e.formatSubMilliseconds=!1,e.separateMilliseconds=!1,e.verbose=!1),e.compact&&(e.unitCount=1,e.secondsDecimalDigits=0,e.millisecondsDecimalDigits=0);let i=[],o=(u,d)=>{let f=Math.floor(u*10**d+Hwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&qwe(u)&&!(e.colonNotation&&f==="m"))){if(p??=String(u),e.colonNotation){let m=p.includes(".")?p.split(".")[0].length:p.length,h=i.length>0?2:1;p="0".repeat(Math.max(0,h-m))+p}else p+=e.verbose?" "+Bwe(d,u):f;i.push(p)}},a=lI(t),c=BigInt(a.days);if(e.hideYearAndDays?s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!e.hideSeconds)if(e.separateMilliseconds||e.formatSubMilliseconds||!e.colonNotation&&t<1e3&&!e.subSecondsAsDecimals){let u=Number(a.seconds),d=Number(a.milliseconds),f=Number(a.microseconds),p=Number(a.nanoseconds);if(s(u,"second","s"),e.formatSubMilliseconds)s(d,"millisecond","ms"),s(f,"microsecond","\xB5s"),s(p,"nanosecond","ns");else{let m=d+f/1e3+p/1e6,h=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,g=m>=1?Math.round(m):Math.ceil(m),b=h?m.toFixed(h):g;s(Number.parseFloat(b),"millisecond","ms",b)}}else{let u=(r?Number(t%Gwe):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,f=o(u,d),p=e.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(i.length===0)return n+"0"+(e.verbose?" milliseconds":"ms");let l=e.colonNotation?":":" ";return typeof e.unitCount=="number"&&(i=i.slice(0,Math.max(e.unitCount,1))),n+i.join(l)}var qwe,Bwe,Hwe,Gwe,mW=y(()=>{pW();qwe=t=>t===0||t===0n,Bwe=(t,e)=>e===1||e===1n?t:`${t}s`,Hwe=1e-7,Gwe=24n*60n*60n*1000n});var hW,gW=y(()=>{Ol();hW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var yW,Zwe,_W=y(()=>{mW();ds();Ol();gW();yW=(t,e)=>{Al(e)&&(hW(t,e),Zwe(t,e))},Zwe=(t,e)=>{let r=`(done in ${uI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var zl,Qb=y(()=>{_W();zl=(t,e,{reject:r})=>{if(yW(t,e),t.failed&&r)throw t;return t}});var SW,Vwe,Wwe,wW,xW,bW,Kwe,dI,vW,Fa,$W,Jwe,ev,kW,Ywe,Xwe,fI,EW,Qwe,AW,tv,exe,pI,txe,rxe,TW,Pn,rv,mI,OW,RW,hs,wr=y(()=>{ja();_o();sn();SW=(t,e)=>Fa(t)?"asyncGenerator":$W(t)?"generator":ev(t)?"fileUrl":Ywe(t)?"filePath":exe(t)?"webStream":ii(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":txe(t)?"asyncIterable":rxe(t)?"iterable":pI(t)?wW({transform:t},e):Jwe(t)?Vwe(t,e):"native",Vwe=(t,e)=>iI(t.transform,{checkOpen:!1})?Wwe(t,e):pI(t.transform)?wW(t,e):Kwe(t,e),Wwe=(t,e)=>(xW(t,e,"Duplex stream"),"duplex"),wW=(t,e)=>(xW(t,e,"web TransformStream"),"webTransform"),xW=({final:t,binary:e,objectMode:r},n,i)=>{bW(t,`${n}.final`,i),bW(e,`${n}.binary`,i),dI(r,`${n}.objectMode`)},bW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Kwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!vW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(iI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(pI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!vW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return dI(r,`${i}.binary`),dI(n,`${i}.objectMode`),Fa(t)||Fa(e)?"asyncGenerator":"generator"},dI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},vW=t=>Fa(t)||$W(t),Fa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",$W=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Jwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),ev=t=>Object.prototype.toString.call(t)==="[object URL]",kW=t=>ev(t)&&t.protocol!=="file:",Ywe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Xwe.has(e))&&fI(t.file),Xwe=new Set(["file","append"]),fI=t=>typeof t=="string",EW=(t,e)=>t==="native"&&typeof e=="string"&&!Qwe.has(e),Qwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),AW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",tv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",exe=t=>AW(t)||tv(t),pI=t=>AW(t?.readable)&&tv(t?.writable),txe=t=>TW(t)&&typeof t[Symbol.asyncIterator]=="function",rxe=t=>TW(t)&&typeof t[Symbol.iterator]=="function",TW=t=>typeof t=="object"&&t!==null,Pn=new Set(["generator","asyncGenerator","duplex","webTransform"]),rv=new Set(["fileUrl","filePath","fileNumber"]),mI=new Set(["fileUrl","filePath"]),OW=new Set([...mI,"webStream","nodeStream"]),RW=new Set(["webTransform","duplex"]),hs={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var hI,nxe,ixe,IW,gI=y(()=>{wr();hI=(t,e,r,n)=>n==="output"?nxe(t,e,r):ixe(t,e,r),nxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},ixe=(t,e,r)=>{let n=e===0?t===!0:r[e-1].value.readableObjectMode,i=e!==r.length-1&&(t??n);return{writableObjectMode:n,readableObjectMode:i}},IW=(t,e)=>{let r=t.findLast(({type:n})=>Pn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var PW,oxe,sxe,axe,cxe,lxe,uxe,CW=y(()=>{_o();Da();wr();gI();PW=(t,e,r,n)=>[...t.filter(({type:i})=>!Pn.has(i)),...oxe(t,e,r,n)],oxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Pn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=sxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return uxe(o,r)},sxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?axe({stdioItem:t,optionName:i}):e==="webTransform"?cxe({stdioItem:t,index:r,newTransforms:n,direction:o}):lxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),axe=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:o})=>{if(i&&!n)throw new TypeError(`The \`${o}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${o}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},cxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Ot(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=hI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},lxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:o})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Ot(e)?e:{transform:e},d=c||an.has(o),{writableObjectMode:f,readableObjectMode:p}=hI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},uxe=(t,e)=>e==="input"?t.reverse():t});import yI from"node:process";var DW,dxe,fxe,Ul,_I,NW,pxe,mxe,jW=y(()=>{ja();wr();DW=(t,e,r)=>{let n=t.map(i=>dxe(i,e));if(n.includes("input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??mxe},dxe=({type:t,value:e},r)=>fxe[r]??NW[t](e),fxe=["input","output","output"],Ul=()=>{},_I=()=>"input",NW={generator:Ul,asyncGenerator:Ul,fileUrl:Ul,filePath:Ul,iterable:_I,asyncIterable:_I,uint8Array:_I,webStream:t=>tv(t)?"output":"input",nodeStream(t){return Na(t,{checkOpen:!1})?nI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ul,duplex:Ul,native(t){let e=pxe(t);if(e!==void 0)return e;if(ii(t,{checkOpen:!1}))return NW.nodeStream(t)}},pxe=t=>{if([0,yI.stdin].includes(t))return"input";if([1,2,yI.stdout,yI.stderr].includes(t))return"output"},mxe="output"});var MW,FW=y(()=>{MW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var LW,hxe,gxe,zW,yxe,_xe,UW=y(()=>{vo();FW();ds();LW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=hxe(t,n).map((a,c)=>zW(a,c));return o?yxe(s,r,i):MW(s,e)},hxe=(t,e)=>{if(t===void 0)return In.map(n=>e[n]);if(gxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${In.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return[t,t,t];if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,In.length);return Array.from({length:r},(n,i)=>t[i])},gxe=t=>In.some(e=>t[e]!==void 0),zW=(t,e)=>Array.isArray(t)?t.map(r=>zW(r,e)):t??(e>=In.length?"ignore":"pipe"),yxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Tl(r,i)&&_xe(n)?"ignore":n),_xe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as bxe}from"node:fs";import vxe from"node:tty";var BW,Sxe,wxe,xxe,$xe,qW,HW=y(()=>{ja();vo();sn();ps();BW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Sxe({stdioItem:t,fdNumber:n,direction:i}):$xe({stdioItem:t,fdNumber:n}),Sxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=wxe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ii(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},wxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=xxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(vxe.isatty(i))throw new TypeError(`The \`${e}: ${xb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:bo(bxe(i)),optionName:e}}},xxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=rb.indexOf(t);if(r!==-1)return r},$xe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:qW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:qW(e,e,r),optionName:r}:ii(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,qW=(t,e,r)=>{let n=rb[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var GW,kxe,Exe,Axe,Txe,ZW=y(()=>{ja();sn();wr();GW=({input:t,inputFile:e},r)=>r===0?[...kxe(t),...Axe(e)]:[],kxe=t=>t===void 0?[]:[{type:Exe(t),value:t,optionName:"input"}],Exe=t=>{if(Na(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(qt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Axe=t=>t===void 0?[]:[{...Txe(t),optionName:"inputFile"}],Txe=t=>{if(ev(t))return{type:"fileUrl",value:t};if(fI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var VW,WW,Oxe,Rxe,KW,Ixe,Pxe,JW,YW=y(()=>{wr();VW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),WW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Oxe(i,t);if(s.length!==0){if(o){Rxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(OW.has(t))return KW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});RW.has(t)&&Pxe({otherStdioItems:s,type:t,value:e,optionName:r})}},Oxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Rxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{mI.has(e)&&KW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},KW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Ixe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return JW(s,n,e),i==="output"?o[0].stream:void 0},Ixe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Pxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);JW(i,n,e)},JW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${hs[r]} that is the same.`)}});var nv,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,Lxe,zxe,Uxe,qxe,Bxe,bI,Hxe,iv=y(()=>{vo();CW();gI();wr();jW();UW();HW();ZW();YW();nv=(t,e,r,n)=>{let o=LW(e,r,n).map((a,c)=>Cxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Uxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Hxe(a)),s},Cxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=nb(e),{stdioItems:o,isStdioArray:s}=Dxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=DW(o,e,i),c=o.map(d=>BW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=PW(c,i,a,r),u=IW(l,a);return zxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Dxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Nxe(c,n)),...GW(r,e)],s=VW(o),a=s.length>1;return jxe(s,a,n),Fxe(s),{stdioItems:s,isStdioArray:a}},Nxe=(t,e)=>({type:SW(t,e),value:t,optionName:e}),jxe=(t,e,r)=>{if(t.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(e){for(let{value:n,optionName:i}of t)if(Mxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Mxe=new Set(["ignore","ipc"]),Fxe=t=>{for(let e of t)Lxe(e)},Lxe=({type:t,value:e,optionName:r})=>{if(kW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(EW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},zxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>rv.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Uxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(qxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw bI(i),o}},qxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Bxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Bxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=WW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},bI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ti(r)&&r.destroy()},Hxe=t=>{if(t.length>1)return t.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:e,value:r}]=t;return e==="native"?r:"pipe"}});import{readFileSync as XW}from"node:fs";var e3,Mi,Gxe,t3,QW,Zxe,r3=y(()=>{sn();iv();wr();e3=(t,e)=>nv(Zxe,t,e,!0),Mi=({type:t,optionName:e})=>{t3(e,hs[t])},Gxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&t3(t,`"${e}"`),{}),t3=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},QW={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:Gxe},Zxe={input:{...QW,fileUrl:({value:t})=>({contents:[bo(XW(t))]}),filePath:({value:{file:t}})=>({contents:[bo(XW(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...QW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Mi,string:Mi,uint8Array:Mi}}});var $o,vI,dp=y(()=>{rI();$o=(t,{stripFinalNewline:e},r)=>vI(e,r)&&t!==void 0&&!Array.isArray(t)?Ml(t):t,vI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var ov,wI,n3,i3,Vxe,Wxe,Kxe,o3,Jxe,SI,Yxe,Xxe,Qxe,sv=y(()=>{ov=(t,e,r,n)=>t||r?void 0:i3(e,n),wI=(t,e,r)=>r?t.flatMap(n=>n3(n,e)):n3(t,e),n3=(t,e)=>{let{transform:r,final:n}=i3(e,{});return[...r(t),...n()]},i3=(t,e)=>(e.previousChunks="",{transform:Vxe.bind(void 0,e,t),final:Kxe.bind(void 0,e)}),Vxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=SI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=SI(n,r.slice(i+1))),t.previousChunks=n},Wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Kxe=function*({previousChunks:t}){t.length>0&&(yield t)},o3=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Jxe.bind(void 0,n)},Jxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Yxe:Qxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},SI=(t,e)=>`${t}${e}`,Yxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:SI},Xxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Qxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Xxe}});import{Buffer as e0e}from"node:buffer";var o3,t0e,s3,r0e,n0e,a3,c3=y(()=>{sn();o3=(t,e)=>t?void 0:t0e.bind(void 0,e),t0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!e0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},s3=(t,e)=>t?r0e.bind(void 0,e):n0e.bind(void 0,e),r0e=function*(t,e){a3(t,e),yield e},n0e=function*(t,e){if(a3(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},a3=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:SI},Xxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Qxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Xxe}});import{Buffer as e0e}from"node:buffer";var s3,t0e,a3,r0e,n0e,c3,l3=y(()=>{sn();s3=(t,e)=>t?void 0:t0e.bind(void 0,e),t0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!e0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},a3=(t,e)=>t?r0e.bind(void 0,e):n0e.bind(void 0,e),r0e=function*(t,e){c3(t,e),yield e},n0e=function*(t,e){if(c3(t,e),typeof e!="string"&&!qt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},c3=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as i0e}from"node:buffer";import{StringDecoder as o0e}from"node:string_decoder";var av,s0e,a0e,c0e,xI=y(()=>{sn();av=(t,e,r)=>{if(r)return;if(t)return{transform:s0e.bind(void 0,new TextEncoder)};let n=new o0e(e);return{transform:a0e.bind(void 0,n),final:c0e.bind(void 0,n)}},s0e=function*(t,e){i0e.isBuffer(e)?yield bo(e):typeof e=="string"?yield t.encode(e):yield e},a0e=function*(t,e){yield qt(e)?t.write(e):e},c0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as l3}from"node:util";var $I,cv,u3,l0e,d3,u0e,f3=y(()=>{$I=l3(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for await(let i of n(t))yield*cv(i,e,r+1)},u3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cv(n,r,e+1)},d3=l3(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),u0e=function*(t){yield t}});var kI,p3,Fa,fp,d0e,f0e,EI=y(()=>{kI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},p3=(t,e)=>[...e.flatMap(r=>[...Fa(r,t,0)]),...fp(t)],Fa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=f0e}=e[r];for(let i of n(t))yield*Fa(i,e,r+1)},fp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*d0e(r,Number(e),t)},d0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Fa(n,r,e+1)},f0e=function*(t){yield t}});import{Transform as p0e,getDefaultHighWaterMark as m3}from"node:stream";var AI,lv,h3,uv=y(()=>{wr();sv();c3();xI();f3();EI();AI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=h3(t,s,o),l=Ma(e),u=Ma(r),d=l?$I.bind(void 0,cv,a):kI.bind(void 0,Fa),f=l||u?$I.bind(void 0,u3,a):kI.bind(void 0,fp),p=l||u?d3.bind(void 0,a):void 0;return{stream:new p0e({writableObjectMode:n,writableHighWaterMark:m3(n),readableObjectMode:i,readableHighWaterMark:m3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},lv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=h3(s,r,a);t=p3(c,t)}return t},h3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:o3(n,a)},av(r,s,n),ov(r,o,n,c),{transform:t,final:e},{transform:s3(i,a)},i3({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var g3,m0e,h0e,g0e,y0e,y3=y(()=>{uv();sn();wr();g3=(t,e)=>{for(let r of m0e(t))h0e(t,r,e)},m0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),h0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>g0e(a,n));r.input=Jf(s)},g0e=(t,e)=>{let r=lv(t,e,"utf8",!0);return y0e(r),Jf(r)},y0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var dv,_0e,b0e,_3,b3,v0e,v3,TI=y(()=>{Ca();wr();Ol();ds();dv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Tl(r,n)&&!an.has(e)&&_0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&b0e.has(o))||t.every(({type:i})=>Pn.has(i))),_0e=t=>t===1||t===2,b0e=new Set(["pipe","overlapped"]),_3=async(t,e,r,n)=>{for await(let i of t)v0e(e)||v3(i,r,n)},b3=(t,e,r)=>{for(let n of t)v3(n,e,r)},v0e=t=>t._readableState.pipes.length>0,v3=(t,e,r)=>{let n=ub(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as S0e,appendFileSync as w0e}from"node:fs";var S3,x0e,$0e,k0e,E0e,A0e,w3=y(()=>{TI();uv();sv();sn();wr();ja();S3=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>x0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},x0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=sW(t,o,d),p=bo(f),{stdioItems:m,objectMode:h}=e[r],g=$0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=k0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});E0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&A0e(b,m,i),S}catch(x){return n.error=x,S}},$0e=(t,e,r,n)=>{try{return lv(t,e,r,!1)}catch(i){return n.error=i,t}},k0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Jf(t)};let s=JG(t,r);return n[o]?{serializedResult:s,finalResult:wI(s,!i[o],e)}:{serializedResult:s}},E0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!dv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wI(t,!1,s);try{b3(a,e,n)}catch(c){r.error??=c}},A0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>rv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?w0e(n,t):(r.add(o),S0e(n,t))}}});var x3,$3=y(()=>{sn();dp();x3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,$o(e,r,"all")]:Array.isArray(e)?[$o(t,r,"all"),...e]:qt(t)&&qt(e)?yR([t,e]):`${t}${e}`}});import{once as OI}from"node:events";var k3,T0e,E3,A3,O0e,RI,II=y(()=>{Ia();k3=async(t,e)=>{let[r,n]=await T0e(t);return e.isForcefullyTerminated??=!1,[r,n]},T0e=async t=>{let[e,r]=await Promise.allSettled([OI(t,"spawn"),OI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?E3(t):r.value},E3=async t=>{try{return await OI(t,"exit")}catch{return E3(t)}},A3=async t=>{let[e,r]=await t;if(!O0e(e,r)&&RI(e,r))throw new ri;return[e,r]},O0e=(t,e)=>t===void 0&&e===void 0,RI=(t,e)=>t!==0||e!==null});var T3,R0e,O3=y(()=>{Ia();ja();II();T3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R0e(t,e,r),s=o?.code==="ETIMEDOUT",a=oW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R0e=(t,e,r)=>t!==void 0?t:RI(e,r)?new ri:void 0});import{spawnSync as I0e}from"node:child_process";var R3,P0e,C0e,D0e,fv,N0e,j0e,M0e,F0e,I3=y(()=>{ER();eI();tI();up();Qb();t3();dp();y3();w3();ja();$3();O3();R3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=P0e(t,e,r),d=N0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return zl(d,c,l)},P0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),a=C0e(r),{file:c,commandArguments:l,options:u}=zb(t,e,a);D0e(u);let d=QW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},C0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,D0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&fv("ipcInput"),t&&fv("ipc: true"),r&&fv("detached: true"),n&&fv("cancelSignal")},fv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},N0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=j0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=T3(c,r),{output:m,error:h=l}=S3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>$o(_,r,S)),b=$o(x3(m,r),r,"all");return F0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},j0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{g3(o,r);let a=M0e(r);return I0e(...Ub(t,e,a))}catch(a){return Ll({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Yb(e)}),F0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Xb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):lp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as PI,on as L0e}from"node:events";var P3,z0e,U0e,q0e,B0e,C3=y(()=>{Dl();ip();np();P3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Pl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),z0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),z0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Eb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([U0e(o,n,s),q0e(o,r,s),B0e(o,r,s)])}catch(a){throw Cl(t),a}finally{s.abort(),Ab(e,i)}},U0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await PI(t,"message",{signal:r});return n}for await(let[n]of L0e(t,"message",{signal:r}))if(e(n))return n},q0e=async(t,e,{signal:r})=>{await PI(t,"disconnect",{signal:r}),H9(e)},B0e=async(t,e,{signal:r})=>{let[n]=await PI(t,"strict:error",{signal:r});throw wb(n,e)}});import{once as N3,on as H0e}from"node:events";var j3,CI,G0e,Z0e,V0e,D3,DI=y(()=>{Dl();ip();np();j3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Pl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),Eb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return G0e(t,s,a),Z0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),V0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},G0e=async(t,e,r)=>{try{await N3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Z0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await N3(t,"strict:error",{signal:r.signal});n.error=wb(i,e),r.abort()}catch{}},V0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of H0e(r,"message",{signal:o.signal}))D3(s),yield c}catch{D3(s)}finally{o.abort(),Ab(e,a),n||Cl(t),i&&await t}},D3=({error:t})=>{if(t)throw t}});import M3 from"node:process";var F3,L3,z3,NI=y(()=>{Fb();C3();DI();Ib();F3=(t,{ipc:e})=>{Object.assign(t,z3(t,!1,e))},L3=()=>{let t=M3,e=!0,r=M3.channel!==void 0;return{...z3(t,e,r),getCancelSignal:_V.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},z3=(t,e,r)=>({sendMessage:Mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:P3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:j3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as W0e}from"node:child_process";import{PassThrough as K0e,Readable as J0e,Writable as Y0e,Duplex as X0e}from"node:stream";var U3,Q0e,pp,e$e,t$e,r$e,n$e,q3=y(()=>{iv();up();Qb();U3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bI(n);let a=new W0e;Q0e(a,n),Object.assign(a,{readable:e$e,writable:t$e,duplex:r$e});let c=Ll({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=n$e(c,s,i);return{subprocess:a,promise:l}},Q0e=(t,e)=>{let r=pp(),n=pp(),i=pp(),o=Array.from({length:e.length-3},pp),s=pp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},pp=()=>{let t=new K0e;return t.end(),t},e$e=()=>new J0e({read(){}}),t$e=()=>new Y0e({write(){}}),r$e=()=>new X0e({read(){},write(){}}),n$e=async(t,e,r)=>zl(t,e,r)});import{createReadStream as B3,createWriteStream as H3}from"node:fs";import{Buffer as i$e}from"node:buffer";import{Readable as mp,Writable as o$e,Duplex as s$e}from"node:stream";var Z3,hp,G3,a$e,V3=y(()=>{uv();iv();wr();Z3=(t,e)=>nv(a$e,t,e,!1),hp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},G3={fileNumber:hp,generator:AI,asyncGenerator:AI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:s$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},a$e={input:{...G3,fileUrl:({value:t})=>({stream:B3(t)}),filePath:({value:{file:t}})=>({stream:B3(t)}),webStream:({value:t})=>({stream:mp.fromWeb(t)}),iterable:({value:t})=>({stream:mp.from(t)}),asyncIterable:({value:t})=>({stream:mp.from(t)}),string:({value:t})=>({stream:mp.from(t)}),uint8Array:({value:t})=>({stream:mp.from(i$e.from(t))})},output:{...G3,fileUrl:({value:t})=>({stream:H3(t)}),filePath:({value:{file:t,append:e}})=>({stream:H3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:o$e.fromWeb(t)}),iterable:hp,asyncIterable:hp,string:hp,uint8Array:hp}}});import{on as c$e,once as W3}from"node:events";import{PassThrough as l$e,getDefaultHighWaterMark as u$e}from"node:stream";import{finished as Y3}from"node:stream/promises";function La(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)MI(i);let e=t.some(({readableObjectMode:i})=>i),r=d$e(t,e),n=new jI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var d$e,jI,f$e,p$e,m$e,MI,h$e,g$e,y$e,_$e,b$e,X3,Q3,FI,eK,v$e,pv,K3,J3,mv=y(()=>{d$e=(t,e)=>{if(t.length===0)return u$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},jI=class extends l$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(MI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=f$e(this,this.#t,this.#o);let r=h$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(MI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},f$e=async(t,e,r)=>{pv(t,K3);let n=new AbortController;try{await Promise.race([p$e(t,n),m$e(t,e,r,n)])}finally{n.abort(),pv(t,-K3)}},p$e=async(t,{signal:e})=>{try{await Y3(t,{signal:e,cleanup:!0})}catch(r){throw X3(t,r),r}},m$e=async(t,e,r,{signal:n})=>{for await(let[i]of c$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},MI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{pv(t,J3);let a=new AbortController;try{await Promise.race([g$e(o,e,a),y$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),_$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),pv(t,-J3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FI(t):b$e(t))},g$e=async(t,e,{signal:r})=>{try{await t,r.aborted||FI(e)}catch(n){r.aborted||X3(e,n)}},y$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Y3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;Q3(s)?i.add(e):eK(t,s)}},_$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await W3(t,i,{signal:o}),!t.readable)return W3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},b$e=t=>{t.writable&&t.end()},X3=(t,e)=>{Q3(e)?FI(t):eK(t,e)},Q3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FI=t=>{(t.readable||t.writable)&&t.destroy()},eK=(t,e)=>{t.destroyed||(t.once("error",v$e),t.destroy(e))},v$e=()=>{},pv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},K3=2,J3=1});import{finished as tK}from"node:stream/promises";var ql,S$e,LI,w$e,zI,hv=y(()=>{vo();ql=(t,e)=>{t.pipe(e),S$e(t,e),w$e(t,e)},S$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LI(e)}},LI=t=>{t.writable&&t.end()},w$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await tK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}zI(t)}},zI=t=>{t.readable&&t.destroy()}});var rK,x$e,$$e,k$e,E$e,A$e,nK=y(()=>{mv();vo();kb();wr();hv();rK=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Pn.has(c)))x$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Pn.has(c)))k$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:La(o);ql(s,i)}},x$e=(t,e,r,n)=>{r==="output"?ql(t.stdio[n],e):ql(e,t.stdio[n]);let i=$$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},$$e=["stdin","stdout","stderr"],k$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;E$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},E$e=(t,{signal:e})=>{ti(t)&&Pa(t,A$e,e)},A$e=2});var za,iK=y(()=>{za=[];za.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&za.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&za.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var gv,UI,qI,T$e,BI,yv,O$e,HI,GI,ZI,oK,jat,Mat,sK=y(()=>{iK();gv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",UI=Symbol.for("signal-exit emitter"),qI=globalThis,T$e=Object.defineProperty.bind(Object),BI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(qI[UI])return qI[UI];T$e(qI,UI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},yv=class{},O$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HI=class extends yv{onExit(){return()=>{}}load(){}unload(){}},GI=class extends yv{#t=ZI.platform==="win32"?"SIGINT":"SIGHUP";#r=new BI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of za)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!gv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of za)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,za.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return gv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&gv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},ZI=globalThis.process,{onExit:oK,load:jat,unload:Mat}=O$e(gv(ZI)?new GI(ZI):new HI)});import{addAbortListener as R$e}from"node:events";var aK,cK=y(()=>{sK();aK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=oK(()=>{t.kill()});R$e(n,()=>{i()})}});var uK,I$e,P$e,lK,C$e,dK=y(()=>{gR();fb();ps();El();uK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=db(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=I$e(r,n,i),{sourceStream:d,sourceError:f}=C$e(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},I$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=P$e(t,e,...r),a=$b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},P$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(lK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||mR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=eb(r,...n);return{destination:e(lK)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},lK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),C$e=(t,e)=>{try{return{sourceStream:jl(t,e)}}catch(r){return{sourceError:r}}}});var pK,D$e,VI,fK,WI=y(()=>{up();hv();pK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=D$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},D$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return zI(t),n;if(e!==void 0)return LI(r),e},VI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ll({error:t,command:fK,escapedCommand:fK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),fK="source.pipe(destination)"});var mK,hK=y(()=>{mK=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as N$e}from"node:stream/promises";var gK,j$e,M$e,F$e,_v,L$e,z$e,yK=y(()=>{mv();kb();hv();gK=(t,e,r)=>{let n=_v.has(e)?M$e(t,e):j$e(t,e);return Pa(t,L$e,r.signal),Pa(e,z$e,r.signal),F$e(e),n},j$e=(t,e)=>{let r=La([t]);return ql(r,e),_v.set(e,r),r},M$e=(t,e)=>{let r=_v.get(e);return r.add(t),r},F$e=async t=>{try{await N$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_v.delete(t)},_v=new WeakMap,L$e=2,z$e=1});import{aborted as U$e}from"node:util";var _K,q$e,bK=y(()=>{WI();_K=(t,e)=>t===void 0?[]:[q$e(t,e)],q$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await U$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var bv,B$e,H$e,vK=y(()=>{_o();dK();WI();hK();yK();bK();bv=(t,...e)=>{if(Ot(e[0]))return bv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=uK(t,...e),i=B$e({...n,destination:r});return i.pipe=bv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},B$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=H$e(t,i);pK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=gK(e,o,d);return await Promise.race([mK(u),..._K(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},H$e=(t,e)=>Promise.allSettled([t,e])});import{on as G$e}from"node:events";import{getDefaultHighWaterMark as Z$e}from"node:stream";var vv,V$e,KI,W$e,wK,JI,SK,K$e,J$e,Sv=y(()=>{xI();sv();EI();vv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return V$e(e,s),wK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},V$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},KI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;W$e(e,s,t);let a=t.readableObjectMode&&!o;return wK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},W$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},wK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=G$e(t,"data",{signal:e.signal,highWaterMark:SK,highWatermark:SK});return K$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},JI=Z$e(!0),SK=JI,K$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=J$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Fa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*fp(a)}},J$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[av(t,r,!e),ov(t,i,!n,{})].filter(Boolean)});import{setImmediate as Y$e}from"node:timers/promises";var xK,X$e,Q$e,eke,YI,$K,XI=y(()=>{Jb();sn();TI();Sv();ja();dp();xK=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=X$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Q$e(t),d]);return}let f=vI(c,r),p=KI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([eke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},X$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!dv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=KI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await _3(a,t,r,o)},Q$e=async t=>{await Y$e(),t.readableFlowing===null&&t.resume()},eke=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Vb(r,{maxBuffer:o})):await Kb(r,{maxBuffer:o})}catch(a){return $K(rW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YI=async t=>{try{return await t}catch(e){return $K(e)}},$K=({bufferedData:t})=>WG(t)?new Uint8Array(t):t});import{finished as tke}from"node:stream/promises";var gp,rke,nke,ike,oke,ske,QI,wv,kK,xv=y(()=>{gp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=rke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],tke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||oke(a,e,r,n)}finally{s.abort()}},rke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&nke(t,r,n),n},nke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{ike(e,r),n.call(t,...i)}},ike=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},oke=(t,e,r,n)=>{if(!ske(t,e,r,n))throw t},ske=(t,e,r,n=!0)=>r.propagating?kK(t)||wv(t):(r.propagating=!0,QI(r,e)===n?kK(t):wv(t)),QI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",wv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",kK=t=>t?.code==="EPIPE"});var EK,eP,tP=y(()=>{XI();xv();EK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>eP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),eP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=gp(t,e,l);if(QI(l,e)){await u;return}let[d]=await Promise.all([xK({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var AK,TK,ake,cke,rP=y(()=>{mv();tP();AK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?La([t,e].filter(Boolean)):void 0,TK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>eP({...ake(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:cke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),ake=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},cke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var OK,RK,IK=y(()=>{Ol();ds();OK=t=>Tl(t,"ipc"),RK=(t,e)=>{let r=ub(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var PK,CK,DK=y(()=>{ja();IK();wo();DI();PK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=OK(o),a=So(e,"ipc"),c=So(r,"ipc");for await(let l of CI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(nW(t,i,c),i.push(l)),s&&RK(l,o);return i},CK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as lke}from"node:events";var NK,uke,dke,fke,jK=y(()=>{Na();KR();zR();WR();vo();wr();XI();DK();YR();rP();tP();II();xv();NK=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=k3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=EK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=TK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=PK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=uke(h,t,S),D=dke(m,S);try{return await Promise.race([Promise.all([{},A3(_),Promise.all(x),w,T,TV(t,d),...A,...D]),g,fke(t,b),...xV(t,o,f,b),...B9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...SV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>YI(re))),YI(w),CK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},uke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:gp(n,i,r)),dke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ii(o,{checkOpen:!1})&&!ti(o)).map(({type:i,value:o,stream:s=o})=>gp(s,n,e,{isSameDirection:Pn.has(i),stopOnExit:i==="native"}))),fke=async(t,{signal:e})=>{let[r]=await lke(t,"error",{signal:e});throw r}});var MK,yp,Bl,$v=y(()=>{Nl();MK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as FK}from"node:stream/promises";var nP,LK,iP,oP,kv,Ev,sP=y(()=>{xv();nP=async t=>{if(t!==void 0)try{await iP(t)}catch{}},LK=async t=>{if(t!==void 0)try{await oP(t)}catch{}},iP=async t=>{await FK(t,{cleanup:!0,readable:!1,writable:!0})},oP=async t=>{await FK(t,{cleanup:!0,readable:!0,writable:!1})},kv=async(t,e)=>{if(await t,e)throw e},Ev=(t,e,r)=>{r&&!wv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as pke}from"node:stream";import{callbackify as mke}from"node:util";var zK,aP,cP,lP,hke,uP,dP,UK,fP=y(()=>{Ca();ps();Sv();Nl();$v();sP();zK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||an.has(r),{subprocessStdout:a,waitReadableDestroy:c}=aP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=cP(a,s),{read:f,onStdoutDataDone:p}=lP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new pke({read:f,destroy:mke(dP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return uP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},aP=(t,e,r)=>{let n=jl(t,e),i=yp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},cP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:JI},lP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=vv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){hke(this,s,o)},onStdoutDataDone:o}},hke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},uP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await oP(t),await n,await nP(i),await e,r.readable&&r.push(null)}catch(o){await nP(i),UK(r,o)}},dP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(UK(t,n),await kv(e,n))},UK=(t,e)=>{Ev(t,t.readable,e)}});import{Writable as gke}from"node:stream";import{callbackify as qK}from"node:util";var BK,pP,mP,yke,_ke,hP,gP,HK,yP=y(()=>{ps();$v();sP();BK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=pP(t,r,e),s=new gke({...mP(n,t,i),destroy:qK(gP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return hP(n,s),s},pP=(t,e,r)=>{let n=$b(t,e),i=yp(r,n,"writableFinal"),o=yp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},mP=(t,e,r)=>({write:yke.bind(void 0,t),final:qK(_ke.bind(void 0,t,e,r))}),yke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},_ke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},hP=async(t,e,r)=>{try{await iP(t),e.writable&&e.end()}catch(n){await LK(r),HK(e,n)}},gP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(HK(t,i),await kv(e,i))},HK=(t,e)=>{Ev(t,t.writable,e)}});import{Duplex as bke}from"node:stream";import{callbackify as vke}from"node:util";var GK,Ske,ZK=y(()=>{Ca();fP();yP();GK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||an.has(r),{subprocessStdout:c,waitReadableDestroy:l}=aP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=pP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=cP(c,a),{read:g,onStdoutDataDone:b}=lP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new bke({read:g,...mP(u,t,d),destroy:vke(Ske.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return uP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),hP(u,_,c),_},Ske=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([dP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),gP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var _P,wke,VK=y(()=>{Ca();ps();Sv();_P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||an.has(e),s=jl(t,r),a=vv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return wke(a,s,t)},wke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var WK,KK=y(()=>{$v();fP();yP();ZK();VK();WK=(t,{encoding:e})=>{let r=MK();t.readable=zK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=BK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=GK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=_P.bind(void 0,t,e),t[Symbol.asyncIterator]=_P.bind(void 0,t,e,{})}});var JK,xke,$ke,YK=y(()=>{JK=(t,e)=>{for(let[r,n]of $ke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},xke=(async()=>{})().constructor.prototype,$ke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(xke,t)])});import{setMaxListeners as kke}from"node:events";import{spawn as Eke}from"node:child_process";var XK,Ake,Tke,Oke,Rke,Ike,QK=y(()=>{Jb();ER();eI();ps();tI();NI();up();Qb();q3();V3();dp();nK();vb();cK();vK();rP();jK();KK();Nl();YK();XK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Ake(t,e,r),{subprocess:f,promise:p}=Oke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=bv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),JK(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Ake=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),{file:a,commandArguments:c,options:l}=zb(t,e,r),u=Tke(l),d=Z3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Tke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Oke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Eke(...Ub(t,e,r))}catch(m){return U3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;kke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];rK(c,a,l),aK(c,r,l);let d={},f=Di();c.kill=U9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=AK(c,r),WK(c,r),F3(c,r);let p=Rke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Rke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await NK({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>$o(x,e,w)),_=$o(h,e,"all"),S=Ike({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return zl(S,n,e)},Ike=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?lp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Xb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Av,Pke,Cke,eJ=y(()=>{_o();wo();Av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Pke(n,t[n],i)]));return{...t,...r}},Pke=(t,e,r)=>Cke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Cke=new Set(["env",...SR])});var gs,Dke,Nke,tJ=y(()=>{_o();gR();rZ();I3();QK();eJ();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Dke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Dke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Nke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?R3(a,c,l):XK(a,c,l,i)},Nke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=eZ(e)?tZ(e,r):[e,...r],[s,a,c]=eb(...o),l=Av(Av(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var rJ,nJ,iJ,jke,Mke,oJ=y(()=>{rJ=({file:t,commandArguments:e})=>iJ(t,e),nJ=({file:t,commandArguments:e})=>({...iJ(t,e),isSync:!0}),iJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=jke(t);return{file:r,commandArguments:n}},jke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Mke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Mke=/ +/g});var sJ,aJ,Fke,cJ,Lke,lJ,uJ=y(()=>{sJ=(t,e,r)=>{t.sync=e(Fke,r),t.s=t.sync},aJ=({options:t})=>cJ(t),Fke=({options:t})=>({...cJ(t),isSync:!0}),cJ=t=>({options:{...Lke(t),...t}}),Lke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},lJ={preferLocal:!0}});var Eut,We,Aut,Tut,Out,Rut,Iut,Put,Cut,Dut,Lr=y(()=>{tJ();oJ();JR();uJ();NI();Eut=gs(()=>({})),We=gs(()=>({isSync:!0})),Aut=gs(rJ),Tut=gs(nJ),Out=gs(kV),Rut=gs(aJ,{},lJ,sJ),{sendMessage:Iut,getOneMessage:Put,getEachMessage:Cut,getCancelSignal:Dut}=L3()});import{existsSync as Tv,statSync as zke}from"node:fs";import{dirname as bP,extname as Uke,isAbsolute as dJ,join as vP,relative as SP,resolve as Ov,sep as qke}from"node:path";function Rv(t){return t==="./gradlew"||t==="gradle"}function Bke(t){return(Tv(vP(t,"build.gradle.kts"))||Tv(vP(t,"build.gradle")))&&Tv(vP(t,"gradle.properties"))}function Hke(t,e){let n=SP(t,e).split(qke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Gke(t,e){let r=Ov(t,e),n=r;Tv(r)?zke(r).isFile()&&(n=bP(r)):Uke(r)!==""&&(n=bP(r));let i=SP(t,n);if(i.startsWith("..")||dJ(i))return null;let o=n;for(;;){if(Bke(o))return o;if(Ov(o)===Ov(t))return null;let s=bP(o);if(s===o)return null;let a=SP(t,s);if(a.startsWith("..")||dJ(a))return null;o=s}}function Iv(t,e){let r=Ov(t),n=new Map,i=[];for(let o of e){let s=Gke(r,o);if(!s){i.push(o);continue}let a=Hke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Pv=y(()=>{"use strict"});import{existsSync as xP,readFileSync as Zke}from"node:fs";import{join as Hl}from"node:path";function Gl(t="."){let e=Hl(t,".cladding","config.yaml");if(!xP(e))return wP;try{let n=(0,fJ.parse)(Zke(e,"utf8"))?.gate;if(!n)return wP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Vke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return wP}}function pJ(t="."){let e=Gl(t).testReport,r=e?[e,...$P]:$P;return[...new Set(r.map(n=>Hl(t,n)))]}function mJ(t="."){let e=Gl(t).testReport;if(e){let r=Hl(t,e);return xP(r)?r:null}return $P.map(r=>Hl(t,r)).find(r=>xP(r))??null}function hJ(t,e){let r=[],n=!1;for(let i of t){let o=Wke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var fJ,Vke,wP,$P,Wke,_p=y(()=>{"use strict";fJ=St(er(),1);Pv();Vke=["type","lint","test","coverage"],wP={scope:"feature"},$P=["test-report.junit.xml",Hl("coverage","junit.xml"),Hl(".cladding","test-report.junit.xml")];Wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as EP,readFileSync as gJ,readdirSync as Kke,statSync as Jke}from"node:fs";import{join as Cv}from"node:path";function OP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Cv(t,e);if(EP(r))try{if(yJ.test(gJ(r,"utf8")))return!0}catch{}}return!1}function _J(t){try{return EP(t)&&yJ.test(gJ(t,"utf8"))}catch{return!1}}function bJ(t,e=0){if(e>4||!EP(t))return!1;let r;try{r=Kke(t)}catch{return!1}for(let n of r){let i=Cv(t,n),o=!1;try{o=Jke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(bJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&_J(i))return!0}return!1}function Qke(t){if(OP(t))return!0;for(let e of Yke)if(_J(Cv(t,e)))return!0;for(let e of Xke)if(bJ(Cv(t,e)))return!0;return!1}function vJ(t="."){let e=Gl(t).coverage;return e||(Qke(t)?"kover":"jacoco")}function SJ(t="."){return AP[vJ(t)]}function wJ(t="."){return kP[vJ(t)]}var AP,kP,TP,yJ,Yke,Xke,Dv=y(()=>{"use strict";_p();AP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},TP=[kP.kover,kP.jacoco],yJ=/kover/i;Yke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Xke=["buildSrc","build-logic"]});import{existsSync as vp,readFileSync as IP,readdirSync as $J,statSync as eEe}from"node:fs";import{dirname as tEe,join as xr,resolve as rEe}from"node:path";import Zl from"node:process";function PP(t){return vp(xr(t,"gradlew"))?"./gradlew":"gradle"}function nEe(t){let e=PP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[SJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function iEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(IP(xr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function sEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function lEe(t,e){for(let r of e)if(vp(xr(t,r)))return r}function uEe(t,e){try{return $J(t).find(n=>n.endsWith(e))}catch{return}}function mEe(t){let e=[],r=Zl.platform==="win32";r||e.push(xr("/etc","madge","config"),xr("/etc","madgerc"));let n=r?Zl.env.USERPROFILE:Zl.env.HOME;n&&e.push(xr(n,".config","madge","config"),xr(n,".config","madge"),xr(n,".madge","config"),xr(n,".madgerc"));for(let o=rEe(t);;){e.push(xr(o,".madgerc"));let s=tEe(o);if(s===o)break;o=s}let i=Zl.env.MADGE_config??Zl.env.madge_config;return i&&e.push(i),e}function hEe(){for(let[t,e]of Object.entries(Zl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function kJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function yEe(t){try{return eEe(t).isFile()}catch{return!1}}function _Ee(t){let e;try{e=IP(t,"utf8")}catch{return!0}try{return kJ(JSON.parse(e).excludeRegExp)}catch{return gEe.test(e)}}function bEe(t,e){let r=e.madge;return r&&typeof r=="object"&&kJ(r.excludeRegExp)||hEe()?!0:mEe(t).some(n=>yEe(n)&&_Ee(n))}function vEe(t){try{return JSON.parse(IP(xr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function bp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function xJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function SEe(t,e,r){if(bEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",pEe),{...e,args:n}}function wEe(t,e,r){if(bp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of dEe)if(n.configs.some(i=>vp(xr(t,i))))return n.gate;if(fEe.some(n=>vp(xr(t,n)))||r.eslintConfig!==void 0)return e}function $Ee(t,e){return xEe.some(r=>vp(xr(t,r)))?!0:e.jest!==void 0}function kEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function RP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function EEe(t,e){let r=vEe(t),n=e.lint?wEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:SEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:RP(i,"lint"),s=bp(r,"test"),a=s?kEe(s):void 0;return s&&!a?(o=RP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...bp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&$Ee(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!bp(r,"coverage")&&!xJ(r,"@vitest/coverage-v8")&&!xJ(r,"@vitest/coverage-istanbul")?o=RP(o,"coverage"):a==="vitest"&&bp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of aEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=uEe(t,o):r=lEe(t,[o]),r)break;if(!r||e.requiresSource&&!sEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?EEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return cEe}var Fi,oEe,aEe,cEe,dEe,fEe,pEe,gEe,xEe,cn=y(()=>{"use strict";Dv();Fi=["--offline","--no-install"];oEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);aEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:nEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:iEe}],cEe={language:"unknown",manifest:"",gates:{}};dEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],fEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],pEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";gEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;xEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as AEe,readFileSync as TEe}from"node:fs";import{join as OEe}from"node:path";function Ua(t){return t.code==="ENOENT"}function Nv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return EJ.test(o)||EJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ua(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} -${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Vl(t,e){let r=OEe(t,"package.json");if(!AEe(r))return!1;try{return!!JSON.parse(TEe(r,"utf8")).scripts?.[e]}catch{return!1}}var EJ,Cn=y(()=>{"use strict";EJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function REe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:jv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:jv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Nv(i,jv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var jv,qa,Mv=y(()=>{"use strict";Lr();cn();Cn();jv="ARCHITECTURE_VIOLATION";qa={name:jv,subprocess:!0,run:REe}});function IEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Fv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return Ua(i)?[{detector:Fv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Nv(i,Fv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Fv,Ba,Lv=y(()=>{"use strict";Lr();cn();Cn();Fv="HARDCODED_SECRET";Ba={name:Fv,subprocess:!0,run:IEe}});import{existsSync as CP,readdirSync as AJ}from"node:fs";import{join as zv}from"node:path";function CEe(t,e){let r=zv(t,e.path);if(!CP(r))return!0;if(e.isDirectory)try{return AJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function DEe(t){let{cwd:e="."}=t,r=[];for(let i of PEe)CEe(e,i)&&r.push({detector:Sp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=zv(e,"spec.yaml");if(CP(n)){let i=MEe(n),o=i?null:NEe(e);if(i)r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Sp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=jEe(e);s&&r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function NEe(t){for(let e of["spec/features","spec/scenarios"]){let r=zv(t,e);if(!CP(r))continue;let n;try{n=AJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(zv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jEe(t){try{return q(t),null}catch(e){return e.message}}function MEe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Sp,PEe,TJ,OJ=y(()=>{"use strict";Ue();H_();Sp="ABSENCE_OF_GOVERNANCE",PEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];TJ={name:Sp,run:DEe}});function Uv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Uv(r)==="while",o=LEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Uv(r)}'`}let n=FEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Uv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Uv(r)}'`:null}function zEe(t,e){let r=DP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function RJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zEe(r,n));return e}var FEe,LEe,NP=y(()=>{"use strict";FEe={event:"when",state:"while",optional:"where",unwanted:"if"},LEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function UEe(t){let{cwd:e="."}=t;return ge(e,qv,qEe)}function qEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:qv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of RJ(t.features))e.push({detector:qv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var qv,IJ,PJ=y(()=>{"use strict";NP();wt();qv="AC_DRIFT";IJ={name:qv,run:UEe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return DJ[n]??CJ}var BEe,HEe,GEe,CJ,ZEe,VEe,DJ,WEe,NJ,Ha=y(()=>{"use strict";cn();BEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,HEe=/^[ \t]*import\s+([\w.]+)/gm,GEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,CJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:BEe,importStyle:"relative"},ZEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:HEe,importStyle:"dotted"},VEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:GEe,importStyle:"dotted"},DJ={typescript:CJ,kotlin:ZEe,python:VEe},WEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],NJ=new Set([...Object.values(DJ).flatMap(t=>t?.extensions??[]),...WEe].map(t=>t.toLowerCase()))});import{existsSync as KEe,readFileSync as JEe,readdirSync as YEe,statSync as XEe}from"node:fs";import{join as MJ,relative as jJ}from"node:path";function QEe(t,e){if(!KEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=YEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=MJ(i,s),c;try{c=XEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rAe(t){return tAe.test(t)}function nAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>QEe(MJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=JEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Ha();FJ="AI_HINTS_FORBIDDEN_PATTERN";tAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;LJ={name:FJ,run:nAe}});function iAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:UJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var UJ,qJ,BJ=y(()=>{"use strict";Ue();UJ="AC_DUPLICATE_WITHIN_FEATURE";qJ={name:UJ,run:iAe}});import{createRequire as oAe}from"module";import{basename as sAe,dirname as MP,normalize as aAe,relative as cAe,resolve as lAe,sep as ZJ}from"path";import*as uAe from"fs";function dAe(t){let e=aAe(t);return e.length>1&&e[e.length-1]===ZJ&&(e=e.substring(0,e.length-1)),e}function VJ(t,e){return t.replace(fAe,e)}function mAe(t){return t==="/"||pAe.test(t)}function jP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lAe(t)),(n||o)&&(t=dAe(t)),t===".")return"";let s=t[t.length-1]!==i;return VJ(s?t+i:t,i)}function WJ(t,e){return e+t}function hAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:VJ(cAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gAe(t){return t}function yAe(t,e,r){return e+t+r}function _Ae(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hAe(t,e):n?WJ:gAe}function bAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ae(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vAe(t):bAe(t):n&&n.length?wAe:SAe:xAe}function RAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OAe:r&&r.length?n?kAe:EAe:n?AAe:TAe}function CAe(t){return t.group?PAe:IAe}function jAe(t){return t.group?DAe:NAe}function LAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FAe:MAe}function KJ(t,e,r){if(r.options.useRealPaths)return zAe(e,r);let n=MP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=MP(n)}return r.symlinks.set(t,e),i>1}function zAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Bv(t,e,r,n){e(t&&!n?t:null,r)}function KAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UAe:GAe:n?e?qAe:WAe:i?e?HAe:VAe:e?BAe:ZAe}function XAe(t){return t?YAe:JAe}function rTe(t,e){return new Promise((r,n)=>{XJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function XJ(t,e,r){new YJ(t,e,r).start()}function nTe(t,e){return new YJ(t,e).start()}var HJ,fAe,pAe,SAe,wAe,xAe,kAe,EAe,AAe,TAe,OAe,IAe,PAe,DAe,NAe,MAe,FAe,UAe,qAe,BAe,HAe,GAe,ZAe,VAe,WAe,JJ,JAe,YAe,QAe,eTe,tTe,YJ,GJ,QJ,e8,t8=y(()=>{HJ=oAe(import.meta.url);fAe=/[\\/]/g;pAe=/^[a-z]:[\\/]$/i;SAe=(t,e)=>{e.push(t||".")},wAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xAe=()=>{};kAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AAe=(t,e,r,n)=>{r.files++},TAe=(t,e)=>{e.push(t)},OAe=()=>{};IAe=t=>t,PAe=()=>[""].slice(0,0);DAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NAe=()=>{};MAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&KJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&KJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UAe=t=>t.counts,qAe=t=>t.groups,BAe=t=>t.paths,HAe=t=>t.paths.slice(0,t.options.maxFiles),GAe=(t,e,r)=>(Bv(e,r,t.counts,t.options.suppressErrors),null),ZAe=(t,e,r)=>(Bv(e,r,t.paths,t.options.suppressErrors),null),VAe=(t,e,r)=>(Bv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WAe=(t,e,r)=>(Bv(e,r,t.groups,t.options.suppressErrors),null);JJ={withFileTypes:!0},JAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",JJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",JJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},eTe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},tTe=class{aborted=!1;abort(){this.aborted=!0}},YJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KAe(e,this.isSynchronous),this.root=jP(t,e),this.state={root:mAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eTe,options:e,queue:new QAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tTe,fs:e.fs||uAe},this.joinPath=_Ae(this.root,e),this.pushDirectory=$Ae(this.root,e),this.pushFile=RAe(e),this.getArray=CAe(e),this.groupFiles=jAe(e),this.resolveSymlink=LAe(e,this.isSynchronous),this.walkDirectory=XAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=jP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=sAe(_),x=jP(MP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};GJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rTe(this.root,this.options)}withCallback(t){XJ(this.root,this.options,t)}sync(){return nTe(this.root,this.options)}},QJ=null;try{HJ.resolve("picomatch"),QJ=HJ("picomatch")}catch{}e8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:ZJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new GJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new GJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||QJ;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var wp=v((Fdt,s8)=>{"use strict";var r8="[^\\\\/]",iTe="(?=.)",n8="[^/]",FP="(?:\\/|$)",i8="(?:^|\\/)",LP=`\\.{1,2}${FP}`,oTe="(?!\\.)",sTe=`(?!${i8}${LP})`,aTe=`(?!\\.{0,1}${FP})`,cTe=`(?!${LP})`,lTe="[^.\\/]",uTe=`${n8}*?`,dTe="/",o8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iTe,QMARK:n8,END_ANCHOR:FP,DOTS_SLASH:LP,NO_DOT:oTe,NO_DOTS:sTe,NO_DOT_SLASH:aTe,NO_DOTS_SLASH:cTe,QMARK_NO_DOT:lTe,STAR:uTe,START_ANCHOR:i8,SEP:dTe},fTe={...o8,SLASH_LITERAL:"[\\\\/]",QMARK:r8,STAR:`${r8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},pTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};s8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?fTe:o8}}});var xp=v(zr=>{"use strict";var{REGEX_BACKSLASH:mTe,REGEX_REMOVE_BACKSLASH:hTe,REGEX_SPECIAL_CHARS:gTe,REGEX_SPECIAL_CHARS_GLOBAL:yTe}=wp();zr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);zr.hasRegexChars=t=>gTe.test(t);zr.isRegexChar=t=>t.length===1&&zr.hasRegexChars(t);zr.escapeRegex=t=>t.replace(yTe,"\\$1");zr.toPosixSlashes=t=>t.replace(mTe,"/");zr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};zr.removeBackslashes=t=>t.replace(hTe,e=>e==="\\"?"":e);zr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?zr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};zr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};zr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};zr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var m8=v((zdt,p8)=>{"use strict";var a8=xp(),{CHAR_ASTERISK:zP,CHAR_AT:_Te,CHAR_BACKWARD_SLASH:$p,CHAR_COMMA:bTe,CHAR_DOT:UP,CHAR_EXCLAMATION_MARK:qP,CHAR_FORWARD_SLASH:f8,CHAR_LEFT_CURLY_BRACE:BP,CHAR_LEFT_PARENTHESES:HP,CHAR_LEFT_SQUARE_BRACKET:vTe,CHAR_PLUS:STe,CHAR_QUESTION_MARK:c8,CHAR_RIGHT_CURLY_BRACE:wTe,CHAR_RIGHT_PARENTHESES:l8,CHAR_RIGHT_SQUARE_BRACKET:xTe}=wp(),u8=t=>t===f8||t===$p,d8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Te=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&u8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=a8.removeBackslashes(P)),xe&&_===!0&&(xe=a8.removeBackslashes(xe)));let Cr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Cr.maxDepth=0,u8(A)||s.push(D),Cr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var kp=wp(),ln=xp(),{MAX_LENGTH:Hv,POSIX_REGEX_SOURCE:kTe,REGEX_NON_SPECIAL_CHARS:ETe,REGEX_SPECIAL_CHARS_BACKREF:ATe,REPLACEMENTS:h8}=kp,TTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>ln.escapeRegex(i)).join("..")}return r},Wl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,g8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},OTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},y8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OTe(e))return e.replace(/\\(.)/g,"$1")},RTe=t=>{let e=t.map(y8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},ITe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=y8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?ln.escapeRegex(r[0]):`[${r.map(i=>ln.escapeRegex(i)).join("")}]`}*`},PTe=t=>{let e=0,r=t.trim(),n=GP(r);for(;n;)e++,r=n.body.trim(),n=GP(r);return e},CTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kp.DEFAULT_MAX_EXTGLOB_RECURSION,n=g8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RTe(n)))return{risky:!0};for(let i of n){let o=ITe(i);if(o)return{risky:!0,safeOutput:o};if(PTe(i)>r)return{risky:!0}}return{risky:!1}},ZP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=h8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=kp.globChars(r.windows),l=kp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ln.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Cr=()=>$.index===i-1,se=$.peek=(H=1)=>t[$.index+H],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(H="",ht=0)=>{$.consumed+=H,$.index+=ht},Xt=H=>{$.output+=H.output!=null?H.output:H.value,dr(H.value)},uo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,H++;return H%2===0?!1:($.negated=!0,$.start++,!0)},ki=H=>{$[H]++,xe.push(H)},en=H=>{$[H]--,xe.pop()},de=H=>{if(C.type==="globstar"){let ht=$.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!ht&&!B&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Xt(H),C&&C.type==="text"&&H.type==="text"){C.output=(C.output||C.value)+H.value,C.value+=H.value;return}H.prev=C,s.push(H),C=H},fo=(H,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=C,B.parens=$.parens,B.output=$.output,B.startIndex=$.index,B.tokensIndex=s.length;let Oe=(r.capture?"(":"")+B.open;ki("parens"),de({type:H,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(B)},Jde=H=>{let ht=t.slice(H.startIndex,$.index+1),B=t.slice(H.startIndex+2,$.index),Oe=CTe(B,r);if((H.type==="plus"||H.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(H.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[H.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=lt||ln.escapeRegex(ht);for(let Ai=H.tokensIndex+1;Ai1&&H.inner.includes("/")&&(lt=O(r)),(lt!==D||Cr()||/^\)+$/.test(Kt()))&&(ut=H.close=`)$))${lt}`),H.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=ZP(zt,{...e,fastpaths:!1}).output;ut=H.close=`)${Ei})${lt})`}H.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),en("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,ht=t.replace(ATe,(B,Oe,ut,zt,lt,Ei)=>zt==="\\"?(H=!0,B):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):Ei===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?B:`\\${B}`);return H===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=ln.wrapOutput(ht,$,e),$)}for(;!Cr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let B=C.value.slice(1);if(B.includes("[")&&(C.posix=!0,B.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=kTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=ln.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){ki("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Wl("opening","("));let B=re[re.length-1];if(B&&$.parens===B.parens+1){Jde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),en("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));P=`\\${P}`}else ki("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Wl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}en("brackets");let B=C.value.slice(1);if(C.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||ln.hasRegexChars(B))continue;let Oe=ln.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(B),de(B);continue}if(P==="}"){let B=K[K.length-1];if(r.nobrace===!0||!B){de({type:"text",value:P,output:P});continue}let Oe=")";if(B.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=TTe(zt,r),$.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let ut=$.output.slice(0,B.outputIndex),zt=$.tokens.slice(B.tokensIndex);B.value=B.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),en("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let B=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,B="|"),de({type:"comma",value:P,output:B});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let B=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,B.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){fo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){uo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let B=ETe.exec(Kt());B&&(P+=B[0],$.index+=B[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){fo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let B=C.prev,Oe=B.prev,ut=B.type==="slash"||B.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||H[0]&&H[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=re.length&&(B.type==="pipe"||B.type==="paren");if(!ut&&B.type!=="paren"&&!lt&&!Ei){de({type:"star",value:P,output:""});continue}for(;H.slice(0,3)==="/**";){let Ai=t[$.index+4];if(Ai&&Ai!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Cr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&Cr()){$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=B.output+C.output,dr(P);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let Ai=H[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(B.output+C.output).length),B.output=`(?:${B.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ai})`,C.value+=P,$.output+=B.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));$.output=ln.escapeLast($.output,"["),en("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing",")"));$.output=ln.escapeLast($.output,"("),en("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","}"));$.output=ln.escapeLast($.output,"{"),en("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let H of $.tokens)$.output+=H.output!=null?H.output:H.value,H.suffix&&($.output+=H.suffix)}return $};ZP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=h8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=kp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=ln.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};_8.exports=ZP});var w8=v((qdt,S8)=>{"use strict";var DTe=m8(),VP=b8(),v8=xp(),NTe=wp(),jTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jTe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?v8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(v8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):VP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>DTe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=VP.fastpaths(t,e)),i.output||(i=VP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=NTe;S8.exports=Rt});var E8=v((Bdt,k8)=>{"use strict";var x8=w8(),MTe=xp();function $8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MTe.isWindows()}),x8(t,e,r)}Object.assign($8,x8);k8.exports=$8});import{readdir as FTe,readdirSync as LTe,realpath as zTe,realpathSync as UTe,stat as qTe,statSync as BTe}from"fs";import{isAbsolute as HTe,posix as Ga,resolve as GTe}from"path";import{fileURLToPath as ZTe}from"url";function KTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&WTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Ga.relative(t,n)||".":n=>Ga.relative(t,`${e}/${n}`)||"."}function XTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ga.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function R8(t){var e;let r=Kl.default.scan(t,QTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Kl.default.scan(t);return r.isGlob||r.negated}function Ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function I8(t){return typeof t=="string"?[t]:t??[]}function WP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=iOe(o);s=HTe(s.replace(aOe,""))?Ga.relative(a,s):Ga.normalize(s);let c=(i=sOe.exec(s))===null||i===void 0?void 0:i[0],l=R8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Ga.join(o,...d):o}return s}function cOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cOe(t,e,n);t.debug&&Ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(T8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Kl.default)(i.match,f),m=(0,Kl.default)(i.ignore,f),h=KTe(i.match,f),g=A8(r,d,o),b=o?g:A8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new e8({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&Ep(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return Ep(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XTe(r,d)]}function uOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fOe(t){let e={...dOe,...t};return e.cwd=(e.cwd instanceof URL?ZTe(e.cwd):GTe(e.cwd)).replace(T8,"/"),e.ignore=I8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FTe,readdirSync:e.fs.readdirSync||LTe,realpath:e.fs.realpath||zTe,realpathSync:e.fs.realpathSync||UTe,stat:e.fs.stat||qTe,statSync:e.fs.statSync||BTe}),e.debug&&Ep("globbing with options:",e),e}function pOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VTe(t)||typeof t=="string",i=I8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fOe(n?e:t);return i.length>0?lOe(o,i):[]}function _s(t,e){let[r,n]=pOe(t,e);return r?uOe(r.sync(),n):[]}var Kl,VTe,T8,O8,WTe,JTe,YTe,QTe,eOe,tOe,rOe,nOe,iOe,sOe,aOe,dOe,Ap=y(()=>{t8();Kl=St(E8(),1),VTe=Array.isArray,T8=/\\/g,O8=process.platform==="win32",WTe=/^(\/?\.\.)+$/;JTe=/^[A-Z]:\/$/i,YTe=O8?t=>JTe.test(t):t=>t==="/";QTe={parts:!0};eOe=/(?t.replace(eOe,"\\$&"),nOe=t=>t.replace(tOe,"\\$&"),iOe=O8?nOe:rOe;sOe=/^(\/?\.\.)+/,aOe=/\\(?=[()[\]{}!*+?@|])/g;dOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Tp,readFileSync as mOe,readdirSync as hOe,statSync as P8}from"node:fs";import{join as Za}from"node:path";function gOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=KP(r);return(s.size>0||a.length>0)&&!Tp(Za(e,i.mainRoot))?[{detector:Op,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(yOe(e,i,s,o),_Oe(e,i,s,o)),a.length>0&&bOe(e,i,a,o),o)}function KP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function yOe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of hOe(o)){let a=Za(o,s);P8(a).isDirectory()&&(r.has(s)||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Oe(t,e,r,n){let i=e.mainRoot,o=Za(t,i);if(Tp(o))for(let s of r){let a=Za(o,s);Tp(a)&&P8(a).isDirectory()||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function bOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Za(t,i,s.from);if(!Tp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Za(a,l),d;try{d=mOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vOe(p,s.to,e.importStyle)&&n.push({detector:Op,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function vOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Op,C8,JP=y(()=>{"use strict";Ap();Ue();Ha();Op="ARCHITECTURE_FROM_SPEC";C8={name:Op,run:gOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function kOe(t){let{cwd:e="."}=t,r=xOe(e,"spec/capabilities.yaml");if(!SOe(r))return[];let n;try{let u=wOe(r,"utf8"),d=D8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size<$Oe;for(let u of i){if(typeof u!="object"||u===null)continue;let d=String(u.id??"(unnamed)"),f=Array.isArray(u.features)?u.features:[];if(f.length===0){a.push({detector:Gv,severity:l?"info":"warn",path:"spec/capabilities.yaml",message:l?`capability "${d}" has no features mapped yet \u2014 retained as future onboarding intent; bind it when a matching feature lands`:`capability "${d}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let p of f){let m=String(p);o.has(m)?c.add(m):a.push({detector:Gv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${d}" references feature ${m} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let u of o)c.has(u)||a.push({detector:Gv,severity:"info",path:"spec.yaml",message:`feature ${u} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return a}var D8,Gv,$Oe,N8,j8=y(()=>{"use strict";D8=St(er(),1);Ue();Gv="CAPABILITIES_FEATURE_MAPPING",$Oe=8;N8={name:Gv,run:kOe}});import{existsSync as EOe,readFileSync as AOe}from"node:fs";import{join as TOe}from"node:path";function OOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function ROe(t){let{cwd:e="."}=t;return ge(e,YP,r=>IOe(r,e))}function IOe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=TOe(e,o);if(!EOe(s))continue;let a=AOe(s,"utf8");OOe(a)||n.push({detector:YP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YP,M8,F8=y(()=>{"use strict";Ha();wt();YP="CONVENTION_DRIFT";M8={name:YP,run:ROe}});import{existsSync as XP,readFileSync as L8}from"node:fs";import{join as Zv}from"node:path";function POe(t){return JSON.parse(t).total?.lines?.pct??0}function z8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function NOe(t,e){if(!Rv(dt(t).gates.coverage?.cmd))return null;let r;try{r=Iv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=TP.find(d=>XP(Zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=z8(L8(Zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=U8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function jOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=NOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=dt(e).language==="kotlin"?TP.find(a=>XP(Zv(e,a)))??wJ(e):n.coverageSummary,o=Zv(e,i);if(!XP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=L8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?COe(a):n.coverageFormat==="cobertura-xml"?DOe(a):POe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Vv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Vv}%`}]}var ko,Vv,q8,B8=y(()=>{"use strict";Ue();Dv();Ha();Pv();cn();ko="COVERAGE_DROP",Vv=70;q8={name:ko,run:jOe}});import{existsSync as MOe}from"node:fs";import{join as FOe}from"node:path";function zOe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>UOe(r,e))}function UOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Wv="DELIVERABLE_INTEGRITY",LOe=8;H8={name:Wv,run:zOe}});function qOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Kv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function BOe(t){let e=qOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Kv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function HOe(t){let{cwd:e="."}=t;return ge(e,Kv,r=>BOe(r))}var Kv,Z8,V8=y(()=>{"use strict";wt();Kv="SMOKE_PROBE_DEMAND";Z8={name:Kv,run:HOe}});function GOe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>ZOe(r,e))}function ZOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Jv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=J_(n,e,o);s.state!=="fresh"&&i.push({detector:Jv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Jv,Yv,QP=y(()=>{"use strict";xl();wt();Jv="STALE_ATTESTATION";Yv={name:Jv,run:GOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return WOe(r)}function WOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:W8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var W8,Xv,eC=y(()=>{"use strict";Ue();W8="DEPENDENCY_CYCLE";Xv={name:W8,run:VOe}});import{appendFileSync as KOe,existsSync as K8,mkdirSync as JOe,readFileSync as YOe}from"node:fs";import{dirname as XOe,join as QOe}from"node:path";function J8(t){return QOe(t,eRe,tRe)}function Y8(t){return tC.add(t),()=>tC.delete(t)}function Va(t,e){let r=J8(t),n=XOe(r);K8(n)||JOe(n,{recursive:!0}),KOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of tC)try{i(t,e)}catch{}}function fr(t){let e=J8(t);if(!K8(e))return[];let r=YOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var eRe,tRe,tC,un=y(()=>{"use strict";eRe=".cladding",tRe="audit.log.jsonl";tC=new Set});import{existsSync as rRe}from"node:fs";import{join as nRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:rC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(rRe(nRe(e,i.artifact))||n.push({detector:rC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var rC,X8,Q8=y(()=>{"use strict";un();rC="EVIDENCE_MISMATCH";X8={name:rC,run:iRe}});import{existsSync as oRe,readFileSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let e=aRe(t,n5);if(!oRe(e))return null;try{let n=((0,r5.parse)(sRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*t5(t,e){for(let r of t??[])r.startsWith(e5)&&(yield{ref:r,name:r.slice(e5.length),field:e})}function lRe(t){let{cwd:e="."}=t,r=cRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:nC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...t5(s.evidence_refs,"evidence_refs"),...t5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:nC,severity:"warn",path:n5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var r5,nC,e5,n5,i5,o5=y(()=>{"use strict";r5=St(er(),1);Ue();nC="FIXTURE_REFERENCE_INVALID",e5="fixture:",n5="conformance/fixtures.yaml";i5={name:nC,run:lRe}});import{existsSync as Jl,readFileSync as iC}from"node:fs";import{join as Wa}from"node:path";function uRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Rp(t){if(!Jl(t))return null;try{return JSON.parse(iC(t,"utf8"))}catch{return null}}function dRe(t,e){let r=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=uRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function fRe(t,e){for(let r of s5){let n=Wa(t,r.path);if(!Jl(n))continue;let i=Rp(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function pRe(t,e){let r=Rp(Wa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of s5){let s=Wa(t,o.path);if(!Jl(s))continue;let a=Rp(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Wa(t,".claude-plugin","marketplace.json");if(Jl(i)){let o=Rp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function mRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function hRe(t,e){let r=Wa(t,"src","cli","clad.ts"),n=Wa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Jl(r)||!Jl(n))return;let i=mRe(iC(r,"utf8"));if(i.length===0)return;let s=Rp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function gRe(t){let{cwd:e="."}=t,r=[];return dRe(e,r),hRe(e,r),fRe(e,r),pRe(e,r),r}var Eo,s5,a5,c5=y(()=>{"use strict";Ap();Eo="HARNESS_INTEGRITY",s5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];a5={name:Eo,run:gRe}});import{existsSync as yRe,readFileSync as _Re}from"node:fs";import{join as bRe}from"node:path";function SRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>xRe(r,e))}function wRe(t){let e=bRe(t,"spec/capabilities.yaml");if(!yRe(e))return!1;try{let r=l5.default.parse(_Re(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function xRe(t,e){let r=t.features.length;if(r{"use strict";l5=St(er(),1);wt();Qv="HOLLOW_GOVERNANCE",vRe=8;u5={name:Qv,run:SRe}});import{existsSync as f5,readFileSync as p5}from"node:fs";import{join as m5}from"node:path";function h5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function ERe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function ARe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function TRe(t){let e=m5(t,"README.md"),r=m5(t,"docs","dogfood","matrix.md");if(!f5(e)||!f5(r))return[];let n=h5(p5(e,"utf8"),$Re),i=h5(p5(r,"utf8"),kRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=ARe(a);if(c===null)continue;let l=i[s]??"not-run",u=ERe(l);u!==null&&c>u&&o.push({detector:g5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ORe(t){let{cwd:e="."}=t;return TRe(e)}var g5,$Re,kRe,y5,_5=y(()=>{"use strict";g5="HOST_CLAIM_DRIFT",$Re=//,kRe=//;y5={name:g5,run:ORe}});function RRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return b5(r.features.map(i=>i.id),"feature","spec/features/",n),b5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function b5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:v5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var v5,S5,w5=y(()=>{"use strict";Ue();v5="ID_COLLISION";S5={name:v5,run:RRe}});import{existsSync as Ip,readFileSync as oC,readdirSync as sC,statSync as IRe,writeFileSync as $5}from"node:fs";import{join as Ao}from"node:path";function x5(t){if(!Ip(t))return 0;try{return sC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function PRe(t){if(!Ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=IRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function CRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Ip(e))return 0;try{let r=eS.default.parse(oC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=x5(Ao(t,"spec","features")),r=x5(Ao(t,"spec","scenarios")),n=CRe(t),i=PRe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Yl(t,e){let r=Ao(t,"spec.yaml");if(!Ip(r))return;let n=oC(r,"utf8"),i=DRe(n,e);i!==n&&$5(r,i)}function DRe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as i0e}from"node:buffer";import{StringDecoder as o0e}from"node:string_decoder";var av,s0e,a0e,c0e,xI=y(()=>{sn();av=(t,e,r)=>{if(r)return;if(t)return{transform:s0e.bind(void 0,new TextEncoder)};let n=new o0e(e);return{transform:a0e.bind(void 0,n),final:c0e.bind(void 0,n)}},s0e=function*(t,e){i0e.isBuffer(e)?yield bo(e):typeof e=="string"?yield t.encode(e):yield e},a0e=function*(t,e){yield qt(e)?t.write(e):e},c0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as u3}from"node:util";var $I,cv,d3,l0e,f3,u0e,p3=y(()=>{$I=u3(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),cv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u0e}=e[r];for await(let i of n(t))yield*cv(i,e,r+1)},d3=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l0e(r,Number(e),t)},l0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*cv(n,r,e+1)},f3=u3(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),u0e=function*(t){yield t}});var kI,m3,La,fp,d0e,f0e,EI=y(()=>{kI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},m3=(t,e)=>[...e.flatMap(r=>[...La(r,t,0)]),...fp(t)],La=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=f0e}=e[r];for(let i of n(t))yield*La(i,e,r+1)},fp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*d0e(r,Number(e),t)},d0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*La(n,r,e+1)},f0e=function*(t){yield t}});import{Transform as p0e,getDefaultHighWaterMark as h3}from"node:stream";var AI,lv,g3,uv=y(()=>{wr();sv();l3();xI();p3();EI();AI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=g3(t,s,o),l=Fa(e),u=Fa(r),d=l?$I.bind(void 0,cv,a):kI.bind(void 0,La),f=l||u?$I.bind(void 0,d3,a):kI.bind(void 0,fp),p=l||u?f3.bind(void 0,a):void 0;return{stream:new p0e({writableObjectMode:n,writableHighWaterMark:h3(n),readableObjectMode:i,readableHighWaterMark:h3(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},lv=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=g3(s,r,a);t=m3(c,t)}return t},g3=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:s3(n,a)},av(r,s,n),ov(r,o,n,c),{transform:t,final:e},{transform:a3(i,a)},o3({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var y3,m0e,h0e,g0e,y0e,_3=y(()=>{uv();sn();wr();y3=(t,e)=>{for(let r of m0e(t))h0e(t,r,e)},m0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),h0e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${hs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>g0e(a,n));r.input=Jf(s)},g0e=(t,e)=>{let r=lv(t,e,"utf8",!0);return y0e(r),Jf(r)},y0e=t=>{let e=t.find(r=>typeof r!="string"&&!qt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var dv,_0e,b0e,b3,v3,v0e,S3,TI=y(()=>{Da();wr();Ol();ds();dv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Tl(r,n)&&!an.has(e)&&_0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&b0e.has(o))||t.every(({type:i})=>Pn.has(i))),_0e=t=>t===1||t===2,b0e=new Set(["pipe","overlapped"]),b3=async(t,e,r,n)=>{for await(let i of t)v0e(e)||S3(i,r,n)},v3=(t,e,r)=>{for(let n of t)S3(n,e,r)},v0e=t=>t._readableState.pipes.length>0,S3=(t,e,r)=>{let n=ub(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as S0e,appendFileSync as w0e}from"node:fs";var w3,x0e,$0e,k0e,E0e,A0e,x3=y(()=>{TI();uv();sv();sn();wr();Ma();w3=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>x0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},x0e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=aW(t,o,d),p=bo(f),{stdioItems:m,objectMode:h}=e[r],g=$0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=k0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});E0e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&A0e(b,m,i),S}catch(x){return n.error=x,S}},$0e=(t,e,r,n)=>{try{return lv(t,e,r,!1)}catch(i){return n.error=i,t}},k0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Jf(t)};let s=YG(t,r);return n[o]?{serializedResult:s,finalResult:wI(s,!i[o],e)}:{serializedResult:s}},E0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!dv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=wI(t,!1,s);try{v3(a,e,n)}catch(c){r.error??=c}},A0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>rv.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?w0e(n,t):(r.add(o),S0e(n,t))}}});var $3,k3=y(()=>{sn();dp();$3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,$o(e,r,"all")]:Array.isArray(e)?[$o(t,r,"all"),...e]:qt(t)&&qt(e)?yR([t,e]):`${t}${e}`}});import{once as OI}from"node:events";var E3,T0e,A3,T3,O0e,RI,II=y(()=>{Pa();E3=async(t,e)=>{let[r,n]=await T0e(t);return e.isForcefullyTerminated??=!1,[r,n]},T0e=async t=>{let[e,r]=await Promise.allSettled([OI(t,"spawn"),OI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?A3(t):r.value},A3=async t=>{try{return await OI(t,"exit")}catch{return A3(t)}},T3=async t=>{let[e,r]=await t;if(!O0e(e,r)&&RI(e,r))throw new ri;return[e,r]},O0e=(t,e)=>t===void 0&&e===void 0,RI=(t,e)=>t!==0||e!==null});var O3,R0e,R3=y(()=>{Pa();Ma();II();O3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R0e(t,e,r),s=o?.code==="ETIMEDOUT",a=sW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R0e=(t,e,r)=>t!==void 0?t:RI(e,r)?new ri:void 0});import{spawnSync as I0e}from"node:child_process";var I3,P0e,C0e,D0e,fv,N0e,j0e,M0e,F0e,P3=y(()=>{ER();eI();tI();up();Qb();r3();dp();_3();x3();Ma();k3();R3();I3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=P0e(t,e,r),d=N0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return zl(d,c,l)},P0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),a=C0e(r),{file:c,commandArguments:l,options:u}=zb(t,e,a);D0e(u);let d=e3(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},C0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,D0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&fv("ipcInput"),t&&fv("ipc: true"),r&&fv("detached: true"),n&&fv("cancelSignal")},fv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},N0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=j0e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=O3(c,r),{output:m,error:h=l}=w3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>$o(_,r,S)),b=$o($3(m,r),r,"all");return F0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},j0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{y3(o,r);let a=M0e(r);return I0e(...Ub(t,e,a))}catch(a){return Ll({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Yb(e)}),F0e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Xb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):lp({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as PI,on as L0e}from"node:events";var C3,z0e,U0e,q0e,B0e,D3=y(()=>{Dl();ip();np();C3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Pl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),z0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),z0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Eb(e,i);let o=ms(t,e,r),s=new AbortController;try{return await Promise.race([U0e(o,n,s),q0e(o,r,s),B0e(o,r,s)])}catch(a){throw Cl(t),a}finally{s.abort(),Ab(e,i)}},U0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await PI(t,"message",{signal:r});return n}for await(let[n]of L0e(t,"message",{signal:r}))if(e(n))return n},q0e=async(t,e,{signal:r})=>{await PI(t,"disconnect",{signal:r}),G9(e)},B0e=async(t,e,{signal:r})=>{let[n]=await PI(t,"strict:error",{signal:r});throw wb(n,e)}});import{once as j3,on as H0e}from"node:events";var M3,CI,G0e,Z0e,V0e,N3,DI=y(()=>{Dl();ip();np();M3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Pl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Cb(t)}),Eb(e,o);let s=ms(t,e,r),a=new AbortController,c={};return G0e(t,s,a),Z0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),V0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},G0e=async(t,e,r)=>{try{await j3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Z0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await j3(t,"strict:error",{signal:r.signal});n.error=wb(i,e),r.abort()}catch{}},V0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of H0e(r,"message",{signal:o.signal}))N3(s),yield c}catch{N3(s)}finally{o.abort(),Ab(e,a),n||Cl(t),i&&await t}},N3=({error:t})=>{if(t)throw t}});import F3 from"node:process";var L3,z3,U3,NI=y(()=>{Fb();D3();DI();Ib();L3=(t,{ipc:e})=>{Object.assign(t,U3(t,!1,e))},z3=()=>{let t=F3,e=!0,r=F3.channel!==void 0;return{...U3(t,e,r),getCancelSignal:bV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},U3=(t,e,r)=>({sendMessage:Mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:C3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:M3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as W0e}from"node:child_process";import{PassThrough as K0e,Readable as J0e,Writable as Y0e,Duplex as X0e}from"node:stream";var q3,Q0e,pp,e$e,t$e,r$e,n$e,B3=y(()=>{iv();up();Qb();q3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{bI(n);let a=new W0e;Q0e(a,n),Object.assign(a,{readable:e$e,writable:t$e,duplex:r$e});let c=Ll({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=n$e(c,s,i);return{subprocess:a,promise:l}},Q0e=(t,e)=>{let r=pp(),n=pp(),i=pp(),o=Array.from({length:e.length-3},pp),s=pp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},pp=()=>{let t=new K0e;return t.end(),t},e$e=()=>new J0e({read(){}}),t$e=()=>new Y0e({write(){}}),r$e=()=>new X0e({read(){},write(){}}),n$e=async(t,e,r)=>zl(t,e,r)});import{createReadStream as H3,createWriteStream as G3}from"node:fs";import{Buffer as i$e}from"node:buffer";import{Readable as mp,Writable as o$e,Duplex as s$e}from"node:stream";var V3,hp,Z3,a$e,W3=y(()=>{uv();iv();wr();V3=(t,e)=>nv(a$e,t,e,!1),hp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${hs[t]}.`)},Z3={fileNumber:hp,generator:AI,asyncGenerator:AI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:s$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},a$e={input:{...Z3,fileUrl:({value:t})=>({stream:H3(t)}),filePath:({value:{file:t}})=>({stream:H3(t)}),webStream:({value:t})=>({stream:mp.fromWeb(t)}),iterable:({value:t})=>({stream:mp.from(t)}),asyncIterable:({value:t})=>({stream:mp.from(t)}),string:({value:t})=>({stream:mp.from(t)}),uint8Array:({value:t})=>({stream:mp.from(i$e.from(t))})},output:{...Z3,fileUrl:({value:t})=>({stream:G3(t)}),filePath:({value:{file:t,append:e}})=>({stream:G3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:o$e.fromWeb(t)}),iterable:hp,asyncIterable:hp,string:hp,uint8Array:hp}}});import{on as c$e,once as K3}from"node:events";import{PassThrough as l$e,getDefaultHighWaterMark as u$e}from"node:stream";import{finished as X3}from"node:stream/promises";function za(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)MI(i);let e=t.some(({readableObjectMode:i})=>i),r=d$e(t,e),n=new jI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var d$e,jI,f$e,p$e,m$e,MI,h$e,g$e,y$e,_$e,b$e,Q3,eK,FI,tK,v$e,pv,J3,Y3,mv=y(()=>{d$e=(t,e)=>{if(t.length===0)return u$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},jI=class extends l$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(MI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=f$e(this,this.#t,this.#o);let r=h$e({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(MI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},f$e=async(t,e,r)=>{pv(t,J3);let n=new AbortController;try{await Promise.race([p$e(t,n),m$e(t,e,r,n)])}finally{n.abort(),pv(t,-J3)}},p$e=async(t,{signal:e})=>{try{await X3(t,{signal:e,cleanup:!0})}catch(r){throw Q3(t,r),r}},m$e=async(t,e,r,{signal:n})=>{for await(let[i]of c$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},MI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},h$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{pv(t,Y3);let a=new AbortController;try{await Promise.race([g$e(o,e,a),y$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),_$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),pv(t,-Y3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?FI(t):b$e(t))},g$e=async(t,e,{signal:r})=>{try{await t,r.aborted||FI(e)}catch(n){r.aborted||Q3(e,n)}},y$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await X3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;eK(s)?i.add(e):tK(t,s)}},_$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await K3(t,i,{signal:o}),!t.readable)return K3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},b$e=t=>{t.writable&&t.end()},Q3=(t,e)=>{eK(e)?FI(t):tK(t,e)},eK=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",FI=t=>{(t.readable||t.writable)&&t.destroy()},tK=(t,e)=>{t.destroyed||(t.once("error",v$e),t.destroy(e))},v$e=()=>{},pv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},J3=2,Y3=1});import{finished as rK}from"node:stream/promises";var ql,S$e,LI,w$e,zI,hv=y(()=>{vo();ql=(t,e)=>{t.pipe(e),S$e(t,e),w$e(t,e)},S$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await rK(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LI(e)}},LI=t=>{t.writable&&t.end()},w$e=async(t,e)=>{if(!(ti(t)||ti(e))){try{await rK(e,{cleanup:!0,readable:!1,writable:!0})}catch{}zI(t)}},zI=t=>{t.readable&&t.destroy()}});var nK,x$e,$$e,k$e,E$e,A$e,iK=y(()=>{mv();vo();kb();wr();hv();nK=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Pn.has(c)))x$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Pn.has(c)))k$e({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:za(o);ql(s,i)}},x$e=(t,e,r,n)=>{r==="output"?ql(t.stdio[n],e):ql(e,t.stdio[n]);let i=$$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},$$e=["stdin","stdout","stderr"],k$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;E$e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},E$e=(t,{signal:e})=>{ti(t)&&Ca(t,A$e,e)},A$e=2});var Ua,oK=y(()=>{Ua=[];Ua.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ua.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ua.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var gv,UI,qI,T$e,BI,yv,O$e,HI,GI,ZI,sK,jat,Mat,aK=y(()=>{oK();gv=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",UI=Symbol.for("signal-exit emitter"),qI=globalThis,T$e=Object.defineProperty.bind(Object),BI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(qI[UI])return qI[UI];T$e(qI,UI,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},yv=class{},O$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),HI=class extends yv{onExit(){return()=>{}}load(){}unload(){}},GI=class extends yv{#t=ZI.platform==="win32"?"SIGINT":"SIGHUP";#r=new BI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ua)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!gv(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Ua)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Ua.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return gv(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&gv(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},ZI=globalThis.process,{onExit:sK,load:jat,unload:Mat}=O$e(gv(ZI)?new GI(ZI):new HI)});import{addAbortListener as R$e}from"node:events";var cK,lK=y(()=>{aK();cK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=sK(()=>{t.kill()});R$e(n,()=>{i()})}});var dK,I$e,P$e,uK,C$e,fK=y(()=>{gR();fb();ps();El();dK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=db(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=I$e(r,n,i),{sourceStream:d,sourceError:f}=C$e(t,l),{options:p,fileDescriptors:m}=Ni.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},I$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=P$e(t,e,...r),a=$b(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},P$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(uK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||mR(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=eb(r,...n);return{destination:e(uK)(i,o,s),pipeOptions:s}}if(Ni.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},uK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),C$e=(t,e)=>{try{return{sourceStream:jl(t,e)}}catch(r){return{sourceError:r}}}});var mK,D$e,VI,pK,WI=y(()=>{up();hv();mK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=D$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw VI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},D$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return zI(t),n;if(e!==void 0)return LI(r),e},VI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ll({error:t,command:pK,escapedCommand:pK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),pK="source.pipe(destination)"});var hK,gK=y(()=>{hK=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as N$e}from"node:stream/promises";var yK,j$e,M$e,F$e,_v,L$e,z$e,_K=y(()=>{mv();kb();hv();yK=(t,e,r)=>{let n=_v.has(e)?M$e(t,e):j$e(t,e);return Ca(t,L$e,r.signal),Ca(e,z$e,r.signal),F$e(e),n},j$e=(t,e)=>{let r=za([t]);return ql(r,e),_v.set(e,r),r},M$e=(t,e)=>{let r=_v.get(e);return r.add(t),r},F$e=async t=>{try{await N$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}_v.delete(t)},_v=new WeakMap,L$e=2,z$e=1});import{aborted as U$e}from"node:util";var bK,q$e,vK=y(()=>{WI();bK=(t,e)=>t===void 0?[]:[q$e(t,e)],q$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await U$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw VI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var bv,B$e,H$e,SK=y(()=>{_o();fK();WI();gK();_K();vK();bv=(t,...e)=>{if(Ot(e[0]))return bv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=dK(t,...e),i=B$e({...n,destination:r});return i.pipe=bv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},B$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=H$e(t,i);mK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=yK(e,o,d);return await Promise.race([hK(u),...bK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},H$e=(t,e)=>Promise.allSettled([t,e])});import{on as G$e}from"node:events";import{getDefaultHighWaterMark as Z$e}from"node:stream";var vv,V$e,KI,W$e,xK,JI,wK,K$e,J$e,Sv=y(()=>{xI();sv();EI();vv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return V$e(e,s),xK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},V$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},KI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;W$e(e,s,t);let a=t.readableObjectMode&&!o;return xK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},W$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},xK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=G$e(t,"data",{signal:e.signal,highWaterMark:wK,highWatermark:wK});return K$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},JI=Z$e(!0),wK=JI,K$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=J$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*La(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*fp(a)}},J$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[av(t,r,!e),ov(t,i,!n,{})].filter(Boolean)});import{setImmediate as Y$e}from"node:timers/promises";var $K,X$e,Q$e,eke,YI,kK,XI=y(()=>{Jb();sn();TI();Sv();Ma();dp();$K=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=X$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Q$e(t),d]);return}let f=vI(c,r),p=KI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([eke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},X$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!dv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=KI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await b3(a,t,r,o)},Q$e=async t=>{await Y$e(),t.readableFlowing===null&&t.resume()},eke=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Zb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Vb(r,{maxBuffer:o})):await Kb(r,{maxBuffer:o})}catch(a){return kK(nW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},YI=async t=>{try{return await t}catch(e){return kK(e)}},kK=({bufferedData:t})=>KG(t)?new Uint8Array(t):t});import{finished as tke}from"node:stream/promises";var gp,rke,nke,ike,oke,ske,QI,wv,EK,xv=y(()=>{gp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=rke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],tke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||oke(a,e,r,n)}finally{s.abort()}},rke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&nke(t,r,n),n},nke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{ike(e,r),n.call(t,...i)}},ike=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},oke=(t,e,r,n)=>{if(!ske(t,e,r,n))throw t},ske=(t,e,r,n=!0)=>r.propagating?EK(t)||wv(t):(r.propagating=!0,QI(r,e)===n?EK(t):wv(t)),QI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",wv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",EK=t=>t?.code==="EPIPE"});var AK,eP,tP=y(()=>{XI();xv();AK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>eP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),eP=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=gp(t,e,l);if(QI(l,e)){await u;return}let[d]=await Promise.all([$K({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var TK,OK,ake,cke,rP=y(()=>{mv();tP();TK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?za([t,e].filter(Boolean)):void 0,OK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>eP({...ake(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:cke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),ake=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},cke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var RK,IK,PK=y(()=>{Ol();ds();RK=t=>Tl(t,"ipc"),IK=(t,e)=>{let r=ub(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var CK,DK,NK=y(()=>{Ma();PK();wo();DI();CK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=RK(o),a=So(e,"ipc"),c=So(r,"ipc");for await(let l of CI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(iW(t,i,c),i.push(l)),s&&IK(l,o);return i},DK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as lke}from"node:events";var jK,uke,dke,fke,MK=y(()=>{ja();KR();zR();WR();vo();wr();XI();NK();YR();rP();tP();II();xv();jK=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=E3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=AK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=OK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=CK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=uke(h,t,S),D=dke(m,S);try{return await Promise.race([Promise.all([{},T3(_),Promise.all(x),w,T,OV(t,d),...A,...D]),g,fke(t,b),...$V(t,o,f,b),...H9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...wV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(re=>YI(re))),YI(w),DK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},uke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:gp(n,i,r)),dke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ii(o,{checkOpen:!1})&&!ti(o)).map(({type:i,value:o,stream:s=o})=>gp(s,n,e,{isSameDirection:Pn.has(i),stopOnExit:i==="native"}))),fke=async(t,{signal:e})=>{let[r]=await lke(t,"error",{signal:e});throw r}});var FK,yp,Bl,$v=y(()=>{Nl();FK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),yp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Di();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Bl=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as LK}from"node:stream/promises";var nP,zK,iP,oP,kv,Ev,sP=y(()=>{xv();nP=async t=>{if(t!==void 0)try{await iP(t)}catch{}},zK=async t=>{if(t!==void 0)try{await oP(t)}catch{}},iP=async t=>{await LK(t,{cleanup:!0,readable:!1,writable:!0})},oP=async t=>{await LK(t,{cleanup:!0,readable:!0,writable:!1})},kv=async(t,e)=>{if(await t,e)throw e},Ev=(t,e,r)=>{r&&!wv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as pke}from"node:stream";import{callbackify as mke}from"node:util";var UK,aP,cP,lP,hke,uP,dP,qK,fP=y(()=>{Da();ps();Sv();Nl();$v();sP();UK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||an.has(r),{subprocessStdout:a,waitReadableDestroy:c}=aP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=cP(a,s),{read:f,onStdoutDataDone:p}=lP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new pke({read:f,destroy:mke(dP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return uP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},aP=(t,e,r)=>{let n=jl(t,e),i=yp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},cP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:JI},lP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=vv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){hke(this,s,o)},onStdoutDataDone:o}},hke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},uP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await oP(t),await n,await nP(i),await e,r.readable&&r.push(null)}catch(o){await nP(i),qK(r,o)}},dP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(qK(t,n),await kv(e,n))},qK=(t,e)=>{Ev(t,t.readable,e)}});import{Writable as gke}from"node:stream";import{callbackify as BK}from"node:util";var HK,pP,mP,yke,_ke,hP,gP,GK,yP=y(()=>{ps();$v();sP();HK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=pP(t,r,e),s=new gke({...mP(n,t,i),destroy:BK(gP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return hP(n,s),s},pP=(t,e,r)=>{let n=$b(t,e),i=yp(r,n,"writableFinal"),o=yp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},mP=(t,e,r)=>({write:yke.bind(void 0,t),final:BK(_ke.bind(void 0,t,e,r))}),yke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},_ke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},hP=async(t,e,r)=>{try{await iP(t),e.writable&&e.end()}catch(n){await zK(r),GK(e,n)}},gP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(GK(t,i),await kv(e,i))},GK=(t,e)=>{Ev(t,t.writable,e)}});import{Duplex as bke}from"node:stream";import{callbackify as vke}from"node:util";var ZK,Ske,VK=y(()=>{Da();fP();yP();ZK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||an.has(r),{subprocessStdout:c,waitReadableDestroy:l}=aP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=pP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=cP(c,a),{read:g,onStdoutDataDone:b}=lP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new bke({read:g,...mP(u,t,d),destroy:vke(Ske.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return uP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),hP(u,_,c),_},Ske=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([dP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),gP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var _P,wke,WK=y(()=>{Da();ps();Sv();_P=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||an.has(e),s=jl(t,r),a=vv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return wke(a,s,t)},wke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var KK,JK=y(()=>{$v();fP();yP();VK();WK();KK=(t,{encoding:e})=>{let r=FK();t.readable=UK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=HK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=ZK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=_P.bind(void 0,t,e),t[Symbol.asyncIterator]=_P.bind(void 0,t,e,{})}});var YK,xke,$ke,XK=y(()=>{YK=(t,e)=>{for(let[r,n]of $ke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},xke=(async()=>{})().constructor.prototype,$ke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(xke,t)])});import{setMaxListeners as kke}from"node:events";import{spawn as Eke}from"node:child_process";var QK,Ake,Tke,Oke,Rke,Ike,eJ=y(()=>{Jb();ER();eI();ps();tI();NI();up();Qb();B3();W3();dp();iK();vb();lK();SK();rP();MK();JK();Nl();XK();QK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Ake(t,e,r),{subprocess:f,promise:p}=Oke({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=bv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),YK(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},Ake=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=pb(t,e,r),{file:a,commandArguments:c,options:l}=zb(t,e,r),u=Tke(l),d=V3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Tke=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},Oke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Eke(...Ub(t,e,r))}catch(m){return q3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;kke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];nK(c,a,l),cK(c,r,l);let d={},f=Di();c.kill=q9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=TK(c,r),KK(c,r),L3(c,r);let p=Rke({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Rke=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await jK({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>$o(x,e,w)),_=$o(h,e,"all"),S=Ike({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return zl(S,n,e)},Ike=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?lp({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ji,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Xb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Av,Pke,Cke,tJ=y(()=>{_o();wo();Av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,Pke(n,t[n],i)]));return{...t,...r}},Pke=(t,e,r)=>Cke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,Cke=new Set(["env",...SR])});var gs,Dke,Nke,rJ=y(()=>{_o();gR();nZ();P3();eJ();tJ();gs=(t,e,r,n)=>{let i=(s,a,c)=>gs(s,a,r,c),o=(...s)=>Dke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Dke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=Nke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?I3(a,c,l):QK(a,c,l,i)},Nke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=tZ(e)?rZ(e,r):[e,...r],[s,a,c]=eb(...o),l=Av(Av(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var nJ,iJ,oJ,jke,Mke,sJ=y(()=>{nJ=({file:t,commandArguments:e})=>oJ(t,e),iJ=({file:t,commandArguments:e})=>({...oJ(t,e),isSync:!0}),oJ=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=jke(t);return{file:r,commandArguments:n}},jke=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(Mke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},Mke=/ +/g});var aJ,cJ,Fke,lJ,Lke,uJ,dJ=y(()=>{aJ=(t,e,r)=>{t.sync=e(Fke,r),t.s=t.sync},cJ=({options:t})=>lJ(t),Fke=({options:t})=>({...lJ(t),isSync:!0}),lJ=t=>({options:{...Lke(t),...t}}),Lke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},uJ={preferLocal:!0}});var Eut,We,Aut,Tut,Out,Rut,Iut,Put,Cut,Dut,Lr=y(()=>{rJ();sJ();JR();dJ();NI();Eut=gs(()=>({})),We=gs(()=>({isSync:!0})),Aut=gs(nJ),Tut=gs(iJ),Out=gs(EV),Rut=gs(cJ,{},uJ,aJ),{sendMessage:Iut,getOneMessage:Put,getEachMessage:Cut,getCancelSignal:Dut}=z3()});import{existsSync as Tv,statSync as zke}from"node:fs";import{dirname as bP,extname as Uke,isAbsolute as fJ,join as vP,relative as SP,resolve as Ov,sep as qke}from"node:path";function Rv(t){return t==="./gradlew"||t==="gradle"}function Bke(t){return(Tv(vP(t,"build.gradle.kts"))||Tv(vP(t,"build.gradle")))&&Tv(vP(t,"gradle.properties"))}function Hke(t,e){let n=SP(t,e).split(qke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ys(t,e){return t===":"?`:${e}`:`${t}:${e}`}function Gke(t,e){let r=Ov(t,e),n=r;Tv(r)?zke(r).isFile()&&(n=bP(r)):Uke(r)!==""&&(n=bP(r));let i=SP(t,n);if(i.startsWith("..")||fJ(i))return null;let o=n;for(;;){if(Bke(o))return o;if(Ov(o)===Ov(t))return null;let s=bP(o);if(s===o)return null;let a=SP(t,s);if(a.startsWith("..")||fJ(a))return null;o=s}}function Iv(t,e){let r=Ov(t),n=new Map,i=[];for(let o of e){let s=Gke(r,o);if(!s){i.push(o);continue}let a=Hke(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Pv=y(()=>{"use strict"});import{existsSync as xP,readFileSync as Zke}from"node:fs";import{join as Hl}from"node:path";function Gl(t="."){let e=Hl(t,".cladding","config.yaml");if(!xP(e))return wP;try{let n=(0,pJ.parse)(Zke(e,"utf8"))?.gate;if(!n)return wP;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of Vke){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return wP}}function mJ(t="."){let e=Gl(t).testReport,r=e?[e,...$P]:$P;return[...new Set(r.map(n=>Hl(t,n)))]}function hJ(t="."){let e=Gl(t).testReport;if(e){let r=Hl(t,e);return xP(r)?r:null}return $P.map(r=>Hl(t,r)).find(r=>xP(r))??null}function gJ(t,e){let r=[],n=!1;for(let i of t){let o=Wke.exec(i);if(o){n=!0;for(let s of e)r.push(ys(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var pJ,Vke,wP,$P,Wke,_p=y(()=>{"use strict";pJ=St(er(),1);Pv();Vke=["type","lint","test","coverage"],wP={scope:"feature"},$P=["test-report.junit.xml",Hl("coverage","junit.xml"),Hl(".cladding","test-report.junit.xml")];Wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as EP,readFileSync as yJ,readdirSync as Kke,statSync as Jke}from"node:fs";import{join as Cv}from"node:path";function OP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Cv(t,e);if(EP(r))try{if(_J.test(yJ(r,"utf8")))return!0}catch{}}return!1}function bJ(t){try{return EP(t)&&_J.test(yJ(t,"utf8"))}catch{return!1}}function vJ(t,e=0){if(e>4||!EP(t))return!1;let r;try{r=Kke(t)}catch{return!1}for(let n of r){let i=Cv(t,n),o=!1;try{o=Jke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(vJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&bJ(i))return!0}return!1}function Qke(t){if(OP(t))return!0;for(let e of Yke)if(bJ(Cv(t,e)))return!0;for(let e of Xke)if(vJ(Cv(t,e)))return!0;return!1}function SJ(t="."){let e=Gl(t).coverage;return e||(Qke(t)?"kover":"jacoco")}function wJ(t="."){return AP[SJ(t)]}function xJ(t="."){return kP[SJ(t)]}var AP,kP,TP,_J,Yke,Xke,Dv=y(()=>{"use strict";_p();AP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},kP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},TP=[kP.kover,kP.jacoco],_J=/kover/i;Yke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Xke=["buildSrc","build-logic"]});import{existsSync as vp,readFileSync as IP,readdirSync as kJ,statSync as eEe}from"node:fs";import{dirname as tEe,join as xr,resolve as rEe}from"node:path";import Zl from"node:process";function PP(t){return vp(xr(t,"gradlew"))?"./gradlew":"gradle"}function nEe(t){let e=PP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[wJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function iEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(IP(xr(t,"pubspec.yaml"),"utf8"))}catch{}let r={cmd:"dart",args:["format","--output=none","--set-exit-if-changed","."]},n={cmd:"gitleaks",args:["detect","--no-banner"]};return e?{type:{cmd:"flutter",args:["analyze"]},lint:r,test:{cmd:"flutter",args:["test"]},coverage:{cmd:"flutter",args:["test","--coverage"]},secret:n}:{type:{cmd:"dart",args:["analyze"]},lint:r,test:{cmd:"dart",args:["test"]},coverage:{cmd:"dart",args:["test","--coverage=coverage"]},secret:n}}function sEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function lEe(t,e){for(let r of e)if(vp(xr(t,r)))return r}function uEe(t,e){try{return kJ(t).find(n=>n.endsWith(e))}catch{return}}function mEe(t){let e=[],r=Zl.platform==="win32";r||e.push(xr("/etc","madge","config"),xr("/etc","madgerc"));let n=r?Zl.env.USERPROFILE:Zl.env.HOME;n&&e.push(xr(n,".config","madge","config"),xr(n,".config","madge"),xr(n,".madge","config"),xr(n,".madgerc"));for(let o=rEe(t);;){e.push(xr(o,".madgerc"));let s=tEe(o);if(s===o)break;o=s}let i=Zl.env.MADGE_config??Zl.env.madge_config;return i&&e.push(i),e}function hEe(){for(let[t,e]of Object.entries(Zl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function EJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function yEe(t){try{return eEe(t).isFile()}catch{return!1}}function _Ee(t){let e;try{e=IP(t,"utf8")}catch{return!0}try{return EJ(JSON.parse(e).excludeRegExp)}catch{return gEe.test(e)}}function bEe(t,e){let r=e.madge;return r&&typeof r=="object"&&EJ(r.excludeRegExp)||hEe()?!0:mEe(t).some(n=>yEe(n)&&_Ee(n))}function vEe(t){try{return JSON.parse(IP(xr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function bp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function $J(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function SEe(t,e,r){if(bEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",pEe),{...e,args:n}}function wEe(t,e,r){if(bp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of dEe)if(n.configs.some(i=>vp(xr(t,i))))return n.gate;if(fEe.some(n=>vp(xr(t,n)))||r.eslintConfig!==void 0)return e}function $Ee(t,e){return xEe.some(r=>vp(xr(t,r)))?!0:e.jest!==void 0}function kEe(t){if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(t))return"vitest";if(/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(t))return"jest"}function RP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function EEe(t,e){let r=vEe(t),n=e.lint?wEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:SEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:RP(i,"lint"),s=bp(r,"test"),a=s?kEe(s):void 0;return s&&!a?(o=RP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...bp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&$Ee(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!bp(r,"coverage")&&!$J(r,"@vitest/coverage-v8")&&!$J(r,"@vitest/coverage-istanbul")?o=RP(o,"coverage"):a==="vitest"&&bp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function dt(t="."){for(let e of aEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=uEe(t,o):r=lEe(t,[o]),r)break;if(!r||e.requiresSource&&!sEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?EEe(t,n):n;return{language:e.language,manifest:r,gates:i}}return cEe}var Fi,oEe,aEe,cEe,dEe,fEe,pEe,gEe,xEe,cn=y(()=>{"use strict";Dv();Fi=["--offline","--no-install"];oEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);aEe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Fi,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Fi,"eslint","."]},test:{cmd:"npx",args:[...Fi,"vitest","run"]},coverage:{cmd:"npx",args:[...Fi,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Fi,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Fi,"madge","--circular","--extensions","ts,tsx,js,jsx","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:nEe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"swift",manifests:["Package.swift"],gates:{type:{cmd:"swift",args:["build"]},lint:{cmd:"swiftlint",args:["lint"]},test:{cmd:"swift",args:["test"]},coverage:{cmd:"swift",args:["test","--enable-code-coverage"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dart",manifests:["pubspec.yaml"],gates:iEe}],cEe={language:"unknown",manifest:"",gates:{}};dEe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Fi,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Fi,"oxlint"]}}],fEe=["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"],pEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";gEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;xEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as AEe,readFileSync as TEe}from"node:fs";import{join as OEe}from"node:path";function qa(t){return t.code==="ENOENT"}function Nv(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=[s,o].filter(c=>c.length>0).join(` +`).slice(0,2e3)||`exit ${i}`;return AJ.test(o)||AJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(qa(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,o=/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(i),a=n.find(l=>l!=="--"&&!l.startsWith("-"))?.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=r.exitCode===127&&a!==void 0&&new RegExp(`(?:^|[\\s:])${a}: (?:command )?not found\\b`,"i").test(i);return e==="npx"&&(o||c)?{stage:t,pass:!1,exitCode:2,stderr:"setup gap: 'npx' could not resolve the configured tool without installing it; the inferred tool is not installed or unavailable offline"}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=[String(e.stdout??"").trim(),String(e.stderr??"").trim()].filter(i=>i.length>0).join(` +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Vl(t,e){let r=OEe(t,"package.json");if(!AEe(r))return!1;try{return!!JSON.parse(TEe(r,"utf8")).scripts?.[e]}catch{return!1}}var AJ,Cn=y(()=>{"use strict";AJ=/config (is |file )?not found|no such file|ENOENT|ENOTCACHED|ENOTFOUND|EAI_AGAIN|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function REe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:jv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return qa(i)?[{detector:jv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Nv(i,jv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var jv,Ba,Mv=y(()=>{"use strict";Lr();cn();Cn();jv="ARCHITECTURE_VIOLATION";Ba={name:jv,subprocess:!0,run:REe}});function IEe(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Fv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=We(n.cmd,[...n.args],{cwd:e,reject:!1});return qa(i)?[{detector:Fv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Nv(i,Fv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Fv,Ha,Lv=y(()=>{"use strict";Lr();cn();Cn();Fv="HARDCODED_SECRET";Ha={name:Fv,subprocess:!0,run:IEe}});import{existsSync as CP,readdirSync as TJ}from"node:fs";import{join as zv}from"node:path";function CEe(t,e){let r=zv(t,e.path);if(!CP(r))return!0;if(e.isDirectory)try{return TJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function DEe(t){let{cwd:e="."}=t,r=[];for(let i of PEe)CEe(e,i)&&r.push({detector:Sp,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=zv(e,"spec.yaml");if(CP(n)){let i=MEe(n),o=i?null:NEe(e);if(i)r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:Sp,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=jEe(e);s&&r.push({detector:Sp,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function NEe(t){for(let e of["spec/features","spec/scenarios"]){let r=zv(t,e);if(!CP(r))continue;let n;try{n=TJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(zv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jEe(t){try{return q(t),null}catch(e){return e.message}}function MEe(t){let e;try{e=Ri(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Sp,PEe,OJ,RJ=y(()=>{"use strict";Ue();H_();Sp="ABSENCE_OF_GOVERNANCE",PEe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];OJ={name:Sp,run:DEe}});function Uv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function DP(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=Uv(r)==="while",o=LEe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${Uv(r)}'`}let n=FEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Uv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Uv(r)}'`:null}function zEe(t,e){let r=DP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function IJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zEe(r,n));return e}var FEe,LEe,NP=y(()=>{"use strict";FEe={event:"when",state:"while",optional:"where",unwanted:"if"},LEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=q(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Ue()});function UEe(t){let{cwd:e="."}=t;return ge(e,qv,qEe)}function qEe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:qv,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of IJ(t.features))e.push({detector:qv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var qv,PJ,CJ=y(()=>{"use strict";NP();wt();qv="AC_DRIFT";PJ={name:qv,run:UEe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return NJ[n]??DJ}var BEe,HEe,GEe,DJ,ZEe,VEe,NJ,WEe,jJ,Ga=y(()=>{"use strict";cn();BEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,HEe=/^[ \t]*import\s+([\w.]+)/gm,GEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,DJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:BEe,importStyle:"relative"},ZEe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:HEe,importStyle:"dotted"},VEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:GEe,importStyle:"dotted"},NJ={typescript:DJ,kotlin:ZEe,python:VEe},WEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],jJ=new Set([...Object.values(NJ).flatMap(t=>t?.extensions??[]),...WEe].map(t=>t.toLowerCase()))});import{existsSync as KEe,readFileSync as JEe,readdirSync as YEe,statSync as XEe}from"node:fs";import{join as FJ,relative as MJ}from"node:path";function QEe(t,e){if(!KEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=YEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=FJ(i,s),c;try{c=XEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rAe(t){return tAe.test(t)}function nAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Li(e,r.project?.language),o=i.sourceRoots.flatMap(a=>QEe(FJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=JEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Ga();LJ="AI_HINTS_FORBIDDEN_PATTERN";tAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;zJ={name:LJ,run:nAe}});function iAe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:qJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var qJ,BJ,HJ=y(()=>{"use strict";Ue();qJ="AC_DUPLICATE_WITHIN_FEATURE";BJ={name:qJ,run:iAe}});import{createRequire as oAe}from"module";import{basename as sAe,dirname as MP,normalize as aAe,relative as cAe,resolve as lAe,sep as VJ}from"path";import*as uAe from"fs";function dAe(t){let e=aAe(t);return e.length>1&&e[e.length-1]===VJ&&(e=e.substring(0,e.length-1)),e}function WJ(t,e){return t.replace(fAe,e)}function mAe(t){return t==="/"||pAe.test(t)}function jP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lAe(t)),(n||o)&&(t=dAe(t)),t===".")return"";let s=t[t.length-1]!==i;return WJ(s?t+i:t,i)}function KJ(t,e){return e+t}function hAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:WJ(cAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gAe(t){return t}function yAe(t,e,r){return e+t+r}function _Ae(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hAe(t,e):n?KJ:gAe}function bAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ae(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vAe(t):bAe(t):n&&n.length?wAe:SAe:xAe}function RAe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OAe:r&&r.length?n?kAe:EAe:n?AAe:TAe}function CAe(t){return t.group?PAe:IAe}function jAe(t){return t.group?DAe:NAe}function LAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FAe:MAe}function JJ(t,e,r){if(r.options.useRealPaths)return zAe(e,r);let n=MP(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=MP(n)}return r.symlinks.set(t,e),i>1}function zAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Bv(t,e,r,n){e(t&&!n?t:null,r)}function KAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UAe:GAe:n?e?qAe:WAe:i?e?HAe:VAe:e?BAe:ZAe}function XAe(t){return t?YAe:JAe}function rTe(t,e){return new Promise((r,n)=>{QJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function QJ(t,e,r){new XJ(t,e,r).start()}function nTe(t,e){return new XJ(t,e).start()}var GJ,fAe,pAe,SAe,wAe,xAe,kAe,EAe,AAe,TAe,OAe,IAe,PAe,DAe,NAe,MAe,FAe,UAe,qAe,BAe,HAe,GAe,ZAe,VAe,WAe,YJ,JAe,YAe,QAe,eTe,tTe,XJ,ZJ,e8,t8,r8=y(()=>{GJ=oAe(import.meta.url);fAe=/[\\/]/g;pAe=/^[a-z]:[\\/]$/i;SAe=(t,e)=>{e.push(t||".")},wAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xAe=()=>{};kAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AAe=(t,e,r,n)=>{r.files++},TAe=(t,e)=>{e.push(t)},OAe=()=>{};IAe=t=>t,PAe=()=>[""].slice(0,0);DAe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NAe=()=>{};MAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&JJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FAe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&JJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UAe=t=>t.counts,qAe=t=>t.groups,BAe=t=>t.paths,HAe=t=>t.paths.slice(0,t.options.maxFiles),GAe=(t,e,r)=>(Bv(e,r,t.counts,t.options.suppressErrors),null),ZAe=(t,e,r)=>(Bv(e,r,t.paths,t.options.suppressErrors),null),VAe=(t,e,r)=>(Bv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WAe=(t,e,r)=>(Bv(e,r,t.groups,t.options.suppressErrors),null);YJ={withFileTypes:!0},JAe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",YJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YAe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",YJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QAe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},eTe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},tTe=class{aborted=!1;abort(){this.aborted=!0}},XJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KAe(e,this.isSynchronous),this.root=jP(t,e),this.state={root:mAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eTe,options:e,queue:new QAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tTe,fs:e.fs||uAe},this.joinPath=_Ae(this.root,e),this.pushDirectory=$Ae(this.root,e),this.pushFile=RAe(e),this.getArray=CAe(e),this.groupFiles=jAe(e),this.resolveSymlink=LAe(e,this.isSynchronous),this.walkDirectory=XAe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=jP(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=sAe(_),x=jP(MP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};ZJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rTe(this.root,this.options)}withCallback(t){QJ(this.root,this.options,t)}sync(){return nTe(this.root,this.options)}},e8=null;try{GJ.resolve("picomatch"),e8=GJ("picomatch")}catch{}t8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:VJ,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new ZJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new ZJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||e8;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var wp=v((Fdt,a8)=>{"use strict";var n8="[^\\\\/]",iTe="(?=.)",i8="[^/]",FP="(?:\\/|$)",o8="(?:^|\\/)",LP=`\\.{1,2}${FP}`,oTe="(?!\\.)",sTe=`(?!${o8}${LP})`,aTe=`(?!\\.{0,1}${FP})`,cTe=`(?!${LP})`,lTe="[^.\\/]",uTe=`${i8}*?`,dTe="/",s8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iTe,QMARK:i8,END_ANCHOR:FP,DOTS_SLASH:LP,NO_DOT:oTe,NO_DOTS:sTe,NO_DOT_SLASH:aTe,NO_DOTS_SLASH:cTe,QMARK_NO_DOT:lTe,STAR:uTe,START_ANCHOR:o8,SEP:dTe},fTe={...s8,SLASH_LITERAL:"[\\\\/]",QMARK:n8,STAR:`${n8}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},pTe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};a8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pTe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?fTe:s8}}});var xp=v(zr=>{"use strict";var{REGEX_BACKSLASH:mTe,REGEX_REMOVE_BACKSLASH:hTe,REGEX_SPECIAL_CHARS:gTe,REGEX_SPECIAL_CHARS_GLOBAL:yTe}=wp();zr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);zr.hasRegexChars=t=>gTe.test(t);zr.isRegexChar=t=>t.length===1&&zr.hasRegexChars(t);zr.escapeRegex=t=>t.replace(yTe,"\\$1");zr.toPosixSlashes=t=>t.replace(mTe,"/");zr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};zr.removeBackslashes=t=>t.replace(hTe,e=>e==="\\"?"":e);zr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?zr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};zr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};zr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};zr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var h8=v((zdt,m8)=>{"use strict";var c8=xp(),{CHAR_ASTERISK:zP,CHAR_AT:_Te,CHAR_BACKWARD_SLASH:$p,CHAR_COMMA:bTe,CHAR_DOT:UP,CHAR_EXCLAMATION_MARK:qP,CHAR_FORWARD_SLASH:p8,CHAR_LEFT_CURLY_BRACE:BP,CHAR_LEFT_PARENTHESES:HP,CHAR_LEFT_SQUARE_BRACKET:vTe,CHAR_PLUS:STe,CHAR_QUESTION_MARK:l8,CHAR_RIGHT_CURLY_BRACE:wTe,CHAR_RIGHT_PARENTHESES:u8,CHAR_RIGHT_SQUARE_BRACKET:xTe}=wp(),d8=t=>t===p8||t===$p,f8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Te=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,re=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&d8(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=c8.removeBackslashes(P)),xe&&_===!0&&(xe=c8.removeBackslashes(xe)));let Cr={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Cr.maxDepth=0,d8(A)||s.push(D),Cr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var kp=wp(),ln=xp(),{MAX_LENGTH:Hv,POSIX_REGEX_SOURCE:kTe,REGEX_NON_SPECIAL_CHARS:ETe,REGEX_SPECIAL_CHARS_BACKREF:ATe,REPLACEMENTS:g8}=kp,TTe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>ln.escapeRegex(i)).join("..")}return r},Wl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,y8=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},OTe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},_8=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OTe(e))return e.replace(/\\(.)/g,"$1")},RTe=t=>{let e=t.map(_8).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},ITe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=_8(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?ln.escapeRegex(r[0]):`[${r.map(i=>ln.escapeRegex(i)).join("")}]`}*`},PTe=t=>{let e=0,r=t.trim(),n=GP(r);for(;n;)e++,r=n.body.trim(),n=GP(r);return e},CTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kp.DEFAULT_MAX_EXTGLOB_RECURSION,n=y8(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RTe(n)))return{risky:!0};for(let i of n){let o=ITe(i);if(o)return{risky:!0,safeOutput:o};if(PTe(i)>r)return{risky:!0}}return{risky:!1}},ZP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=g8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=kp.globChars(r.windows),l=kp.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,O=G=>`(${a}(?:(?!${w}${G.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ln.removePrefix(t,$),i=t.length;let re=[],K=[],xe=[],C=o,P,Cr=()=>$.index===i-1,se=$.peek=(G=1)=>t[$.index+G],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(G="",ht=0)=>{$.consumed+=G,$.index+=ht},Xt=G=>{$.output+=G.output!=null?G.output:G.value,dr(G.value)},uo=()=>{let G=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,G++;return G%2===0?!1:($.negated=!0,$.start++,!0)},ki=G=>{$[G]++,xe.push(G)},en=G=>{$[G]--,xe.pop()},de=G=>{if(C.type==="globstar"){let ht=$.braces>0&&(G.type==="comma"||G.type==="brace"),H=G.extglob===!0||re.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!ht&&!H&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(re.length&&G.type!=="paren"&&(re[re.length-1].inner+=G.value),(G.value||G.output)&&Xt(G),C&&C.type==="text"&&G.type==="text"){C.output=(C.output||C.value)+G.value,C.value+=G.value;return}G.prev=C,s.push(G),C=G},fo=(G,ht)=>{let H={...l[ht],conditions:1,inner:""};H.prev=C,H.parens=$.parens,H.output=$.output,H.startIndex=$.index,H.tokensIndex=s.length;let Oe=(r.capture?"(":"")+H.open;ki("parens"),de({type:G,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),re.push(H)},Jde=G=>{let ht=t.slice(G.startIndex,$.index+1),H=t.slice(G.startIndex+2,$.index),Oe=CTe(H,r);if((G.type==="plus"||G.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(G.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,Ei=s[G.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=lt||ln.escapeRegex(ht);for(let Ai=G.tokensIndex+1;Ai1&&G.inner.includes("/")&&(lt=O(r)),(lt!==D||Cr()||/^\)+$/.test(Kt()))&&(ut=G.close=`)$))${lt}`),G.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=ZP(zt,{...e,fastpaths:!1}).output;ut=G.close=`)${Ei})${lt})`}G.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),en("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,ht=t.replace(ATe,(H,Oe,ut,zt,lt,Ei)=>zt==="\\"?(G=!0,H):zt==="?"?Oe?Oe+zt+(lt?_.repeat(lt.length):""):Ei===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):zt==="."?u.repeat(ut.length):zt==="*"?Oe?Oe+zt+(lt?D:""):D:Oe?H:`\\${H}`);return G===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=ln.wrapOutput(ht,$,e),$)}for(;!Cr();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let H=se();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let H=C.value.slice(1);if(H.includes("[")&&(C.posix=!0,H.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),zt=C.value.slice(Oe+2),lt=kTe[zt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Xt({value:P});continue}if($.quotes===1&&P!=='"'){P=ln.escapeRegex(P),C.value+=P,Xt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){ki("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Wl("opening","("));let H=re[re.length-1];if(H&&$.parens===H.parens+1){Jde(re.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),en("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));P=`\\${P}`}else ki("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Wl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}en("brackets");let H=C.value.slice(1);if(C.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(P=`/${P}`),C.value+=P,Xt({value:P}),r.literalBrackets===!1||ln.hasRegexChars(H))continue;let Oe=ln.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){ki("braces");let H={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(H),de(H);continue}if(P==="}"){let H=K[K.length-1];if(r.nobrace===!0||!H){de({type:"text",value:P,output:P});continue}let Oe=")";if(H.dots===!0){let ut=s.slice(),zt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&zt.unshift(ut[lt].value);Oe=TTe(zt,r),$.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let ut=$.output.slice(0,H.outputIndex),zt=$.tokens.slice(H.tokensIndex);H.value=H.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of zt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),en("braces"),K.pop();continue}if(P==="|"){re.length>0&&re[re.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let H=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,H="|"),de({type:"comma",value:P,output:H});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let H=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,H.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){fo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){uo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let H=ETe.exec(Kt());H&&(P+=H[0],$.index+=H[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let G=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(G)){fo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let H=C.prev,Oe=H.prev,ut=H.type==="slash"||H.type==="bos",zt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||G[0]&&G[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(H.type==="comma"||H.type==="brace"),Ei=re.length&&(H.type==="pipe"||H.type==="paren");if(!ut&&H.type!=="paren"&&!lt&&!Ei){de({type:"star",value:P,output:""});continue}for(;G.slice(0,3)==="/**";){let Ai=t[$.index+4];if(Ai&&Ai!=="/")break;G=G.slice(3),dr("/**",3)}if(H.type==="bos"&&Cr()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!zt&&Cr()){$.output=$.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=H.output+C.output,dr(P);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&G[0]==="/"){let Ai=G[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(H.output+C.output).length),H.output=`(?:${H.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${Ai})`,C.value+=P,$.output+=H.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&G[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","]"));$.output=ln.escapeLast($.output,"["),en("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing",")"));$.output=ln.escapeLast($.output,"("),en("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Wl("closing","}"));$.output=ln.escapeLast($.output,"{"),en("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let G of $.tokens)$.output+=G.output!=null?G.output:G.value,G.suffix&&($.output+=G.suffix)}return $};ZP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Hv,r.maxLength):Hv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=g8[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=kp.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=ln.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};b8.exports=ZP});var x8=v((qdt,w8)=>{"use strict";var DTe=h8(),VP=v8(),S8=xp(),NTe=wp(),jTe=t=>t&&typeof t=="object"&&!Array.isArray(t),Rt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Rt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jTe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?Rt.compileRe(t,e):Rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Rt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Rt.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};Rt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?S8.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Rt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Rt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(S8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):VP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>DTe(t,e);Rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Rt.toRegex(a,e);return n===!0&&(c.state=t),c};Rt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=VP.fastpaths(t,e)),i.output||(i=VP(t,e)),Rt.compileRe(i,e,r,n)};Rt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Rt.constants=NTe;w8.exports=Rt});var A8=v((Bdt,E8)=>{"use strict";var $8=x8(),MTe=xp();function k8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MTe.isWindows()}),$8(t,e,r)}Object.assign(k8,$8);E8.exports=k8});import{readdir as FTe,readdirSync as LTe,realpath as zTe,realpathSync as UTe,stat as qTe,statSync as BTe}from"fs";import{isAbsolute as HTe,posix as Za,resolve as GTe}from"path";import{fileURLToPath as ZTe}from"url";function KTe(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&WTe.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>Za.relative(t,n)||".":n=>Za.relative(t,`${e}/${n}`)||"."}function XTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Za.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function I8(t){var e;let r=Kl.default.scan(t,QTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Kl.default.scan(t);return r.isGlob||r.negated}function Ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function P8(t){return typeof t=="string"?[t]:t??[]}function WP(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=iOe(o);s=HTe(s.replace(aOe,""))?Za.relative(a,s):Za.normalize(s);let c=(i=sOe.exec(s))===null||i===void 0?void 0:i[0],l=I8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?Za.join(o,...d):o}return s}function cOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(WP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(WP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(WP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cOe(t,e,n);t.debug&&Ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(O8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Kl.default)(i.match,f),m=(0,Kl.default)(i.ignore,f),h=KTe(i.match,f),g=T8(r,d,o),b=o?g:T8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new t8({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&Ep(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return Ep(`${T?"skipped":"crawling"} ${O}`),T}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XTe(r,d)]}function uOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fOe(t){let e={...dOe,...t};return e.cwd=(e.cwd instanceof URL?ZTe(e.cwd):GTe(e.cwd)).replace(O8,"/"),e.ignore=P8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FTe,readdirSync:e.fs.readdirSync||LTe,realpath:e.fs.realpath||zTe,realpathSync:e.fs.realpathSync||UTe,stat:e.fs.stat||qTe,statSync:e.fs.statSync||BTe}),e.debug&&Ep("globbing with options:",e),e}function pOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VTe(t)||typeof t=="string",i=P8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fOe(n?e:t);return i.length>0?lOe(o,i):[]}function _s(t,e){let[r,n]=pOe(t,e);return r?uOe(r.sync(),n):[]}var Kl,VTe,O8,R8,WTe,JTe,YTe,QTe,eOe,tOe,rOe,nOe,iOe,sOe,aOe,dOe,Ap=y(()=>{r8();Kl=St(A8(),1),VTe=Array.isArray,O8=/\\/g,R8=process.platform==="win32",WTe=/^(\/?\.\.)+$/;JTe=/^[A-Z]:\/$/i,YTe=R8?t=>JTe.test(t):t=>t==="/";QTe={parts:!0};eOe=/(?t.replace(eOe,"\\$&"),nOe=t=>t.replace(tOe,"\\$&"),iOe=R8?nOe:rOe;sOe=/^(\/?\.\.)+/,aOe=/\\(?=[()[\]{}!*+?@|])/g;dOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Tp,readFileSync as mOe,readdirSync as hOe,statSync as C8}from"node:fs";import{join as Va}from"node:path";function gOe(t){let{cwd:e="."}=t,r,n;try{let c=q(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Li(e,n),o=[],{layers:s,forbiddenImports:a}=KP(r);return(s.size>0||a.length>0)&&!Tp(Va(e,i.mainRoot))?[{detector:Op,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(s.size>0&&(yOe(e,i,s,o),_Oe(e,i,s,o)),a.length>0&&bOe(e,i,a,o),o)}function KP(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function yOe(t,e,r,n){let i=e.mainRoot,o=Va(t,i);if(Tp(o))for(let s of hOe(o)){let a=Va(o,s);C8(a).isDirectory()&&(r.has(s)||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Oe(t,e,r,n){let i=e.mainRoot,o=Va(t,i);if(Tp(o))for(let s of r){let a=Va(o,s);Tp(a)&&C8(a).isDirectory()||n.push({detector:Op,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function bOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Va(t,i,s.from);if(!Tp(a))continue;let c=_s([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Va(a,l),d;try{d=mOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vOe(p,s.to,e.importStyle)&&n.push({detector:Op,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function vOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Op,D8,JP=y(()=>{"use strict";Ap();Ue();Ga();Op="ARCHITECTURE_FROM_SPEC";D8={name:Op,run:gOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function kOe(t){let{cwd:e="."}=t,r=xOe(e,"spec/capabilities.yaml");if(!SOe(r))return[];let n;try{let u=wOe(r,"utf8"),d=N8.default.parse(u);if(!d||typeof d!="object")return[];n=d}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o,s=!1;try{let u=q(e);o=new Set(u.features.map(d=>d.id)),s=u.project.onboarding_seeded===!0}catch{return[]}let a=[],c=new Set,l=s&&o.size<$Oe;for(let u of i){if(typeof u!="object"||u===null)continue;let d=String(u.id??"(unnamed)"),f=Array.isArray(u.features)?u.features:[];if(f.length===0){a.push({detector:Gv,severity:l?"info":"warn",path:"spec/capabilities.yaml",message:l?`capability "${d}" has no features mapped yet \u2014 retained as future onboarding intent; bind it when a matching feature lands`:`capability "${d}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let p of f){let m=String(p);o.has(m)?c.add(m):a.push({detector:Gv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${d}" references feature ${m} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let u of o)c.has(u)||a.push({detector:Gv,severity:"info",path:"spec.yaml",message:`feature ${u} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return a}var N8,Gv,$Oe,j8,M8=y(()=>{"use strict";N8=St(er(),1);Ue();Gv="CAPABILITIES_FEATURE_MAPPING",$Oe=8;j8={name:Gv,run:kOe}});import{existsSync as EOe,readFileSync as AOe}from"node:fs";import{join as TOe}from"node:path";function OOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function ROe(t){let{cwd:e="."}=t;return ge(e,YP,r=>IOe(r,e))}function IOe(t,e){let r=Li(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=TOe(e,o);if(!EOe(s))continue;let a=AOe(s,"utf8");OOe(a)||n.push({detector:YP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var YP,F8,L8=y(()=>{"use strict";Ga();wt();YP="CONVENTION_DRIFT";F8={name:YP,run:ROe}});import{existsSync as XP,readFileSync as z8}from"node:fs";import{join as Zv}from"node:path";function POe(t){return JSON.parse(t).total?.lines?.pct??0}function U8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function NOe(t,e){if(!Rv(dt(t).gates.coverage?.cmd))return null;let r;try{r=Iv(t,e)}catch(c){return[{detector:ko,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=TP.find(d=>XP(Zv(c.dir,d)));if(!l){s.push(c.path);continue}let u=U8(z8(Zv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ko,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=q8(n,i);return a0?[{detector:ko,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function jOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=NOe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=dt(e).language==="kotlin"?TP.find(a=>XP(Zv(e,a)))??xJ(e):n.coverageSummary,o=Zv(e,i);if(!XP(o))return[{detector:ko,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=z8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?COe(a):n.coverageFormat==="cobertura-xml"?DOe(a):POe(a)}catch(a){return[{detector:ko,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ko,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Vv?[]:[{detector:ko,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Vv}%`}]}var ko,Vv,B8,H8=y(()=>{"use strict";Ue();Dv();Ga();Pv();cn();ko="COVERAGE_DROP",Vv=70;B8={name:ko,run:jOe}});import{existsSync as MOe}from"node:fs";import{join as FOe}from"node:path";function zOe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>UOe(r,e))}function UOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);if(!r){if(n.length===0)return[];let i=t.project.onboarding_seeded===!0&&t.features.length{"use strict";wt();Wv="DELIVERABLE_INTEGRITY",LOe=8;G8={name:Wv,run:zOe}});function qOe(t){let e=new Set((t.features??[]).map(n=>n.id)),r=[];for(let n of t.project?.smoke??[]){let i=n.feature;if(i===void 0||e.has(i))continue;let o=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:Kv,severity:"warn",path:"spec.yaml",message:`smoke probe '${o}' binds feature ${i}, which is not in the spec \u2014 a dangling binding is annotation drift (the bound feature was renamed, archived, or never existed). Fix the id or drop the binding.`})}return r}function BOe(t){let e=qOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Kv,severity:"warn",path:"spec.yaml",message:`${r.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function HOe(t){let{cwd:e="."}=t;return ge(e,Kv,r=>BOe(r))}var Kv,V8,W8=y(()=>{"use strict";wt();Kv="SMOKE_PROBE_DEMAND";V8={name:Kv,run:HOe}});function GOe(t){let{cwd:e="."}=t;return ge(e,Jv,r=>ZOe(r,e))}function ZOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ls(e);if(n===null)return[{detector:Jv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=J_(n,e,o);s.state!=="fresh"&&i.push({detector:Jv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Jv,Yv,QP=y(()=>{"use strict";xl();wt();Jv="STALE_ATTESTATION";Yv={name:Jv,run:GOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return WOe(r)}function WOe(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:K8,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var K8,Xv,eC=y(()=>{"use strict";Ue();K8="DEPENDENCY_CYCLE";Xv={name:K8,run:VOe}});import{appendFileSync as KOe,existsSync as J8,mkdirSync as JOe,readFileSync as YOe}from"node:fs";import{dirname as XOe,join as QOe}from"node:path";function Y8(t){return QOe(t,eRe,tRe)}function X8(t){return tC.add(t),()=>tC.delete(t)}function Wa(t,e){let r=Y8(t),n=XOe(r);J8(n)||JOe(n,{recursive:!0}),KOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of tC)try{i(t,e)}catch{}}function fr(t){let e=Y8(t);if(!J8(e))return[];let r=YOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var eRe,tRe,tC,un=y(()=>{"use strict";eRe=".cladding",tRe="audit.log.jsonl";tC=new Set});import{existsSync as rRe}from"node:fs";import{join as nRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:rC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(rRe(nRe(e,i.artifact))||n.push({detector:rC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var rC,Q8,e5=y(()=>{"use strict";un();rC="EVIDENCE_MISMATCH";Q8={name:rC,run:iRe}});import{existsSync as oRe,readFileSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let e=aRe(t,i5);if(!oRe(e))return null;try{let n=((0,n5.parse)(sRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*r5(t,e){for(let r of t??[])r.startsWith(t5)&&(yield{ref:r,name:r.slice(t5.length),field:e})}function lRe(t){let{cwd:e="."}=t,r=cRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:nC,severity:"info",message:`spec.yaml not loaded: ${o.message}`}]}let i=[];for(let o of n.features)for(let s of o.acceptance_criteria??[]){let a=[...r5(s.evidence_refs,"evidence_refs"),...r5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:nC,severity:"warn",path:i5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var n5,nC,t5,i5,o5,s5=y(()=>{"use strict";n5=St(er(),1);Ue();nC="FIXTURE_REFERENCE_INVALID",t5="fixture:",i5="conformance/fixtures.yaml";o5={name:nC,run:lRe}});import{existsSync as Jl,readFileSync as iC}from"node:fs";import{join as Ka}from"node:path";function uRe(t){return _s(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Rp(t){if(!Jl(t))return null;try{return JSON.parse(iC(t,"utf8"))}catch{return null}}function dRe(t,e){let r=Ka(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(iC(r,"utf8"))}catch(c){e.push({detector:Eo,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let o=i.match(/^(\d+)\/(\d+)$/);if(!o){e.push({detector:Eo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=uRe(t);s!==a&&e.push({detector:Eo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function fRe(t,e){for(let r of a5){let n=Ka(t,r.path);if(!Jl(n))continue;let i=Rp(n);if(!i){e.push({detector:Eo,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let o of r.required)(i[o]===void 0||i[o]===null||i[o]==="")&&e.push({detector:Eo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function pRe(t,e){let r=Rp(Ka(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of a5){let s=Ka(t,o.path);if(!Jl(s))continue;let a=Rp(s);a?.version&&a.version!==n&&e.push({detector:Eo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ka(t,".claude-plugin","marketplace.json");if(Jl(i)){let o=Rp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Eo,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${s.name??"?"}' version='${s.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function mRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function hRe(t,e){let r=Ka(t,"src","cli","clad.ts"),n=Ka(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Jl(r)||!Jl(n))return;let i=mRe(iC(r,"utf8"));if(i.length===0)return;let s=Rp(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(s))return;let a=new Set(i),c=new Set(s),l=i.filter(f=>!c.has(f)),u=s.filter(f=>!a.has(f));if(l.length===0&&u.length===0)return;let d=[l.length?`missing [${l.join(", ")}]`:"",u.length?`unexpected [${u.join(", ")}]`:""].filter(Boolean).join("; ");e.push({detector:Eo,severity:"error",message:`plugins/claude-code/.claude-plugin/plugin.json stages-implemented disagrees with TIER_STAGES.all (src/cli/clad.ts): ${d} \u2014 run \`npm run build:plugin\` to re-derive`})}function gRe(t){let{cwd:e="."}=t,r=[];return dRe(e,r),hRe(e,r),fRe(e,r),pRe(e,r),r}var Eo,a5,c5,l5=y(()=>{"use strict";Ap();Eo="HARNESS_INTEGRITY",a5=[{host:"claude-code",path:"plugins/claude-code/.claude-plugin/plugin.json",required:["name","version"]},{host:"codex",path:"plugins/codex/.codex-plugin/plugin.json",required:["name","version","description"]},{host:"gemini-cli",path:"plugins/gemini-cli/gemini-extension.json",required:["name","version"]}];c5={name:Eo,run:gRe}});import{existsSync as yRe,readFileSync as _Re}from"node:fs";import{join as bRe}from"node:path";function SRe(t){let{cwd:e="."}=t;return ge(e,Qv,r=>xRe(r,e))}function wRe(t){let e=bRe(t,"spec/capabilities.yaml");if(!yRe(e))return!1;try{let r=u5.default.parse(_Re(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function xRe(t,e){let r=t.features.length;if(r{"use strict";u5=St(er(),1);wt();Qv="HOLLOW_GOVERNANCE",vRe=8;d5={name:Qv,run:SRe}});import{existsSync as p5,readFileSync as m5}from"node:fs";import{join as h5}from"node:path";function g5(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&(i[o]=s);return i}catch{return null}}function ERe(t){switch(t){case"fail":case"wiring-fail":return 0;case"wiring-ok":case"wiring-only":return 1;case"verified":return 2;default:return null}}function ARe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function TRe(t){let e=h5(t,"README.md"),r=h5(t,"docs","dogfood","matrix.md");if(!p5(e)||!p5(r))return[];let n=g5(m5(e,"utf8"),$Re),i=g5(m5(r,"utf8"),kRe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=ARe(a);if(c===null)continue;let l=i[s]??"not-run",u=ERe(l);u!==null&&c>u&&o.push({detector:y5,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ORe(t){let{cwd:e="."}=t;return TRe(e)}var y5,$Re,kRe,_5,b5=y(()=>{"use strict";y5="HOST_CLAIM_DRIFT",$Re=//,kRe=//;_5={name:y5,run:ORe}});function RRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return v5(r.features.map(i=>i.id),"feature","spec/features/",n),v5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function v5(t,e,r,n){let i=new Map;for(let o of t)i.set(o,(i.get(o)??0)+1);for(let[o,s]of i)s>1&&n.push({detector:S5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var S5,w5,x5=y(()=>{"use strict";Ue();S5="ID_COLLISION";w5={name:S5,run:RRe}});import{existsSync as Ip,readFileSync as oC,readdirSync as sC,statSync as IRe,writeFileSync as k5}from"node:fs";import{join as Ao}from"node:path";function $5(t){if(!Ip(t))return 0;try{return sC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function PRe(t){if(!Ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=sC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Ao(n,o),a;try{a=IRe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function CRe(t){let e=Ao(t,"spec","capabilities.yaml");if(!Ip(e))return 0;try{let r=eS.default.parse(oC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function bs(t="."){let e=$5(Ao(t,"spec","features")),r=$5(Ao(t,"spec","scenarios")),n=CRe(t),i=PRe(Ao(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Yl(t,e){let r=Ao(t,"spec.yaml");if(!Ip(r))return;let n=oC(r,"utf8"),i=DRe(n,e);i!==n&&k5(r,i)}function DRe(t,e){let r=t.includes(`\r `)?`\r `:` `,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),o=["# Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand.","inventory:",` features: ${e.features??0}`,` scenarios: ${e.scenarios??0}`,` capabilities: ${e.capabilities??0}`,` test_files: ${e.test_files??0}`],s=d=>r===`\r @@ -271,51 +273,51 @@ ${o.join(` `)}let a=i;a>0&&/Auto-maintained by `clad sync`/.test(n[a-1])&&(a-=1);let c=i+1;for(;ci+1);)c++;let l=n.slice(0,a),u=n.slice(c);for(;l.length>0&&l[l.length-1].trim()==="";)l.pop();return l.push(""),s([...l,...o,"",...u.filter((d,f)=>!(f===0&&d.trim()===""))].join(` `).replace(/\n{3,}/g,` -`))}function Ka(t="."){let e=Ao(t,"spec","features");if(!Ip(e))return!1;let r=[];for(let i of sC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,eS.parse)(oC(Ao(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` +`))}function Ja(t="."){let e=Ao(t,"spec","features");if(!Ip(e))return!1;let r=[];for(let i of sC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,eS.parse)(oC(Ao(e,i),"utf8"));if(!o?.id)continue;let s=o.slug??i.replace(/\.(ya?ml)$/,"");r.push(` ${o.id}: {slug: ${s}, status: ${o.status??"planned"}, modules: ${(o.modules??[]).length}}`)}catch{continue}r.sort();let n="# Cladding \xB7 Tier C \u2014 generated feature index (`clad sync`). Do not edit by hand.\n# One line per feature \u2192 1-file lookup + line-independent merges\n# (suggested .gitattributes: `spec/index.yaml merge=union`).\nfeatures:\n"+r.join(` `)+` -`;return $5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var eS,Pp=y(()=>{"use strict";eS=St(er(),1)});import{existsSync as k5,readFileSync as E5,readdirSync as NRe}from"node:fs";import{join as aC}from"node:path";function jRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=A5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cC(e),{detector:Cp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of A5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Cp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...cC(e)),o}function cC(t){let e=aC(t,"spec","index.yaml"),r=aC(t,"spec","features");if(!k5(e)||!k5(r))return[];let n=new Map;try{for(let l of E5(e,"utf8").split(` -`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of NRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=E5(aC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Cp,A5,T5,O5=y(()=>{"use strict";Pp();Ue();Cp="INVENTORY_DRIFT",A5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];T5={name:Cp,run:jRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function URe(t){let{cwd:e="."}=t,r=LRe(e,"src","spec","schema.json"),n=[];if(MRe(r)){let i;try{i=JSON.parse(FRe(r,"utf8"))}catch(o){n.push({detector:Dp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of zRe)i.required?.includes(o)||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==R5&&n.push({detector:Dp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${R5}'`})}catch{}return n}var Dp,zRe,R5,I5,P5=y(()=>{"use strict";Ue();Dp="META_INTEGRITY",zRe=["schema","project","features"],R5="0.1";I5={name:Dp,run:URe}});function qRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return C5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),C5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function C5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:D5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var D5,N5,j5=y(()=>{"use strict";Ue();D5="SLUG_CONFLICT";N5={name:D5,run:qRe}});function Xl(t){return t==="planned"||t==="in_progress"}var tS=y(()=>{"use strict"});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function GRe(t){let{cwd:e="."}=t;return ge(e,rS,r=>ZRe(r,e))}function ZRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=HRe(e,i);BRe(o)||r.push(VRe(n.id,i,n.status))}return r}function VRe(t,e,r){return Xl(r)?{detector:rS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:rS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var rS,nS,lC=y(()=>{"use strict";tS();wt();rS="MISSING_IMPLEMENTATION";nS={name:rS,run:GRe}});function WRe(t){let{cwd:e="."}=t;return ge(e,uC,KRe)}function KRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:uC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var uC,iS,dC=y(()=>{"use strict";wt();uC="MISSING_TESTS";iS={name:uC,run:WRe}});import{existsSync as JRe,readFileSync as YRe}from"node:fs";import{join as M5}from"node:path";function F5(t){if(JRe(t))try{return JSON.parse(YRe(t,"utf8"))}catch{return}}function tIe(t){let{cwd:e="."}=t,r=F5(M5(e,XRe)),n=F5(M5(e,QRe));if(!r||!n)return[{detector:fC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>eIe&&i.push({detector:fC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var fC,XRe,QRe,eIe,L5,z5=y(()=>{"use strict";fC="PERFORMANCE_DRIFT",XRe="perf/baseline.json",QRe="perf/current.json",eIe=10;L5={name:fC,run:tIe}});import{existsSync as rIe}from"node:fs";import{join as nIe}from"node:path";function oIe(t){let{cwd:e="."}=t;return ge(e,pC,r=>aIe(r,e))}function sIe(t,e){return(t.modules??[]).some(r=>rIe(nIe(e,r)))}function aIe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||sIe(s,e)||r.push(s.id);let n=iIe;if(r.length<=n)return[];let i=r.slice(0,U5).join(", "),o=r.length>U5?", \u2026":"";return[{detector:pC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var pC,iIe,U5,q5,B5=y(()=>{"use strict";wt();pC="PLANNED_BACKLOG",iIe=5,U5=8;q5={name:pC,run:oIe}});import{existsSync as cIe,readFileSync as lIe}from"node:fs";import{join as uIe}from"node:path";function pIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>mIe(r,e))}function mIe(t,e){if(t.features.lengthn.includes(i))?[{detector:mC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var mC,dIe,fIe,H5,G5=y(()=>{"use strict";wt();mC="PROJECT_CONTEXT_DRIFT",dIe=8,fIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];H5={name:mC,run:pIe}});function Z5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:oS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function hIe(t){let{cwd:e="."}=t;return ge(e,oS,gIe)}function gIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...Z5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:oS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...Z5(e,n.features,`scenario ${n.id}.features`));return r}var oS,sS,hC=y(()=>{"use strict";wt();oS="REFERENCE_INTEGRITY";sS={name:oS,run:hIe}});function Np(t=""){return new RegExp(yIe,t)}var yIe,gC=y(()=>{"use strict";yIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as _Ie,readdirSync as bIe,readFileSync as vIe,statSync as SIe,writeFileSync as wIe}from"node:fs";import{dirname as xIe,join as jp,normalize as $Ie,relative as kIe}from"node:path";function RIe(t){let e=[];for(let r of t.matchAll(OIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Np("g"))??[])e.push(n);return[...new Set(e)].sort()}function IIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function V5(t){return t.split("\\").join("/")}function PIe(t){return EIe.some(e=>t===e||t.startsWith(`${e}/`))}function CIe(t){let e=jp(t,"docs");if(!_Ie(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=bIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=jp(i,s),c;try{c=SIe(a)}catch{continue}let l=V5(kIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function DIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=$Ie(jp(xIe(t),e));return V5(r)}function Mp(t="."){let e=[];for(let r of CIe(t)){let n;try{n=vIe(jp(t,r),"utf8")}catch{continue}let i=IIe(n),o=RIe(i);if(PIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(AIe)?[]:i.match(Np("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(TIe)){let d=DIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function W5(t="."){let e=Mp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return wIe(jp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return k5(Ao(t,"spec","index.yaml"),n,"utf8"),!0}var eS,Pp=y(()=>{"use strict";eS=St(er(),1)});import{existsSync as E5,readFileSync as A5,readdirSync as NRe}from"node:fs";import{join as aC}from"node:path";function jRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=bs(e),i=r.inventory;if(!i){let s=T5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return cC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...cC(e),{detector:Cp,severity:"warn",path:"spec.yaml",message:`spec.yaml has no inventory: block, but the project has ${a} on disk \u2014 run \`clad sync\` to record the inventory so anyone reading spec.yaml sees its real scale.`}]}let o=[];for(let[s,a]of T5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Cp,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${s} declares ${c} but the project has ${l} ${a} on disk \u2014 run \`clad sync\` (a stale inventory hides created/deleted shards from anyone reading spec.yaml).`})}return o.push(...cC(e)),o}function cC(t){let e=aC(t,"spec","index.yaml"),r=aC(t,"spec","features");if(!E5(e)||!E5(r))return[];let n=new Map;try{for(let l of A5(e,"utf8").split(` +`)){let u=l.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(u){n.set(u[1],u[2]);continue}let d=l.match(/^ (F-[\w-]+):/);d&&n.set(d[1],"planned")}}catch{return[]}let i=new Map;try{for(let l of NRe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=A5(aC(r,l),"utf8"),d=u.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!d)continue;let f=u.match(/^status:\s*['"]?([\w-]+)['"]?/m);i.set(d[1],f?f[1]:"planned")}}catch{return[]}let o=[],s=[...i.keys()].filter(l=>!n.has(l)).sort(),a=[...n.keys()].filter(l=>!i.has(l)).sort();if(s.length>0||a.length>0){let l=[];s.length>0&&l.push(`missing from index: ${s.join(", ")}`),a.length>0&&l.push(`in index but not on disk: ${a.join(", ")}`),o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml disagrees with spec/features/ (${l.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let c=[...i.keys()].filter(l=>n.has(l)&&n.get(l)!==i.get(l)).sort().map(l=>`${l} (index: ${n.get(l)}, shard: ${i.get(l)})`);return c.length>0&&o.push({detector:Cp,severity:"error",path:"spec/index.yaml",message:`spec/index.yaml status disagrees with spec/features/ for ${c.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),o}var Cp,T5,O5,R5=y(()=>{"use strict";Pp();Ue();Cp="INVENTORY_DRIFT",T5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];O5={name:Cp,run:jRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function URe(t){let{cwd:e="."}=t,r=LRe(e,"src","spec","schema.json"),n=[];if(MRe(r)){let i;try{i=JSON.parse(FRe(r,"utf8"))}catch(o){n.push({detector:Dp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of zRe)i.required?.includes(o)||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Dp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==I5&&n.push({detector:Dp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${I5}'`})}catch{}return n}var Dp,zRe,I5,P5,C5=y(()=>{"use strict";Ue();Dp="META_INTEGRITY",zRe=["schema","project","features"],I5="0.1";P5={name:Dp,run:URe}});function qRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return D5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),D5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function D5(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let o=n.get(i.slug);o?r.push({detector:N5,severity:"error",message:`slug '${i.slug}' is used by both ${o} and ${i.id} in ${e}/ \u2014 two items in the same namespace cannot share a slug; pick a different slug for one`}):n.set(i.slug,i.id)}}var N5,j5,M5=y(()=>{"use strict";Ue();N5="SLUG_CONFLICT";j5={name:N5,run:qRe}});function Xl(t){return t==="planned"||t==="in_progress"}var tS=y(()=>{"use strict"});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function GRe(t){let{cwd:e="."}=t;return ge(e,rS,r=>ZRe(r,e))}function ZRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=HRe(e,i);BRe(o)||r.push(VRe(n.id,i,n.status))}return r}function VRe(t,e,r){return Xl(r)?{detector:rS,severity:"info",path:e,message:`feature ${t}'s module '${e}' is not built yet \u2014 the normal state between authoring the spec entry and implementing it`}:{detector:rS,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var rS,nS,lC=y(()=>{"use strict";tS();wt();rS="MISSING_IMPLEMENTATION";nS={name:rS,run:GRe}});function WRe(t){let{cwd:e="."}=t;return ge(e,uC,KRe)}function KRe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let o=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,s=(n.evidence_refs?.length??0)>0,a=!o&&!s&&(n.test_refs?.length??0)>0;!o&&!s&&e.push({detector:uC,severity:"error",message:`${r.id}.${n.id} declares no test_refs or evidence_refs \u2014 AC is unverified`+(a?" (a 'derived:' candidate exists \u2014 confirm it by removing the prefix, or author a real ref)":"")})}return e}var uC,iS,dC=y(()=>{"use strict";wt();uC="MISSING_TESTS";iS={name:uC,run:WRe}});import{existsSync as JRe,readFileSync as YRe}from"node:fs";import{join as F5}from"node:path";function L5(t){if(JRe(t))try{return JSON.parse(YRe(t,"utf8"))}catch{return}}function tIe(t){let{cwd:e="."}=t,r=L5(F5(e,XRe)),n=L5(F5(e,QRe));if(!r||!n)return[{detector:fC,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[o,s]of Object.entries(r.metrics??{})){let a=n.metrics?.[o];if(!a||typeof s.value!="number"||typeof a.value!="number"||s.value===0)continue;let c=(a.value-s.value)/s.value*100;c>eIe&&i.push({detector:fC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var fC,XRe,QRe,eIe,z5,U5=y(()=>{"use strict";fC="PERFORMANCE_DRIFT",XRe="perf/baseline.json",QRe="perf/current.json",eIe=10;z5={name:fC,run:tIe}});import{existsSync as rIe}from"node:fs";import{join as nIe}from"node:path";function oIe(t){let{cwd:e="."}=t;return ge(e,pC,r=>aIe(r,e))}function sIe(t,e){return(t.modules??[]).some(r=>rIe(nIe(e,r)))}function aIe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||sIe(s,e)||r.push(s.id);let n=iIe;if(r.length<=n)return[];let i=r.slice(0,q5).join(", "),o=r.length>q5?", \u2026":"";return[{detector:pC,severity:"warn",message:`${r.length} planned/in_progress features have NO code on disk (> ${n} tolerated) \u2014 the spec has raced ahead of the code. Work one feature end-to-end before authoring the next (docs/feature-cycle.md). Stalled: ${i}${o}`}]}var pC,iIe,q5,B5,H5=y(()=>{"use strict";wt();pC="PLANNED_BACKLOG",iIe=5,q5=8;B5={name:pC,run:oIe}});import{existsSync as cIe,readFileSync as lIe}from"node:fs";import{join as uIe}from"node:path";function pIe(t){let{cwd:e="."}=t;return ge(e,mC,r=>mIe(r,e))}function mIe(t,e){if(t.features.lengthn.includes(i))?[{detector:mC,severity:"warn",path:"docs/project-context.md",message:`${t.features.length} features but docs/project-context.md is still the unrefined init template (it still carries the placeholder prompts) \u2014 the Why/What/Purpose narrative was never filled in. Fill it in with \`clad clarify\` or by hand.`}]:[]}var mC,dIe,fIe,G5,Z5=y(()=>{"use strict";wt();mC="PROJECT_CONTEXT_DRIFT",dIe=8,fIe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];G5={name:mC,run:pIe}});function V5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:oS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function hIe(t){let{cwd:e="."}=t;return ge(e,oS,gIe)}function gIe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...V5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:oS,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...V5(e,n.features,`scenario ${n.id}.features`));return r}var oS,sS,hC=y(()=>{"use strict";wt();oS="REFERENCE_INTEGRITY";sS={name:oS,run:hIe}});function Np(t=""){return new RegExp(yIe,t)}var yIe,gC=y(()=>{"use strict";yIe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as _Ie,readdirSync as bIe,readFileSync as vIe,statSync as SIe,writeFileSync as wIe}from"node:fs";import{dirname as xIe,join as jp,normalize as $Ie,relative as kIe}from"node:path";function RIe(t){let e=[];for(let r of t.matchAll(OIe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Np("g"))??[])e.push(n);return[...new Set(e)].sort()}function IIe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function W5(t){return t.split("\\").join("/")}function PIe(t){return EIe.some(e=>t===e||t.startsWith(`${e}/`))}function CIe(t){let e=jp(t,"docs");if(!_Ie(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=bIe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=jp(i,s),c;try{c=SIe(a)}catch{continue}let l=W5(kIe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function DIe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=$Ie(jp(xIe(t),e));return W5(r)}function Mp(t="."){let e=[];for(let r of CIe(t)){let n;try{n=vIe(jp(t,r),"utf8")}catch{continue}let i=IIe(n),o=RIe(i);if(PIe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(AIe)?[]:i.match(Np("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(TIe)){let d=DIe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function K5(t="."){let e=Mp(t);if(e.docs.length===0)return!1;let r=["# Cladding \xB7 Tier C \u2014 generated doc\u2192spec / doc\u2192doc link index (`clad sync`). Do not edit by hand.","# Source of truth is the docs themselves; DOC_LINK_INTEGRITY validates resolution.",'schema: "0.1"',"docs:"];for(let n of e.docs)n.features.length===0&&n.doc_links.length===0||(r.push(` ${JSON.stringify(n.doc)}:`),n.features.length>0&&r.push(` features: [${n.features.join(", ")}]`),n.doc_links.length>0&&r.push(` doc_links: [${n.doc_links.map(i=>JSON.stringify(i)).join(", ")}]`));return wIe(jp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var EIe,AIe,TIe,OIe,aS=y(()=>{"use strict";gC();EIe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],AIe="clad-doc-links: ignore",TIe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,OIe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as NIe}from"node:fs";import{join as jIe}from"node:path";function MIe(t){let{cwd:e="."}=t;return ge(e,cS,r=>FIe(r,e))}function FIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Mp(e).docs){for(let o of i.doc_links)NIe(jIe(e,o))||n.push({detector:cS,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${o}'`});for(let o of i.features)r.has(o)||n.push({detector:cS,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${o}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var cS,lS,yC=y(()=>{"use strict";aS();wt();cS="DOC_LINK_INTEGRITY";lS={name:cS,run:MIe}});function LIe(t){let{cwd:e="."}=t;return ge(e,Fp,r=>zIe(r))}function zIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=K5,o=t.project.onboarding_seeded===!0&&!i;r>=K5&&n.length===0&&e.push({detector:Fp,severity:"warn",path:"spec/scenarios/",message:`${r} features but no scenarios declared \u2014 cross-feature user-journey flows are not captured. Author at least one with \`clad_create_scenario\`.`});for(let a of n)(a.features??[]).length===0&&e.push({detector:Fp,severity:o?"info":"warn",path:"spec/scenarios/",message:o?`scenario ${a.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`:`scenario ${a.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let s=new Map(t.features.filter(a=>typeof a.slug=="string"&&a.slug.length>0).map(a=>[a.slug,a.id]));for(let a of n){if(!a.flow)continue;let c=new Set(a.features??[]),l=new Map;for(let u of a.flow.matchAll(/\(([^)]+)\)/g))for(let d of u[1].split(/[,/·]/)){let f=d.trim(),p=s.get(f);p&&!c.has(p)&&l.set(f,p)}if(l.size>0){let u=[...l].map(([d,f])=>`${d} (${f})`).join(", ");e.push({detector:Fp,severity:"warn",path:"spec/scenarios/",message:`scenario ${a.id} flow references ${u} but features[] does not bind ${l.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var Fp,K5,J5,Y5=y(()=>{"use strict";wt();Fp="SCENARIO_COVERAGE",K5=8;J5={name:Fp,run:LIe}});import{createHash as UIe}from"node:crypto";function qIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Lp(t,e=0){if(t.oracle_policy){let r=t.oracle_policy;return{mandateActive:!0,reportOnly:!1,exhaustive:!1,alwaysEars:new Set(r.always_ears??X5),sample:qIe(r.sample??0)}}return t.require_oracles===!0?{mandateActive:!0,reportOnly:!1,exhaustive:!0,alwaysEars:new Set,sample:1}:t.require_oracles===void 0&&e>=8?{mandateActive:!0,reportOnly:!0,exhaustive:!1,alwaysEars:new Set(X5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function zp(t){return(t.features??[]).filter(e=>e.status==="done").length}function BIe(t,e){return e<=0?!1:e>=1?!0:parseInt(UIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var X5,uS=y(()=>{"use strict";X5=["unwanted"]});import{chmodSync as HIe,existsSync as eY,readFileSync as GIe,readdirSync as ZIe,statSync as tY,unlinkSync as VIe,utimesSync as WIe,writeFileSync as KIe}from"node:fs";import{join as rY}from"node:path";import nY from"node:process";function JIe(t){return pJ(t).map(e=>{try{let r=tY(e);return r.isFile()?{path:e,body:GIe(e),mode:r.mode,atime:r.atime,mtime:r.mtime}:{path:e,nonFile:!0}}catch(r){if(r.code==="ENOENT")return{path:e};throw r}})}function YIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!eY(r.path))continue;if(!tY(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}VIe(r.path);continue}KIe(r.path,r.body),r.mode!==void 0&&HIe(r.path,r.mode),r.atime&&r.mtime&&WIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function XIe(t){let e=!1,r=n=>{for(let i of ZIe(n,{withFileTypes:!0})){if(e)return;let o=rY(n,i.name);i.isDirectory()?r(o):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function _C(t={}){let{cwd:e="."}=t,r=rY(e,vs);if(!eY(r)||!XIe(r))return{stage:Ja,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${vs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Ja,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=JIe(e)}catch(d){return{stage:Ja,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let s,a,c=[...i.args,vs];try{s=We(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=YIe(o);if(l.length>0)return{stage:Ja,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Ja,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=Nt(Ja,i.cmd,s,c);return u||Yt(Ja,s)}var Ja,vs,QIe,bC=y(()=>{"use strict";Lr();cn();_p();Cn();Ja="stage_2.3",vs="tests/oracle";QIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nY.argv[1]}`;if(QIe){let t=_C();console.log(JSON.stringify(t)),nY.exit(t.exitCode)}});import{existsSync as ePe}from"node:fs";import{join as tPe}from"node:path";function rPe(t){let{cwd:e="."}=t;return ge(e,oi,r=>nPe(r,e))}function nPe(t,e){let r=[],n=Lp(t.project,zp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?fr(e):[],s=o.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>o.find(u=>u.featureId===l&&a.has(u.stage))?.identity.name;for(let l of t.features)if(l.status==="done")for(let u of l.acceptance_criteria??[]){let d=u.oracle_refs??[];if(Up(n,l.id,u)&&d.length===0){let f=n.exhaustive?"project.require_oracles is set":u.ears&&n.alwaysEars.has(u.ears)?`oracle_policy.always_ears includes '${u.ears}'`:"selected by oracle_policy.sample";r.push({detector:oi,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${vs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!ePe(tPe(e,f))){r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${vs}/`)||r.push({detector:oi,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${vs}/ \u2014 stage_2.3 only runs ${vs}/, so this oracle will not execute`}),!n.mandateActive)continue;let p=s.find(g=>g.featureId===l.id&&g.acId===u.id&&g.artifact===f);if(!p){r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let m=c(l.id);m&&p.identity.name===m?r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:oi,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no clad run history to compare)`});let h=(p.readManifest??[]).filter(g=>(l.modules??[]).includes(g));h.length>0&&r.push({detector:oi,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: author read implementation file(s) the feature owns (${h.join(", ")})`}),p.blind===!1&&r.push({detector:oi,severity:"info",message:`${l.id}.${u.id} oracle '${f}' provenance is self-reported (host-protocol), not cladding-controlled \u2014 manifest checked, blindness unproven`})}}if(n.mandateActive&&!n.exhaustive){let l=t.features.filter(u=>u.status==="done").flatMap(u=>u.acceptance_criteria??[]).filter(u=>!u.ears).length;l>0&&r.push({detector:oi,severity:"info",message:`${l} done AC(s) carry no EARS tag and are invisible to the risk-weighted oracle mandate \u2014 tag them (ubiquitous/event/state/optional/unwanted/complex) for the mandate to mean anything.`})}return r}var oi,iY,oY=y(()=>{"use strict";un();uS();bC();wt();oi="SPEC_CONFORMANCE";iY={name:oi,run:rPe}});function iPe(t){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return[{detector:vC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let o of r){let s=Date.parse(o.identity.timestamp);if(Number.isNaN(s))continue;let a=(n-s)/(1e3*60*60*24);a>sY&&i.push({detector:vC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${sY})`})}return i}var vC,sY,aY,cY=y(()=>{"use strict";un();vC="STALE_EVIDENCE",sY=90;aY={name:vC,run:iPe}});import{existsSync as lY}from"node:fs";import{join as uY}from"node:path";function oPe(t){let{cwd:e="."}=t;return ge(e,Ql,r=>sPe(r,e))}function sPe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ql,severity:"warn",message:`feature ${n.id} has archived_at but status='${n.status}' (expected 'archived')`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`archived_at already set but status is '${n.status}'`}}}),n.superseded_by&&!n.archived_at&&r.push({detector:Ql,severity:"warn",message:`feature ${n.id} has superseded_by but no archived_at`,suggestion:{action:"propose-archive",args:{featureId:n.id,reason:`superseded by ${n.superseded_by} but missing archived_at`}}}),n.status==="archived"){let i=(n.modules??[]).filter(o=>lY(uY(e,o)));i.length>0&&r.push({detector:Ql,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Xl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>lY(uY(e,i)))&&r.push({detector:Ql,severity:"info",message:`feature ${n.id} (status='${n.status}') declares ${n.modules?.length??0} module(s) that aren't built yet \u2014 the normal state while implementing (not stale)`})}return r}var Ql,dS,SC=y(()=>{"use strict";tS();wt();Ql="STALE_SPECIFICATION";dS={name:Ql,run:oPe}});import{existsSync as dY,statSync as fY}from"node:fs";import{join as pY}from"node:path";function cPe(t,e){let r=0;for(let n of e){let i=pY(t,n);if(!dY(i))continue;let o=fY(i).mtimeMs;o>r&&(r=o)}return r}function lPe(t){let{cwd:e="."}=t;return ge(e,wC,r=>uPe(r,e))}function uPe(t,e){let r=Li(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=cPe(e,n);if(i===0)return[];let o=_s([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=pY(e,a);if(!dY(c))continue;let l=fY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>aPe&&s.push({detector:wC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var wC,aPe,fS,xC=y(()=>{"use strict";Ap();Ha();wt();wC="STALE_TESTS",aPe=30;fS={name:wC,run:lPe}});import{existsSync as dPe}from"node:fs";import{join as fPe}from"node:path";function pPe(t){let{cwd:e="."}=t;return ge(e,qp,r=>mPe(r,e))}function mPe(t,e){let r=[];for(let n of t.features){let i=n.modules??[],o=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&o.length===0){r.push({detector:qp,severity:"error",message:`feature ${n.id} status='done' but declares no modules and no acceptance_criteria \u2014 nothing to verify (hollow completion)`});continue}if(i.length===0)continue;let s=i.filter(a=>!dPe(fPe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:qp,severity:"error",message:`feature ${n.id} status='done' but ${s.length}/${i.length} module(s) missing: ${s.join(", ")}`}):n.status==="in_progress"&&s.length===i.length&&r.push({detector:qp,severity:Xl(n.status)?"info":"warn",message:`feature ${n.id} is in progress and none of its declared modules are built yet \u2014 the normal state while implementing`}))}return r}var qp,pS,$C=y(()=>{"use strict";tS();wt();qp="STATUS_DRIFT";pS={name:qp,run:pPe}});function hPe(t){let{cwd:e="."}=t;return ge(e,mS,r=>gPe(r,e))}function gPe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:mS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:mS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var mS,mY,hY=y(()=>{"use strict";cn();wt();mS="TECH_STACK_MISMATCH";mY={name:mS,run:hPe}});function vPe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function SPe(t){let{cwd:e="."}=t;return ge(e,kC,r=>wPe(r,e))}function wPe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=_s([...vPe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:kC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var kC,gY,yPe,_Pe,bPe,hS,EC=y(()=>{"use strict";Ap();JP();wt();kC="UNMAPPED_ARTIFACT",gY=["src/stages/**/*.ts","src/spec/**/*.ts"],yPe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},_Pe={kotlin:"src/main/kotlin"},bPe=8;hS={name:kC,run:SPe}});import{existsSync as yY}from"node:fs";import{join as _Y}from"node:path";function $Pe(t){return xPe.some(e=>t.startsWith(e))}function kPe(t){let{cwd:e="."}=t;return ge(e,AC,r=>EPe(r,e))}function EPe(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let o of i.test_refs??[]){if($Pe(o))continue;let s=o.split("#",1)[0];yY(_Y(e,o))||s&&yY(_Y(e,s))||r.push({detector:AC,severity:"error",path:o,message:`${n.id}.${i.id} test_ref '${o}' resolves to nothing on disk \u2014 a test_ref must be a real file path (e.g. 'tests/x.test.ts', optionally with a '#' anchor) or a 'self-dogfood: +`}function _te(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${mte(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(hte);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(hte);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${mte(s)}.md`,`${a.join(` +`)}`)}return o}function hte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as wqe}from"node:fs";import{dirname as xqe,join as Pj}from"node:path";import{fileURLToPath as $qe}from"node:url";var Cj=xqe($qe(import.meta.url));function bte(t){for(let e of[Pj(Cj,"viewer",t),Pj(Cj,"..","graph","viewer",t),Pj(Cj,"..","..","dist","viewer",t)])try{return wqe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function vte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -901,57 +903,61 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}eC();yC();lC();dC();hC();QP();xC();$C();EC();TC();rh();gC();Ue();var kqe=[iS,gS,nS,hS,sS,lS,Xv,pS,fS,Yv];function Eqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Np().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Hx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of kqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of Eqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Dj();Ue();Pi();var Tqe=new Set(["mermaid","dot","json","obsidian","html"]);function Ste(t={}){try{let e=t.format??"mermaid";if(!Tqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=xc(n,".");if(t.focus){let s=Fx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Mx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=yte(i);for(let[c,l]of a){let u=Aqe(s,c);Nj(Mj(u),{recursive:!0}),jj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Bx(i,Hx(i,"."));Nj(Mj(t.out),{recursive:!0}),jj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?gte(i):r==="json"?qx(i):hte(i);t.out?(Nj(Mj(t.out),{recursive:!0}),jj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function wte(){try{let t=xc(q(),".");process.stdout.write(vte(Gx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}rh();import{createServer as Oqe}from"node:http";import{existsSync as Rqe,watch as Iqe}from"node:fs";import{join as Pqe}from"node:path";Ue();Pi();function Cqe(t={}){let e=t.cwd??".",r=new Set,n=()=>xc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}eC();yC();lC();dC();hC();QP();xC();$C();EC();TC();rh();gC();Ue();var kqe=[iS,gS,nS,hS,sS,lS,Xv,pS,fS,Yv];function Eqe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[qe.module(n),qe.test(n),qe.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Np().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Hx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,q(e))}catch{}try{for(let o of kqe){let s=[];try{s=o.run({cwd:e})}catch{continue}for(let a of s)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of Eqe(a,r)){let l=n[c]??(n[c]={severity:"warn",count:0,detectors:new Set});l.count+=1,l.detectors.add(a.detector),a.severity==="error"&&(l.severity="error")}}}finally{Ea(e,null)}let i={};for(let o of Object.keys(n).sort()){let s=n[o];i[o]={severity:s.severity,count:s.count,detectors:[...s.detectors].sort()}}return i}Dj();Ue();Pi();var Tqe=new Set(["mermaid","dot","json","obsidian","html"]);function wte(t={}){try{let e=t.format??"mermaid";if(!Tqe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=q(),i=$c(n,".");if(t.focus){let s=Fx(n,i,t.focus);if(s.length===0){L("fail","graph",`no node matches '${t.focus}' \u2014 try a feature id (F-\u2026), slug, or module path`),process.exit(1);return}let a=t.depth!==void 0?Number(t.depth):1/0;if(Number.isNaN(a)||a<0){L("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Mx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=_te(i);for(let[c,l]of a){let u=Aqe(s,c);Nj(Mj(u),{recursive:!0}),jj(u,l,"utf8")}L("pass","graph",`wrote ${a.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){L("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Bx(i,Hx(i,"."));Nj(Mj(t.out),{recursive:!0}),jj(t.out,s,"utf8"),L("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}let o=r==="dot"?yte(i):r==="json"?qx(i):gte(i);t.out?(Nj(Mj(t.out),{recursive:!0}),jj(t.out,o,"utf8"),L("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){L("fail","graph",e.message),process.exit(1)}}function xte(){try{let t=$c(q(),".");process.stdout.write(Ste(Gx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}rh();import{createServer as Oqe}from"node:http";import{existsSync as Rqe,watch as Iqe}from"node:fs";import{join as Pqe}from"node:path";Ue();Pi();function Cqe(t={}){let e=t.cwd??".",r=new Set,n=()=>$c(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh `)}catch{r.delete(u)}},o=Oqe((u,d)=>{let f=(u.url??"/").split("?")[0],p=(u.headers.host??"").split(":")[0];if(p&&p!=="localhost"&&p!=="127.0.0.1"&&p!=="[::1]"&&p!=="::1"){d.writeHead(403,{"Content-Type":"text/plain"}),d.end("forbidden host");return}try{if(f==="/graph.json"){let m=qx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Hx(n(),e));d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/events"){d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),d.write(`: connected `),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Bx(n());d.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),d.end(m);return}d.writeHead(404,{"Content-Type":"text/plain"}),d.end("not found")}catch(m){if(d.headersSent)try{d.end()}catch{}else{d.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{d.end(JSON.stringify({error:m.message}))}catch{}}}}),s=null,a=()=>{s&&clearTimeout(s),s=setTimeout(i,400)},c=[];for(let u of["spec","docs"]){let d=Pqe(e,u);if(Rqe(d))try{let f=Iqe(d,{recursive:!0},a);f.on("error",()=>{try{f.close()}catch{}}),c.push(f)}catch{}}let l=setInterval(()=>{for(let u of r)try{u.write(`: keep-alive -`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function xte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Cqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Dqe=["stage_1.1","stage_2.1","stage_2.3"];function Nqe(t){return(t.features??[]).filter(e=>e.status==="done")}function jqe(t,e){let r=Nqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function $te(t,e){let r=[];for(let n of Dqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=jqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}TS();import kte from"node:process";function Mqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Zx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Mqe(n,t);i.pass||r.push(i)}return r}un();var Fj="stage_4.1";function Lj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Fj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Zx(r);if(n.length===0)return{stage:Fj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Fj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var Fqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kte.argv[1]}`;if(Fqe){let t=Lj();console.log(JSON.stringify(t)),kte.exit(t.exitCode)}$l();import{randomBytes as Lqe}from"node:crypto";import{unlinkSync as zqe}from"node:fs";import{tmpdir as Uqe}from"node:os";import{join as qqe,resolve as zj}from"node:path";import Bqe from"node:process";var Hr=null;function Ete(t){Hr={cwd:zj(t),run:null,jsonFile:null}}function Uj(){return Hr!==null}function qj(t,e){if(!Hr||Hr.cwd!==zj(t))return null;if(Hr.run)return Hr.run;let r=qqe(Uqe(),`clad-shared-vitest-${Bqe.pid}-${Lqe(6).toString("hex")}.json`);Hr.jsonFile=r;let n=e(r);return Hr.run={proc:n,jsonFile:r},Hr.run}function Ate(t){return!Hr||Hr.cwd!==zj(t)?null:Hr.run}function Bj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Tte(){let t=Hr?.jsonFile;if(Hr=null,t)try{zqe(t)}catch{}}Lr();import Ote from"node:process";var Vx="stage_1.4";function Hj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Vx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Vx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Vx,pass:!0,exitCode:0}:{stage:Vx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var Hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ote.argv[1]}`;if(Hqe){let t=Hj();console.log(JSON.stringify(t)),Ote.exit(t.exitCode)}Lr();import Rte from"node:process";nh();Cn();var Wx="stage_2.2";function Gj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Wx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Wx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Ate(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Wx,r,s,n);return a||Yt(Wx,s)}var Vqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(Vqe){let t=Gj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Hp();Zj();Lr();cn();Cn();import Pte from"node:process";var Yx="stage_3.2";function Vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Yx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Yx,i,s,o);return a||Yt(Yx,s)}var p4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Pte.argv[1]}`;if(p4e){let t=Vj();console.log(JSON.stringify(t)),Pte.exit(t.exitCode)}Lr();Ue();Cn();import{existsSync as m4e}from"node:fs";import{resolve as Dte}from"node:path";import Nte from"node:process";var fi="stage_2.4",Wj=5e3,h4e=3e4;function Kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return y4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Dte(e,r.path);if(!m4e(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Wj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Cte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},g4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function y4e(t,e,r){let n=Math.min(e.length*Wj,h4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(_4e(t,s,r))}return b4e(o)}function _4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Dte(t,a):a,u=Wj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ua(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function b4e(t){let e="skip";for(let o of t)Cte[o.disposition]>Cte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${g4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` -`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var v4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Nte.argv[1]}`;if(v4e){let t=Kj();console.log(JSON.stringify(t)),Nte.exit(t.exitCode)}Lr();cn();Cn();import jte from"node:process";var Xx="stage_3.1";function Jj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var S4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jte.argv[1]}`;if(S4e){let t=Jj();console.log(JSON.stringify(t)),jte.exit(t.exitCode)}bC();Yj();Xj();Lr();Kx();import{randomBytes as T4e}from"node:crypto";import{unlinkSync as O4e}from"node:fs";import{tmpdir as R4e}from"node:os";import{join as I4e}from"node:path";import eM from"node:process";nh();Cn();Ue();import{readFileSync as $4e}from"node:fs";import{resolve as Lte}from"node:path";function k4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=Lte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function E4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function A4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=E4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(Lte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Qj(t,e){try{let r=k4e($4e(t,"utf8"));return r?A4e(q(e),r,e):[]}catch{return[]}}var Gr="stage_2.1";function zte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Ute(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function qte(t){let e=`${String(t.stdout??"")} -${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function P4e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!zte(n,i))return null;let o=n,s=i,a=qj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Gr,n,c,s))return null;let u=Yt(Gr,c);if(Bj(u)==="fallback")return null;if(r){let d=Qj(l,e);if(d.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Gr,pass:!0,exitCode:0}}function C4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Ute(n,i))return null;let o=n,s=i,a=qj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Gr,o,a.proc,s))return null;let c=Yt(Gr,a.proc);if(Bj(c)==="fallback")return null;if(r&&qte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Gr,pass:!0,exitCode:0}}function tM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Gr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Gr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=zte(n,i),a=Ute(n,i),c=r&&s;if(Uj()&&s){let d=P4e(t,e,c);if(d)return d}if(Uj()&&a){let d=C4e(t,e);if(d)return d}let l,u=i;c&&(l=I4e(R4e(),`clad-vitest-${eM.pid}-${T4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Gr,n,d,u);if(f)return f;let p=ju("unit",Yt(Gr,d),d);if(r&&p.pass&&qte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Qj(l,e);if(m.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{O4e(l)}catch{}}}var D4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${eM.argv[1]}`;if(D4e){let t=tM();console.log(JSON.stringify(t)),eM.exit(t.exitCode)}Lr();cn();Cn();import Bte from"node:process";var t0="stage_3.3";function rM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Yt(t0,s)}var N4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bte.argv[1]}`;if(N4e){let t=rM();console.log(JSON.stringify(t)),Bte.exit(t.exitCode)}SC();Bf();ba();iM();Pp();aS();var Jte=St(er(),1);import{existsSync as oM,readFileSync as Z4e,readdirSync as Kte,statSync as V4e,writeFileSync as W4e}from"node:fs";import{basename as ch,join as lh,relative as Wte}from"node:path";var K4e=["self-dogfood:","fixture:","derived:"],Yte=/\.(test|spec)\.[jt]sx?$/;function Xte(t,e=t,r=[]){let n;try{n=Kte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=lh(e,i);try{V4e(o).isDirectory()?Xte(t,o,r):Yte.test(i)&&r.push(o)}catch{continue}}return r}function Qte(t="."){let e=lh(t,"spec","features"),r=lh(t,"tests"),n=[],i=[];if(!oM(e)||!oM(r))return{repaired:n,suggested:i};let o=Xte(r),s=new Map;for(let a of o){let c=Wte(t,a).split("\\").join("/"),l=s.get(ch(a))??[];l.push(c),s.set(ch(a),l)}for(let a of Kte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=lh(e,a),l,u;try{l=Z4e(c,"utf8"),u=(0,Jte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(K4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(oM(lh(t,b)))continue;let _=s.get(ch(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>ch(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Wte(t,h).split("\\").join("/")).find(h=>{let g=ch(h).replace(Yte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 +`)}catch{r.delete(u)}},3e4);return typeof l.unref=="function"&&l.unref(),new Promise((u,d)=>{o.on("error",d),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),p=typeof f=="object"&&f?f.port:t.port??0;u({port:p,broadcast:i,close:()=>new Promise(m=>{s&&clearTimeout(s),clearInterval(l);for(let h of c)try{h.close()}catch{}for(let h of r)try{h.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function $te(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Cqe({port:e,cwd:t.cwd??"."});L("pass","graph",`live graph at http://localhost:${r.port} \u2014 edit spec/ or docs/ and the view auto-reloads (Ctrl-C to stop)`)}catch(r){L("fail","graph",r.message),process.exit(1)}}var Dqe=["stage_1.1","stage_2.1","stage_2.3"];function Nqe(t){return(t.features??[]).filter(e=>e.status==="done")}function jqe(t,e){let r=Nqe(t);switch(e){case"stage_1.1":return!t.project?.language||r.length===0?null:`project.language is '${t.project.language}' and ${r.length} feature(s) are done, but the type checker did not run (skipped) \u2014 type safety of shipped code was never verified. Install the language toolchain; under --strict, an unverifiable 'done' is not GREEN.`;case"stage_2.1":{let n=r.filter(i=>(i.acceptance_criteria??[]).some(o=>(o.test_refs??[]).length>0)).length;return n===0?null:`${n} done feature(s) declare tests but the test runner did not run (skipped) \u2014 the implementation was never verified. Install the test framework; under --strict, an unverifiable 'done' is not GREEN.`}case"stage_2.3":{let n=r.flatMap(i=>i.acceptance_criteria??[]).filter(i=>(i.oracle_refs??[]).length>0).length;return n===0?null:`${n} done AC(s) declare oracle_refs but the conformance runner did not run (skipped) \u2014 the declared oracles never executed. Under --strict, declared-but-unrun verification is not GREEN.`}}}function kte(t,e){let r=[];for(let n of Dqe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=jqe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}TS();import Ete from"node:process";function Mqe(t,e){let r=e.filter(i=>i.acId===t),n=r.filter(i=>i.identity.author==="human");return n.length===0?{acId:t,pass:!1,totalEvidence:r.length,humanEvidence:0,reason:r.length===0?"no evidence at all":`${r.length} tool/LLM evidence but 0 human \u2014 anti-self-cert guard blocks`}:{acId:t,pass:!0,totalEvidence:r.length,humanEvidence:n.length}}function Zx(t){let e=new Set;for(let n of t)n.acId&&e.add(n.acId);let r=[];for(let n of e){let i=Mqe(n,t);i.pass||r.push(i)}return r}un();var Fj="stage_4.1";function Lj(t={}){let{cwd:e="."}=t,r=fr(e);if(r.length===0)return{stage:Fj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Zx(r);if(n.length===0)return{stage:Fj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Fj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var Fqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ete.argv[1]}`;if(Fqe){let t=Lj();console.log(JSON.stringify(t)),Ete.exit(t.exitCode)}$l();import{randomBytes as Lqe}from"node:crypto";import{unlinkSync as zqe}from"node:fs";import{tmpdir as Uqe}from"node:os";import{join as qqe,resolve as zj}from"node:path";import Bqe from"node:process";var Hr=null;function Ate(t){Hr={cwd:zj(t),run:null,jsonFile:null}}function Uj(){return Hr!==null}function qj(t,e){if(!Hr||Hr.cwd!==zj(t))return null;if(Hr.run)return Hr.run;let r=qqe(Uqe(),`clad-shared-vitest-${Bqe.pid}-${Lqe(6).toString("hex")}.json`);Hr.jsonFile=r;let n=e(r);return Hr.run={proc:n,jsonFile:r},Hr.run}function Tte(t){return!Hr||Hr.cwd!==zj(t)?null:Hr.run}function Bj(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Ote(){let t=Hr?.jsonFile;if(Hr=null,t)try{zqe(t)}catch{}}Lr();import Rte from"node:process";var Vx="stage_1.4";function Hj(t={}){let{cwd:e="."}=t,r;try{r=We("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Vx,pass:!1,exitCode:2,stderr:"git binary not found"};throw i}if(r.exitCode!==0){let i=(r.stderr??"").toString().trim()||"not a git repository";return{stage:Vx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Vx,pass:!0,exitCode:0}:{stage:Vx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rte.argv[1]}`;if(Hqe){let t=Hj();console.log(JSON.stringify(t)),Rte.exit(t.exitCode)}Lr();import Ite from"node:process";nh();Cn();var Wx="stage_2.2";function Gj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Wx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Wx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Tte(e),s=o?o.proc:We(r,[...n],{cwd:e,reject:!1}),a=Nt(Wx,r,s,n);return a||Yt(Wx,s)}var Vqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ite.argv[1]}`;if(Vqe){let t=Gj();console.log(JSON.stringify(t)),Ite.exit(t.exitCode)}Hp();Zj();Lr();cn();Cn();import Cte from"node:process";var Yx="stage_3.2";function Vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Yx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Yx,i,s,o);return a||Yt(Yx,s)}var p4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cte.argv[1]}`;if(p4e){let t=Vj();console.log(JSON.stringify(t)),Cte.exit(t.exitCode)}Lr();Ue();Cn();import{existsSync as m4e}from"node:fs";import{resolve as Nte}from"node:path";import jte from"node:process";var fi="stage_2.4",Wj=5e3,h4e=3e4;function Kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=q(e);r=p.project.deliverable,n=p.project.smoke??[],i=p.features.some(m=>m.status==="done"),o=new Map(p.features.map(m=>[m.id,m.status]))}catch{return{stage:fi,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return y4e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:fi,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:fi,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Nte(e,r.path);if(!m4e(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Wj,c;try{c=We(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Nt(fi,r.path,c);if(l)return l;if(c.timedOut)return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' timed out after ${a}ms (hung or too slow)`};let u=r.expect_exit??0,d=c.exitCode??1;if(d===u)return{stage:fi,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:fi,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Dte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},g4e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function y4e(t,e,r){let n=Math.min(e.length*Wj,h4e),i=Date.now(),o=[];for(let s of e){if(Date.now()-i>=n){o.push({argv:(s.run??[]).join(" ")||"(none)",kind:s.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:s.feature,why:s.why});continue}o.push(_4e(t,s,r))}return b4e(o)}function _4e(t,e,r){let n=(e.run??[]).join(" ")||"(none)",i=e.why;if(e.kind==="none")return{argv:"(kind:none)",kind:"none",disposition:"na",detail:"nothing to run (library/static)",why:i};let o=e.feature;if(o!==void 0){let h=r.featureStatus.get(o);if(h!=="done"){let g=h===void 0?`bound feature ${o} not found in spec \u2014 not executed`:`bound feature ${o} is ${h}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:g,feature:o,why:i}}}else if(!r.anyDone)return{argv:n,kind:"cli",disposition:"skip",detail:"no done feature yet \u2014 smoke probe skipped",why:i};let s=e.run??[];if(s.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:o,why:i};let[a,...c]=s,l=a.startsWith(".")||a.startsWith("/")?Nte(t,a):a,u=Wj,d;try{d=We(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(qa(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:o,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:o,why:i};let f=e.expect?.exit??0,p=d.exitCode??1;if(p!==f){let h=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${p}, expected ${f}${h?` \u2014 ${h.slice(0,200)}`:""}`,feature:o,why:i}}let m=e.expect?.token;return m?String(d.stdout??"").includes(m)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${p}), stdout contains ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${p}) but stdout did not contain the AC token ${JSON.stringify(m)}`,feature:o,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${p}), no token declared \u2014 exit-only`,feature:o,why:i}}function b4e(t){let e="skip";for(let o of t)Dte[o.disposition]>Dte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${g4e[o.disposition]} ${o.argv} \xB7 ${o.detail}${s}`}).join(` +`),n=t.map((o,s)=>({id:`probe_${s+1}`,kind:o.kind,disposition:o.disposition==="skip"?"na":o.disposition,bindsFeature:o.feature,why:o.why,detail:o.detail}));if(e==="skip")return{stage:fi,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:fi,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var v4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jte.argv[1]}`;if(v4e){let t=Kj();console.log(JSON.stringify(t)),jte.exit(t.exitCode)}Lr();cn();Cn();import Mte from"node:process";var Xx="stage_3.1";function Jj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Xx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:Xx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(Xx,i,s,o);return a||Yt(Xx,s)}var S4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Mte.argv[1]}`;if(S4e){let t=Jj();console.log(JSON.stringify(t)),Mte.exit(t.exitCode)}bC();Yj();Xj();Lr();Kx();import{randomBytes as T4e}from"node:crypto";import{unlinkSync as O4e}from"node:fs";import{tmpdir as R4e}from"node:os";import{join as I4e}from"node:path";import eM from"node:process";nh();Cn();Ue();import{readFileSync as $4e}from"node:fs";import{resolve as zte}from"node:path";function k4e(t){let e=t.trim();if(!e.startsWith("{"))return null;let r;try{r=JSON.parse(e)}catch{return null}let n=r.testResults;if(!Array.isArray(n))return null;let i=new Map;for(let o of n){if(typeof o.name!="string"||!o.name)continue;let s=zte(o.name),a=i.get(s)??0;for(let c of o.assertionResults??[])c.status==="passed"&&(a+=1);i.set(s,a)}return i}function E4e(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function A4e(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let o=[],s=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let f=E4e(d);f&&!s.has(f)&&(s.add(f),o.push(f))}if(o.length===0)continue;let a=!0,c=!1;for(let u of o){let d=e.get(zte(r,u));if(d===void 0){a=!1;break}if(d>0){c=!0;break}}if(c||!a)continue;let l=i.title||i.id;n.push({detector:"VACUOUS_TESTS",severity:"warn",path:o[0],message:`Done feature "${l}" declares tests, but none of its test files executed a passing test (all skipped / todo / empty) \u2014 its behavioral proof never actually ran`})}return n}function Qj(t,e){try{let r=k4e($4e(t,"utf8"));return r?A4e(q(e),r,e):[]}catch{return[]}}var Gr="stage_2.1";function Ute(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function qte(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Bte(t){let e=`${String(t.stdout??"")} +${String(t.stderr??"")}`,r=[],n=[/^\s*#\s*tests\s+(\d+)\s*$/gim,/^\s*ℹ\s+tests\s+(\d+)\s*$/gim,/^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim,/^\s*collected\s+(\d+)\s+items?\b.*$/gim];for(let i of n)for(let o of e.matchAll(i))r.push(Number(o[1]));return r.length>0&&r.every(i=>i===0)}function P4e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Ute(n,i))return null;let o=n,s=i,a=qj(e,d=>We(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Gr,n,c,s))return null;let u=Yt(Gr,c);if(Bj(u)==="fallback")return null;if(r){let d=Qj(l,e);if(d.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Gr,pass:!0,exitCode:0}}function C4e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!qte(n,i))return null;let o=n,s=i,a=qj(e,()=>We(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Gr,o,a.proc,s))return null;let c=Yt(Gr,a.proc);if(Bj(c)==="fallback")return null;if(r&&Bte(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Gr,pass:!0,exitCode:0}}function tM(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Xi("test",t))}catch(d){return{stage:Gr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Gr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Ute(n,i),a=qte(n,i),c=r&&s;if(Uj()&&s){let d=P4e(t,e,c);if(d)return d}if(Uj()&&a){let d=C4e(t,e);if(d)return d}let l,u=i;c&&(l=I4e(R4e(),`clad-vitest-${eM.pid}-${T4e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=We(n,[...u],{cwd:e,reject:!1}),f=Nt(Gr,n,d,u);if(f)return f;let p=ju("unit",Yt(Gr,d),d);if(r&&p.pass&&Bte(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Gr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=Qj(l,e);if(m.length>0)return{stage:Gr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{O4e(l)}catch{}}}var D4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${eM.argv[1]}`;if(D4e){let t=tM();console.log(JSON.stringify(t)),eM.exit(t.exitCode)}Lr();cn();Cn();import Hte from"node:process";var t0="stage_3.3";function rM(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:t0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Vl(e,o[o.length-1]))return{stage:t0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=We(i,[...o],{cwd:e,reject:!1}),a=Nt(t0,i,s,o);return a||Yt(t0,s)}var N4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hte.argv[1]}`;if(N4e){let t=rM();console.log(JSON.stringify(t)),Hte.exit(t.exitCode)}SC();Bf();ba();iM();Pp();aS();var Yte=St(er(),1);import{existsSync as oM,readFileSync as Z4e,readdirSync as Jte,statSync as V4e,writeFileSync as W4e}from"node:fs";import{basename as ch,join as lh,relative as Kte}from"node:path";var K4e=["self-dogfood:","fixture:","derived:"],Xte=/\.(test|spec)\.[jt]sx?$/;function Qte(t,e=t,r=[]){let n;try{n=Jte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=lh(e,i);try{V4e(o).isDirectory()?Qte(t,o,r):Xte.test(i)&&r.push(o)}catch{continue}}return r}function ere(t="."){let e=lh(t,"spec","features"),r=lh(t,"tests"),n=[],i=[];if(!oM(e)||!oM(r))return{repaired:n,suggested:i};let o=Qte(r),s=new Map;for(let a of o){let c=Kte(t,a).split("\\").join("/"),l=s.get(ch(a))??[];l.push(c),s.set(ch(a),l)}for(let a of Jte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=lh(e,a),l,u;try{l=Z4e(c,"utf8"),u=(0,Yte.parse)(l)}catch{continue}if(!u||u.status!=="done")continue;let d=!1;for(let h of u.acceptance_criteria??[])for(let g of h.test_refs??[]){if(K4e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(oM(lh(t,b)))continue;let _=s.get(ch(b))??[];if(_.length!==1)continue;let S=g.replace(b,_[0]);S!==g&&l.includes(g)&&(l=l.split(g).join(S),n.push({shard:a,from:g,to:S}),d=!0)}let f=u.slug??"",p=(u.modules??[]).map(h=>ch(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Kte(t,h).split("\\").join("/")).find(h=>{let g=ch(h).replace(Xte,"");return f!==""&&g===f||p.includes(g)});if(m)for(let h of u.acceptance_criteria??[]){if((h.test_refs?.length??0)>0||(h.evidence_refs?.length??0)>0||!h.id)continue;let g=new RegExp(`^(([ ]+)- id: ${h.id}\\b.*)$`,"m"),b=l.match(g);if(!b)continue;let _=b[2]+" ";l=l.replace(g,`$1 ${_}test_refs: -${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&W4e(c,l,"utf8")}return{repaired:n,suggested:i}}xl();import{existsSync as J4e,readFileSync as Y4e}from"node:fs";import{join as X4e}from"node:path";function Q4e(t,e){let r=X4e(t,e);if(!J4e(r))return[];let n=[];for(let i of Y4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function ere(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>Q4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function tre(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` -`)}uS();Ue();un();Pi();un();xl();var sM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],e6e=[...sM,"att"];function t6e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function r6e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":J_(e,r,t).state==="fresh"?"\u2713":"!"}function o0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...sM.map(o=>t6e(i,o,e)),r6e(i,r,e)]}));return{columns:e6e,rows:n}}function rre(t,e=".",r={}){let n=r.internal??!1,i=o0(t,e),o=[...sM.map(c=>n?c.replace("stage_",""):n6e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` -`)}function n6e(t){return Ta(t).slice(0,3)}async function R5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(yde(),gde)),Promise.resolve().then(()=>(wde(),Sde)),Promise.resolve().then(()=>(om(),P7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>ate(s),prepareInit:({cwd:s,mode:a,intent:c})=>ote(s,a,c),initialize:Sj,prepareClarify:(s,{cwd:a})=>ste(a,s),clarify:kj,resolveReview:(s,{cwd:a})=>tte(s,{cwd:a})}});n(i.server);let o=new r;G.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function I5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Sj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){G.stdout.write(`${JSON.stringify(n,null,2)} -`),G.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){G.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&W4e(c,l,"utf8")}return{repaired:n,suggested:i}}xl();import{existsSync as J4e,readFileSync as Y4e}from"node:fs";import{join as X4e}from"node:path";function Q4e(t,e){let r=X4e(t,e);if(!J4e(r))return[];let n=[];for(let i of Y4e(r,"utf8").split(/\r?\n/)){let o=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(o))continue;let s=o.replace(/\s*[{=].*$/s,"").trim();s&&n.push(s)}return n}function tre(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let o=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),s=i.modules??[],a=s.flatMap(c=>Q4e(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:o.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:s,signatures:a,readManifest:[...s.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function rre(t){let e=[];e.push(`# Impl-blind oracle brief \u2014 ${t.featureId}: ${t.featureTitle}`),e.push("#"),e.push("# Author a conformance TEST SUITE from THIS SPECIFICATION ONLY. You have NOT been"),e.push("# shown the implementation and MUST NOT read it. Assert ONLY what the acceptance"),e.push("# criteria literally require; when the spec is silent on an edge, write a WEAKER"),e.push("# assertion, not a stronger guess (an over-strict oracle falsely fails correct code)."),e.push(""),e.push("## Acceptance criteria (the spec)");for(let r of t.acs)e.push(`- ${r.id}${r.ears?` [${r.ears}]`:""}: ${r.text??""}`.trimEnd()),r.condition&&e.push(` when: ${r.condition}`),r.action&&e.push(` system shall: ${r.action}`),r.response&&e.push(` so that: ${r.response}`);e.push(""),e.push("## Public surface to call (signatures only \u2014 NO implementation shown)"),t.signatures.length===0&&e.push(" (no export signatures extracted \u2014 call the API exactly as the criteria describe)");for(let r of t.signatures)e.push(` ${r}`);return e.push(""),e.push("## Write the suite under tests/oracle/ (the dir stage_2.3 runs), then record it with"),e.push("## the clad_author_oracle MCP tool so its impl-blind provenance is gate-verified."),e.join(` +`)}uS();Ue();un();Pi();un();xl();var sM=["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"],e6e=[...sM,"att"];function t6e(t,e,r){if(e.startsWith("stage_4")){let n=fr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Zx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function r6e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":J_(e,r,t).state==="fresh"?"\u2713":"!"}function o0(t,e="."){let r=ls(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...sM.map(o=>t6e(i,o,e)),r6e(i,r,e)]}));return{columns:e6e,rows:n}}function nre(t,e=".",r={}){let n=r.internal??!1,i=o0(t,e),o=[...sM.map(c=>n?c.replace("stage_",""):n6e(c)),"att"],s=n?`feature ${o.join(" ")}`:`feature${" ".repeat(28)}${o.join(" ")}`,a=i.rows.map(c=>{let l=c.cells.join(" ");return n?`${c.featureId.padEnd(12)} ${l} ${c.title}`:`${c.title.padEnd(35).slice(0,35)} ${l}`});return[s,...a].join(` +`)}function n6e(t){return Ta(t).slice(0,3)}async function R5e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(_de(),yde)),Promise.resolve().then(()=>(xde(),wde)),Promise.resolve().then(()=>(om(),C7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>cte(s),prepareInit:({cwd:s,mode:a,intent:c})=>ste(s,a,c),initialize:Sj,prepareClarify:(s,{cwd:a})=>ate(a,s),clarify:kj,resolveReview:(s,{cwd:a})=>rte(s,{cwd:a})}});n(i.server);let o=new r;B.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function I5e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Sj({projectName:e.name,force:e.force,scan:e.scan,noLlm:e.noLlm,roots:e.roots?e.roots.split(",").map(o=>o.trim()).filter(Boolean):void 0,intent:r,withHook:e.withHook,withCi:e.withCi});if(e.json){B.stdout.write(`${JSON.stringify(n,null,2)} +`),B.exit(0);return}for(let o of n.created)L("pass",`created ${o}`);for(let o of n.skipped)L("skip",o);for(let o of n.proposals??[])L("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(L("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){B.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: -`);for(let[o,s]of n.clarifyingQuestions.entries())G.stdout.write(` ${o+1}. ${s} -`);G.stdout.write(` -`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(G.stdout.write(` +`);for(let[o,s]of n.clarifyingQuestions.entries())B.stdout.write(` ${o+1}. ${s} +`);B.stdout.write(` +`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(B.stdout.write(` \u{1F4A1} Tip: for a more precise scaffold, describe the project: -`),G.stdout.write(` clad init -`),G.stdout.write(` e.g. clad init payment SaaS for B2B -`),G.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. - -`));G.exit(0)}async function P5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Vde(),Zde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),G.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>uR(l,s)),c=`${SG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&G.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),G.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function C5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Yl(".",r),Ka("."),W5(".");let n=su(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Qte(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=i0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=dS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),G.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),G.exit(0);return}L("pass","sync",`${e.features.length} features valid`),G.exit(0)}catch(e){L("fail","sync",e.message),G.exit(1)}}function D5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),G.exit(2);return}let e=C_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),G.exit(0)}function N5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),G.exit(2);return}let r=D_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),G.exit(1);return}N_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?G.stdout.write(`Run: git checkout ${r.gitHead} -`):G.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),G.exit(0)}async function j5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await eD({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});G.exit(r.errors.length>0?1:0)}async function M5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await r7(".",{wireHosts:async()=>(await eD({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),G.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);G.stdout.write(` +`),B.stdout.write(` clad init +`),B.stdout.write(` e.g. clad init payment SaaS for B2B +`),B.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. + +`));B.exit(0)}async function P5e(t,e){L("note","run","EXPERIMENTAL \u2014 prefer the host-delegated path (clad serve + your AI host). See docs/feature-cycle.md \xA7 Execution surface.");let{runDriveLoop:r}=await Promise.resolve().then(()=>(Wde(),Vde)),n=await r({cwd:e.cwd,goal:t,budget:{maxIterations:Number(e.maxIterations),maxWallClockMs:Number(e.maxWallClockMs),maxRetriesPerFeature:Number(e.maxRetries)}}),i=n.halt.class==="ALL_FEATURES_DONE"?"pass":"note";if(e.json)L(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),B.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>uR(l,s)),c=`${wG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&B.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),B.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function C5e(t={}){try{let e=q();if(_a("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=bs(".");Yl(".",r),Ja("."),K5(".");let n=su(".");n==="created"?L("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&L("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=ere(".");for(let s of i.repaired)L("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)L("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=i0(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=dS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),B.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);L("note",`propose-archive \xB7 ${s}`,a)}L("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),B.exit(0);return}L("pass","sync",`${e.features.length} features valid`),B.exit(0)}catch(e){L("fail","sync",e.message),B.exit(1)}}function D5e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),B.exit(2);return}let e=C_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),B.exit(0)}function N5e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),B.exit(2);return}let r=D_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),B.exit(1);return}N_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";L("note",`rollback \xB7 ${t}`,`recorded \u2014 run the printed command to apply (cladding does not execute git) \xB7 target head=${n} ts=${r.timestamp}`),r.gitHead?B.stdout.write(`Run: git checkout ${r.gitHead} +`):B.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),B.exit(0)}async function j5e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await eD({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});B.exit(r.errors.length>0?1:0)}async function M5e(){L("note","update","reconciling the current project after the engine upgrade");let t=await n7(".",{wireHosts:async()=>(await eD({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){L("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),B.exit(t.code);return}L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?L("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):L("pass","spec",`inventory synced \xB7 ${t.features} features`),L(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),L(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)L("note","deprecated",r);B.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),IA({tier:"pre-commit",strict:!0}).anyFailed?G.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),G.exit(t.code)}var F5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function IA(t){let e=t.tier??"all",r=t.silent===!0,n=F5e[e];if(!n)return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>sh(i)],["stage_1.2",()=>oh(i)],["stage_1.3",()=>si({...i,strict:t.strict})],["stage_1.4",Hj],["stage_1.5",nc],["stage_1.6",Qp],["stage_2.1",()=>tM({...i,strict:t.strict})],["stage_2.2",()=>Gj(i)],["stage_2.3",_C],["stage_2.4",Kj],["stage_3.1",Jj],["stage_3.2",Vj],["stage_3.3",rM],["stage_4.1",Lj],["stage_4.2",ah]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":li(d)?"fail":"skip",u=[];Y_("."),Ete(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=BX(p);li(h)&&(c=!0,a=Math.max(a,HX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),li(h)&&Z5e(p))}}finally{Q_(),Tte()}if(t.strict)try{let d=q();for(let f of $te(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!li(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>li(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{GG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?G.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&G.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function L5e(t){try{let e=q(),r=hl(e,t);G.stdout.write(`${JSON.stringify(r,null,2)} -`),G.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),G.exit(1)}}function z5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});G.stdout.write(`${JSON.stringify(i,null,2)} -`),G.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),G.exit(1)}}function U5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=yS(e,o=>{try{return Kde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});G.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),G.exit(0)}catch(e){L("fail","infer-deps",e.message),G.exit(1)}}function q5e(t={}){try{if(t.sessions){ute(t);return}if(t.trend!==void 0&&t.trend!==!1){dte(t);return}let e=q(),n=zH(e,o=>{try{return Kde(o,"utf8")}catch{return null}},"."),i=qH(".",n);if(t.json)G.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${gl}`];G.stdout.write(`${c.join(` +`),IA({tier:"pre-commit",strict:!0}).anyFailed?B.stdout.write("\n\u2139 The findings above are the bar this upgrade raised \u2014 not a failed update. Reconcile them in YOUR spec when ready (`clad check --strict` for the full gate).\n"):L("pass","drift","clean against the stricter detectors"),B.exit(t.code)}var F5e={"pre-commit":["stage_1.3","stage_1.5","stage_1.6"],"pre-push":["stage_1.1","stage_1.2","stage_1.3","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4"],all:["stage_1.1","stage_1.2","stage_1.3","stage_1.4","stage_1.5","stage_1.6","stage_2.1","stage_2.2","stage_2.3","stage_2.4","stage_3.1","stage_3.2","stage_3.3","stage_4.1","stage_4.2"]};function IA(t){let e=t.tier??"all",r=t.silent===!0,n=F5e[e];if(!n)return t.json&&!r?B.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||L("fail","check",`unknown --tier '${e}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};let i={focusModules:t.focusModules},s=[["stage_1.1",()=>sh(i)],["stage_1.2",()=>oh(i)],["stage_1.3",()=>si({...i,strict:t.strict})],["stage_1.4",Hj],["stage_1.5",ic],["stage_1.6",Qp],["stage_2.1",()=>tM({...i,strict:t.strict})],["stage_2.2",()=>Gj(i)],["stage_2.3",_C],["stage_2.4",Kj],["stage_3.1",Jj],["stage_3.2",Vj],["stage_3.3",rM],["stage_4.1",Lj],["stage_4.2",ah]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":li(d)?"fail":"skip",u=[];Y_("."),Ate(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=HX(p);li(h)&&(c=!0,a=Math.max(a,GX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(L(l(h),m),li(h)&&Z5e(p))}}finally{Q_(),Ote()}if(t.strict)try{let d=q();for(let f of kte(d,u))a=Math.max(a,1),c=!0,u.push({stage:f.stage,label:f.label,status:"fail",exitCode:1,stderr:f.message}),!t.json&&!r&&L("fail",f.label,f.message)}catch{}if(t.strict&&(e==="pre-push"||e==="all")){let d=u.find(h=>h.stage==="stage_1.3"),f=(d?.findings??[]).filter(h=>h.severity==="error"||h.severity==="warn"),p=d?.status==="fail"&&f.length>0&&f.every(h=>h.detector==="STALE_ATTESTATION"),m=u.every(h=>h.stage==="stage_1.3"||!li(h.status));if(p&&m&&d&&(d.status="pass",d.exitCode=0,d.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",c=u.some(h=>li(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&L("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(_a("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{ZG(".",q())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?B.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&B.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to check the spec. The findings above say what drifted and why.\n"),tr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function L5e(t){try{let e=q(),r=gl(e,t);B.stdout.write(`${JSON.stringify(r,null,2)} +`),B.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),B.exit(1)}}function z5e(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=Sr(r,t,{depth:n});B.stdout.write(`${JSON.stringify(i,null,2)} +`),B.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),B.exit(1)}}function U5e(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=yS(e,o=>{try{return Kde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});B.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),B.exit(0)}catch(e){L("fail","infer-deps",e.message),B.exit(1)}}function q5e(t={}){try{if(t.sessions){dte(t);return}if(t.trend!==void 0&&t.trend!==!1){fte(t);return}let e=q(),n=UH(e,o=>{try{return Kde(o,"utf8")}catch{return null}},"."),i=BH(".",n);if(t.json)B.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let o=n.context,s=o.truncatedCount>0?`budget enforces ${o.medianShrinkTruncated}x on ${o.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=o.fitsCount>0?`${o.medianShrinkFit}x on ${o.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${o.medianSliceTokens} tok vs naive ${o.medianNaiveTokens} tok \u2014 ${s}, ${a}`,` uncapped structural slice = ${o.medianStructuralRatio}x of naive \u2014 the value is the guaranteed budget + wired needs/breaks/verify, not raw shrink`,` search: median ${n.search.medianDepth} hop(s) resolved (p95 ${n.search.p95Depth}), median ${n.search.medianEdges} edge(s)/feature (max hub ${n.search.maxEdges})`,` stability: median blast-radius coverage ${n.stability.medianCoverage}, median ${n.stability.medianRegressionTests} regression test(s) surfaced; stops ${JSON.stringify(n.stability.byStopReason)}`,` ${yl}`];B.stdout.write(`${c.join(` `)} -`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}G.exit(0)}catch(e){L("fail","measure",e.message),G.exit(1)}}function B5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),G.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),G.exit(1)}let r=IA({...t,focusModules:e});if(!t.json){let n=xX(".");n&&G.stdout.write(`\u2139 ${n} -`)}G.exitCode=r.worst}function H5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=pX(".",t,{checkStages:IA,onIndex:Ka,gitOpInProgress:PO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}G.exit(r.code)}function G5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),G.exit(1);return}if(e.required){t&&G.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=Q5(n);if(o.length===0){G.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. -`),G.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";G.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} -`)}G.stdout.write(` +`),i.appended?L("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?L("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&L("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}B.exit(0)}catch(e){L("fail","measure",e.message),B.exit(1)}}function B5e(t){let e;if(t.feature)try{let i=(q().features??[]).find(o=>o.id===t.feature||o.slug===t.feature);i||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),B.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),B.exit(1)}let r=IA({...t,focusModules:e});if(!t.json){let n=$X(".");n&&B.stdout.write(`\u2139 ${n} +`)}B.exitCode=r.worst}function H5e(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:fr(".")}}catch{e=void 0}let r=mX(".",t,{checkStages:IA,onIndex:Ja,gitOpInProgress:PO,independence:e});if(L(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence){let n=r.independence==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";L("note",`done \xB7 ${t}`,n)}B.exit(r.code)}function G5e(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),B.exit(1);return}if(e.required){t&&B.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=eY(n);if(o.length===0){B.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),B.exit(0);return}let s=o.filter(a=>!a.hasOracle);for(let a of o){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";B.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}B.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),G.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),G.exit(1);return}let i=ere(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),G.exit(1);return}G.stdout.write(`${tre(i)} -`),G.exit(0)}function Z5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=Wde(Sl(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";G.stdout.write(` ${o}${s} [${i.detector}] -`)}n.length>3&&G.stdout.write(` \u2026 and ${n.length-3} more finding(s) -`),t.hint&&G.stdout.write(` fix: run \`${t.hint}\` +`),B.exit(s.length>0?1:0);return}if(!t){L("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),B.exit(1);return}let i=tre(n,t,e.ac,r);if(!i||i.acs.length===0){L("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),B.exit(1);return}B.stdout.write(`${rre(i)} +`),B.exit(0)}function Z5e(t){if(t.findings&&t.findings.length>0){let e=t.findings.filter(i=>i.severity==="error"),r=t.findings.filter(i=>i.severity==="warn"),n=e.length>0?e:r;for(let i of n.slice(0,3)){let o=y4(Oa(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(B.stdout.write(` ${o}${s} [${i.detector}] +`),Oa(i.detector,i.message)!==i.message){let c=i.message.split(` +`).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))B.stdout.write(` ${y4(l,160)} +`);c.length>4&&B.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` +`)}}n.length>3&&B.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),t.hint&&B.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&G.stdout.write(` ${Wde(e.trim(),160)} -`)}}function Wde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function V5e(t){let e=q();if(t.json){G.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} -`),G.exitCode=0;return}G.stdout.write(`${rre(e,".",{internal:t.internal})} -`),G.exit(0)}function W5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),G.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=bl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:yl(u),auditMarkdown:_l(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=DG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),G.exit(1);return}try{O5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),G.exit(1);return}L("pass","bundle",`${r} \xB7 ${W5e(Buffer.byteLength(n,"utf8"))}`),G.exit(0)}function J5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),G.exit(e==="unknown"?1:0)}function Y5e(){let t=new R4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(I5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(P5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(C5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(j5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(M5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(B5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(D5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(H5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>G5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(N5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(V5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(L5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>z5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>YX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>U5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>q5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>Ste(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>wte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{xte(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>vG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>DY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>K5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(J5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(qX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(R5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){lX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}MY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ite),t}var X5e=!!globalThis.__CLADDING_BUNDLED,Q5e=X5e||import.meta.url===`file://${G.argv[1]}`;Q5e&&Y5e().parse();export{F5e as TIER_STAGES,Y5e as createProgram,K5e as runBundleCommand,B5e as runCheckCommand,IA as runCheckStages,D5e as runCheckpointCommand,L5e as runContextCommand,H5e as runDoneCommand,z5e as runImpactCommand,U5e as runInferDepsCommand,I5e as runInitCommand,q5e as runMeasureCommand,G5e as runOracleCommand,N5e as runRollbackCommand,J5e as runRouteCommand,P5e as runRunCommand,R5e as runServeCommand,j5e as runSetupCommand,V5e as runStatusCommand,C5e as runSyncCommand,M5e as runUpdateCommand}; +`).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))B.stdout.write(` ${y4(r,160)} +`);e.length>5&&B.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` +`)}}function y4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function V5e(t){let e=q();if(t.json){B.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} +`),B.exitCode=0;return}B.stdout.write(`${nre(e,".",{internal:t.internal})} +`),B.exit(0)}function W5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),B.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=vl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:_l(u),auditMarkdown:bl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=NG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),B.exit(1);return}try{O5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),B.exit(1);return}L("pass","bundle",`${r} \xB7 ${W5e(Buffer.byteLength(n,"utf8"))}`),B.exit(0)}function J5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),B.exit(e==="unknown"?1:0)}function Y5e(){let t=new I4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(I5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(P5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(C5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(j5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(M5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(B5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(D5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(H5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>G5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(N5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(V5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(L5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>z5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>XX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>U5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>q5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>wte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>xte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{$te(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>SG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>NY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>K5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(J5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(BX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(R5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){uX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}FY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ote),t}var X5e=!!globalThis.__CLADDING_BUNDLED,Q5e=X5e||import.meta.url===`file://${B.argv[1]}`;Q5e&&Y5e().parse();export{F5e as TIER_STAGES,Y5e as createProgram,K5e as runBundleCommand,B5e as runCheckCommand,IA as runCheckStages,D5e as runCheckpointCommand,L5e as runContextCommand,H5e as runDoneCommand,z5e as runImpactCommand,U5e as runInferDepsCommand,I5e as runInitCommand,q5e as runMeasureCommand,G5e as runOracleCommand,N5e as runRollbackCommand,J5e as runRouteCommand,P5e as runRunCommand,R5e as runServeCommand,j5e as runSetupCommand,V5e as runStatusCommand,C5e as runSyncCommand,M5e as runUpdateCommand}; diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 3c71667e..8c3d5206 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -20,12 +20,12 @@ attested_modules: CHANGELOG.md: a67e4c092a7223c1 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 4b53ba35d39fde31 - README.ja.md: f30039ac322e6de1 - README.ko.html: 7b0a16975efaaeef - README.ko.md: f3eafbdb44038429 - README.md: 8aea451e838a6330 - README.zh.md: caa962e802af7681 + README.html: 0f4f9d52bca2e782 + README.ja.md: e0714533e64683d0 + README.ko.html: fe80f8363ff2c820 + README.ko.md: 079fc16a7a5b125f + README.md: 8fb8a73f601fe8a9 + README.zh.md: fc8d390a0d0a1aee SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -150,7 +150,7 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: 3906f5320f1e6d13 + src/cli/clad.ts: cc75609f5b7633a4 src/cli/clarify.ts: f17177969d5b75ff src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 src/cli/doctor.ts: b98b955fe75e7f7e @@ -207,7 +207,7 @@ attested_modules: src/hitl/audit.ts: 79b06e904815469a src/hitl/identity.ts: 52ff84aa666f1dab src/hitl/independence.ts: 202f4e5ef8bc69e3 - src/init/agents-md.ts: 698b2a38ddd5d1a6 + src/init/agents-md.ts: c0f853ca09b75670 src/init/git-hook.ts: b77910b0df392cbf src/init/host-instructions.ts: c598f8598d8d1cd4 src/init/host-setup.ts: 158cc9306a746da1 @@ -327,7 +327,7 @@ attested_modules: src/stages/types.ts: 95e8c9e13187d85b src/stages/uat.ts: 62ec3e37a124f8c5 src/stages/unit.ts: b503350b0e5c7e5a - src/stages/util.ts: a024afe34884d653 + src/stages/util.ts: 7c49de3250816de8 src/stages/vacuous-tests.ts: 8e71b81e151325af src/stages/visual.ts: 2b60dd991fa8124e src/ui: a4d0f0eb87fed960 @@ -431,7 +431,7 @@ attested_modules: tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 tests/stages/unmapped-artifact.test.ts: 6bfdae66990fd63a - tests/stages/util.test.ts: dd95144b36bfd2b1 + tests/stages/util.test.ts: a162cbe069c85f41 tests/stages/visual.test.ts: dd819e7d25586b92 tests/ui/panel.test.ts: ad9ea207f34b1c51 tests/ui/pulse.test.ts: 30f1d091de9093ad diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 7df73663..686cf3e0 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -952,6 +952,20 @@ function printStageDetails( const lead = truncate(plainLead(f.detector, f.message), 140); const where = f.path ? ` — ${f.path}` : ''; process.stdout.write(` ${lead}${where} [${f.detector}]\n`); + // The plain lead names the KIND of problem; when it replaced a message + // that carried the specifics, print those too. Without this a developer + // is told "there is an import loop" and never which files form it — the + // gap that cost a real adopter sixteen days and a wrong root cause. + const spoken = plainLead(f.detector, f.message); + if (spoken !== f.message) { + const detail = f.message.split('\n').map((l) => l.trim()).filter((l) => l.length > 0); + for (const line of detail.slice(0, 4)) { + process.stdout.write(` ${truncate(line, 160)}\n`); + } + if (detail.length > 4) { + process.stdout.write(` … and ${detail.length - 4} more line(s) — see \`clad check --json\`\n`); + } + } } if (surface.length > 3) { process.stdout.write(` … and ${surface.length - 3} more finding(s)\n`); @@ -961,9 +975,15 @@ function printStageDetails( return; } if (r.stderr && r.stderr.trim().length > 0) { - const first = r.stderr.split('\n').find((l) => l.trim().length > 0); - if (first) { - process.stdout.write(` ${truncate(first.trim(), 160)}\n`); + // A tool's diagnostic is a LIST — cycles, type errors, lint hits — and one + // line of it is not actionable. Show the head of the list, not its first + // line, and point at --json for the rest. + const lines = r.stderr.split('\n').map((l) => l.trim()).filter((l) => l.length > 0); + for (const line of lines.slice(0, 5)) { + process.stdout.write(` ${truncate(line, 160)}\n`); + } + if (lines.length > 5) { + process.stdout.write(` … and ${lines.length - 5} more line(s) — see \`clad check --json\`\n`); } } } diff --git a/src/init/agents-md.ts b/src/init/agents-md.ts index e18d3e0a..36d8a2b7 100644 --- a/src/init/agents-md.ts +++ b/src/init/agents-md.ts @@ -153,6 +153,23 @@ export function renderAgentsMdManagedBlock(spec: Spec | null, cwd: string = '.') 'GREEN). Package test scripts must not depend on shell-expanded glob patterns. Do not', 'author spec entries ahead of their code, or hand-write `status: done`.', '', + '## Writing an acceptance criterion', + '', + 'Each criterion may declare an `ears` pattern. When it does, its `condition` must open', + 'with that pattern\'s trigger word — the gate rejects the entry otherwise:', + '', + '| `ears` | `condition` must | example |', + '|---|---|---|', + '| `ubiquitous` | be omitted — the rule always holds | *(none)* |', + '| `event` | start with **when** | `when the upload completes` |', + '| `state` | start with **while** | `while the queue is draining` |', + '| `optional` | start with **where** | `where telemetry is enabled` |', + '| `unwanted` | start with **if** | `if the checksum does not match` |', + '| `complex` | start with **while** and also contain a **when** clause | `while offline, when a retry fires` |', + '', + 'Write the obligation in `text`, or in the `action` / `response` fields — both are read', + 'as the requirement. Put the reasoning in `notes`; it is free prose and nothing parses it.', + '', '## Design evolves with each feature', '', 'Before implementation, classify the feature as: no design impact, an additive', diff --git a/src/stages/util.ts b/src/stages/util.ts index b0fec62d..2a45968c 100644 --- a/src/stages/util.ts +++ b/src/stages/util.ts @@ -65,7 +65,14 @@ export function classifyScannerExit( if (exitCode === 0) return []; const stderr = (proc.stderr ?? '').toString().trim(); const stdout = (proc.stdout ?? '').toString().trim(); - const detail = (stderr || stdout || `exit ${exitCode}`).slice(0, 200); + // BOTH streams, report first. Scanners print their findings to stdout and + // their progress to stderr — madge writes "- Finding files" to stderr and the + // numbered cycle list to stdout — so taking stderr first handed the developer + // a progress line and threw the answer away. A real adopter spent sixteen + // days on that and recorded the wrong cause. The budget is generous because + // the whole point is the list: one cycle per line, and a truncated list is a + // half-answer that still cannot be acted on. + const detail = [stdout, stderr].filter((s) => s.length > 0).join('\n').slice(0, 2000) || `exit ${exitCode}`; if (SCANNER_SETUP_FAILURE.test(stderr) || SCANNER_SETUP_FAILURE.test(stdout)) { return [{detector, severity: 'info', message: skippedMsg(detail)}]; } @@ -136,8 +143,11 @@ export function missingToolSkip( * only ever mean "skipped". Routing every command stage through here makes that * invariant structural rather than per-stage discipline. * - * Diagnostics: surfaces stderr, falling back to stdout — `tsc` writes its - * diagnostics to stdout, not stderr, so a failing gate still shows WHY. + * Diagnostics: BOTH streams, report first. `tsc` writes its diagnostics to + * stdout; madge writes its cycle list to stdout and only its progress to + * stderr. Preferring stderr therefore surfaced "Processed 9 files (259ms)" and + * discarded the answer — the gap that left a real adopter unable to tell WHICH + * files formed the loop. * * @param stage - Ironclad stage id for the result. * @param proc - The value returned by `execaSync(…, {reject: false})`. @@ -148,7 +158,9 @@ export function ranToolResult( ): StageResult { const ran = proc.exitCode ?? 1; if (ran === 0) return {stage, pass: true, exitCode: 0}; - const detail = String(proc.stderr ?? '').trim() || String(proc.stdout ?? '').trim(); + const detail = [String(proc.stdout ?? '').trim(), String(proc.stderr ?? '').trim()] + .filter((s) => s.length > 0) + .join('\n'); return detail ? {stage, pass: false, exitCode: 1, stderr: detail} : {stage, pass: false, exitCode: 1}; diff --git a/tests/init/agents-md.test.ts b/tests/init/agents-md.test.ts index eb545f17..db21a5a7 100644 --- a/tests/init/agents-md.test.ts +++ b/tests/init/agents-md.test.ts @@ -27,6 +27,8 @@ import { writeSpecDrivenAgentsMd, } from '../../src/init/agents-md.js'; import {loadSpec} from '../../src/spec/load.js'; +import {checkEarsShape} from '../../src/spec/ears.js'; +import type {EarsPattern} from '../../src/spec/types.js'; /** A spec.yaml with a fully-populated project.ai_hints, matching the shard's * own notes fixture (acme-payments) so assertions read naturally. */ @@ -318,3 +320,32 @@ describe('writeSpecDrivenAgentsMd — AC-1f8d7b02 (markerless / hand-authored fi expect(upsertAgentsMdBlock(malformed, 'fresh block')).toBe(malformed); }); }); + +describe('the managed block teaches EARS, and cannot drift from the validator', () => { + test('every example in the EARS table actually passes checkEarsShape', () => { + // The adopter receives no docs/ — package.json#files ships none — so this + // table is the only place an authoring agent can learn the rules. Two of + // three agents in an A/B run reverse-engineered them from the minified + // bundle instead. A table that drifts from the validator is worse than + // none, so it is checked against the validator rather than eyeballed. + const block = renderAgentsMdManagedBlock(null, '.'); + const rows = block + .split('\n') + .filter((l) => /^\| `(ubiquitous|event|state|optional|unwanted|complex)` \|/.test(l)); + expect(rows.length, 'the EARS table is missing from the managed block').toBe(6); + + for (const row of rows) { + const cells = row.split('|').map((c) => c.trim()); + const pattern = cells[1].replace(/`/g, '') as EarsPattern; + const example = cells[3].replace(/`/g, '').replace(/\*\(none\)\*/, '').trim(); + expect(checkEarsShape(pattern, example), `${pattern}: "${example}"`).toBeNull(); + } + }); + + test('the table covers every pattern the schema accepts', () => { + const block = renderAgentsMdManagedBlock(null, '.'); + for (const pattern of ['ubiquitous', 'event', 'state', 'optional', 'unwanted', 'complex']) { + expect(block, `${pattern} is missing from the EARS table`).toContain(`| \`${pattern}\` |`); + } + }); +}); diff --git a/tests/stages/util.test.ts b/tests/stages/util.test.ts index c957a48f..9623d657 100644 --- a/tests/stages/util.test.ts +++ b/tests/stages/util.test.ts @@ -52,9 +52,22 @@ describe('ranToolResult — ran-tool exit code → stage contract', () => { expect(r.stderr).toContain('TS2322'); // tsc writes to stdout; gate must still show WHY }); - test('stderr wins over stdout when both present', () => { + test('BOTH streams survive, report first — neither displaces the other', () => { + // Previously stderr won outright, which discarded madge's cycle list + // (stdout) in favour of its progress line (stderr) and left the developer + // unable to see WHICH files formed the loop. const r = ranToolResult('stage_x', {exitCode: 1, stdout: 'out', stderr: 'err'}); - expect(r.stderr).toBe('err'); + expect(r.stderr).toBe('out\nerr'); + }); + + test("a scanner's report is not lost behind its progress line", () => { + const r = ranToolResult('stage_1.5', { + exitCode: 1, + stderr: '- Finding files\n✖ Found 2 circular dependencies!', + stdout: 'Processed 9 files (203ms)\n\n1) src/a.ts > src/b.ts\n2) src/c.ts > src/d.ts', + }); + expect(r.stderr).toContain('src/a.ts > src/b.ts'); + expect(r.stderr).toContain('src/c.ts > src/d.ts'); }); test('fail with no output → no stderr field', () => { @@ -152,6 +165,41 @@ describe('classifyScannerExit — finding vs config/setup gap', () => { expect(out[0].severity).toBe('info'); }); + test('the scanner REPORT survives — a progress line on stderr must not displace it', () => { + // madge writes its progress to stderr and its cycle list to stdout. Taking + // stderr first left the developer with "- Finding files" and no idea WHICH + // files form the loop — the whole reason a real adopter spent sixteen days + // on it and recorded the wrong cause. + const out = classifyScannerExit( + { + exitCode: 1, + stderr: '- Finding files\nProcessed 209 files (970ms)', + stdout: '✖ Found 2 circular dependencies!\n1) src/a.ts > src/b.ts\n2) src/c.ts > src/d.ts', + }, + 'ARCHITECTURE_VIOLATION', found, skipped, + ); + expect(out[0].severity).toBe('error'); + expect(out[0].message).toContain('src/a.ts > src/b.ts'); + expect(out[0].message).toContain('src/c.ts > src/d.ts'); + }); + + test('a long report is not cut off after the first cycle or two', () => { + const cycles = Array.from({length: 12}, (_, i) => `${i + 1}) src/very/deeply/nested/module-${i}.ts > src/other/deeply/nested/partner-${i}.ts`); + const out = classifyScannerExit( + {exitCode: 1, stdout: `✖ Found 12 circular dependencies!\n${cycles.join('\n')}`}, + 'ARCHITECTURE_VIOLATION', found, skipped, + ); + expect(out[0].message).toContain('module-11.ts'); + }); + + test('stderr still carries the detail when the scanner says nothing on stdout', () => { + const out = classifyScannerExit( + {exitCode: 1, stderr: 'eslint: Unexpected token in src/x.ts'}, + 'LINT', found, skipped, + ); + expect(out[0].message).toContain('Unexpected token in src/x.ts'); + }); + test('a REAL finding (no setup-error pattern) → ERROR (blocks the gate)', () => { const out = classifyScannerExit( {exitCode: 1, stdout: 'src/leak.ts:1:1 found AWS secret AKIAIOSFODNN7EXAMPLE'}, From 389a170c8afebce0f13c1bd4816d0c83b482f515 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 4 Aug 2026 00:15:41 +0900 Subject: [PATCH 7/8] docs(init): say what language a spec entry is written in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing in cladding answered this, so four adopter projects answered it four different ways: two reached ~100% Korean titles, two stayed fully English. The existing guidance is about something else — "speak the user's language" governs how findings are REPORTED, and the English-only catalog governs cladding's own strings. What a user's spec entry should say was never addressed. The rule now shipped, in the managed AGENTS.md block: English by default. If the spec already has entries, match the language THOSE use. Where they disagree, English. The corpus is the source of truth rather than a setting, for two reasons. A setting has to be maintained and can contradict the file it describes; entries already written cannot. And reading the language off whoever happens to be talking makes a repository change voice with its contributors — a project that speaks Korean should keep speaking Korean when an English-speaking colleague adds a feature. Asking for another language covers `title`, `notes` and `text`, and needs no storage: the next entry follows the corpus rule on its own. Switching applies to new entries only — existing ones are the project's own words and the tool does not rewrite them. Four words stay English: `when`, `while`, `if`, `where`. Not a field-level rule — only the FIRST word of a `condition` is constrained, so `when 앱이 종료될 때` is valid, and `title`/`notes`/`text` have no validation at all. They are fixed because the gate matches them literally and EARS is a published notation; the same reason a language does not translate `if`. Landed in the AGENTS.md block rather than the CLAUDE.md one (21 characters of headroom against a ceiling asserted in three places) or a persona prompt (3 characters, and it reaches only hosts that install the plugin). AGENTS.md is generated into every adopter repository and read by the agent that writes the spec. Guard tests assert each rule against the rendered block, including the mixed-language example — a reader who cannot see that only the trigger is fixed will over- or under-translate. Mutation-checked: replacing the corpus rule with "whatever language the user speaks", or dropping the example, each fails. Verified outside the repo: tarball built in a clean clone, installed into an empty project, and `clad update` run against real adopter clones. Both receive the rules, and applying them by hand yields Korean for the Korean corpus and English for the English one, with zero non-English triggers in either. 2815 tests green, `clad check --tier=pre-push --strict` exits 0. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 9 +++++++ README.html | 4 +-- README.ja.md | 4 +-- README.ko.html | 4 +-- README.ko.md | 4 +-- README.md | 4 +-- README.zh.md | 4 +-- plugins/claude-code/dist/clad.js | 2 +- spec/attestation.yaml | 16 ++++++------ src/init/agents-md.ts | 22 ++++++++++++++++ tests/init/agents-md.test.ts | 44 ++++++++++++++++++++++++++++++++ 11 files changed, 96 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 004d9ae0..cede7064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,15 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). the plain sentence instead of replacing them with it. An adopter spent sixteen days on this and recorded the wrong cause; in a controlled run, three of three agents given the old build "fixed" it by deleting or rewriting their own build output. +- **Nothing said what language to write a spec entry in.** Four adopter projects diverged on + their own — two reached nearly all Korean titles, two stayed fully English — because the + question was never answered anywhere. The managed AGENTS.md block now answers it: English by + default, but match the entries already in the spec, because those are the project's own voice + and they cannot go stale the way a setting can. Asking for another language covers the title, + the notes and the statement, and carries forward on its own; existing entries are never + rewritten into another language. Only four words are fixed — `when`, `while`, `if`, `where` — + because the gate matches them literally, and only as the FIRST word of a condition, so + `when 앱이 종료될 때` is valid. - **Nothing shipped to an adopter said how to write an acceptance criterion.** The managed AGENTS.md block now carries the EARS table — which trigger word each pattern requires, with a working example per row — and a test asserts every example in it against the real validator, diff --git a/README.html b/README.html index 76b58930..5eeef3c2 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -566,7 +566,7 @@

Status

tests
-
2809/2809
+
2815/2815
all pass
diff --git a/README.ja.md b/README.ja.md index d555cd28..4bebc680 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 | 15 段階 · 41 detectors | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 段階 · 41 detectors | 273(269 done) | 249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 6254e53d..7ea5ea61 100644 --- a/README.ko.html +++ b/README.ko.html @@ -277,7 +277,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -600,7 +600,7 @@

Status

tests
-
2809/2809
+
2815/2815
all pass
diff --git a/README.ko.md b/README.ko.md index b197ee18..3bf173cf 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | +| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | 249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index ea72e520..7f164d8f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 | 15 stages · 41 detectors | 273 (269 done) | +| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 stages · 41 detectors | 273 (269 done) | 249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 5acca3d8..1ad38690 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2809 / 2809 | 15 阶段 · 41 检测器 | 273(269 done) | +| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 阶段 · 41 检测器 | 273(269 done) | 249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 347d1d24..81956da4 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -704,7 +704,7 @@ ${r.join(` ${n} `:` `,a=gNe.map(([l,u])=>`- ${l} \u2014 ${u}`).join(` -`),c=i?` The default persona for this project is **${i}**.`:"";return["This project is managed by **cladding** \u2014 the Spec-Anchored Agent Harness.","The lines between the `clad:agents-md` markers are generated from `spec.yaml`; edit the spec, not them. Everything OUTSIDE the markers is yours to keep.","",o,s.replace(/\n$/,""),"","## Single source of truth","","- `spec.yaml` is authoritative (Tier A); code must conform to its `features[]` and"," `acceptance_criteria`. Feature detail lives in `spec/features/-.yaml` \u2014"," never hand-author `F-NNN` filenames; ask cladding via the `clad` CLI (or"," `clad_create_feature` when your host has cladding wired as an MCP server).","- For shell commands, use `node .cladding/host/serve.cjs ` when that"," project launcher exists; it pins the CLI to the same engine as MCP. Fall back to"," `clad ` only when the project has no launcher.","- Run the resolved Cladding command with `check --strict` to verify spec \u2194 code"," across every drift detector.",bNe(e).replace(/\n$/,""),"","## Feature cycle \u2014 one at a time","","Finish ONE feature end-to-end before the next: author its spec entry (`acceptance_criteria`","+ `modules`) \u2192 implement \u2192 author tests in a separate context \u2192 run the declared test","command and confirm it collected relevant tests \u2192 run the resolved Cladding command","with `done ` (sets `status: done` only when the strict pre-push gate is","GREEN). Package test scripts must not depend on shell-expanded glob patterns. Do not","author spec entries ahead of their code, or hand-write `status: done`.","","## Writing an acceptance criterion","","Each criterion may declare an `ears` pattern. When it does, its `condition` must open","with that pattern's trigger word \u2014 the gate rejects the entry otherwise:","","| `ears` | `condition` must | example |","|---|---|---|","| `ubiquitous` | be omitted \u2014 the rule always holds | *(none)* |","| `event` | start with **when** | `when the upload completes` |","| `state` | start with **while** | `while the queue is draining` |","| `optional` | start with **where** | `where telemetry is enabled` |","| `unwanted` | start with **if** | `if the checksum does not match` |","| `complex` | start with **while** and also contain a **when** clause | `while offline, when a retry fires` |","","Write the obligation in `text`, or in the `action` / `response` fields \u2014 both are read","as the requirement. Put the reasoning in `notes`; it is free prose and nothing parses it.","","## Design evolves with each feature","","Before implementation, classify the feature as: no design impact, an additive","capability/scenario link, or a structural change. Apply deterministic links directly;","preview architecture or project-context changes for the user. Do not finish a feature","while a material design impact remains unresolved, and do not churn design documents","for internal fixes that genuinely have no design impact.",_Ne(t).replace(/\n$/,""),"","## Personas \u2014 cross-host capability map (anti-self-cert)","",`The agent that writes a unit of work must not sign off on it.${c} Each`,"persona and the vendor-neutral capabilities it may use \u2014 so Codex, Gemini, and other","AGENTS.md readers receive the same guidance Claude does:","",a,"","These briefs are manuals for cladding's touchpoints, not a roster of permitted agents: any host agent may take up any of them, and an agent that never touches a cladding surface needs none. The gates judge a result the same way whoever produced it \u2014 the one thing tied to identity is the independence label, which records whether the verifier was independent of the author, never which brief (if any) an agent wore.","","## Speak the user's language","","Translate cladding's vocabulary into plain words in the user's own language when you","report progress \u2014 relay gate/hook messages by meaning, and never lead with an internal","id (`F-\u2026`, `AC-\u2026`, `stage_X.Y`): name the feature and the plain outcome instead."].join(` +`),c=i?` The default persona for this project is **${i}**.`:"";return["This project is managed by **cladding** \u2014 the Spec-Anchored Agent Harness.","The lines between the `clad:agents-md` markers are generated from `spec.yaml`; edit the spec, not them. Everything OUTSIDE the markers is yours to keep.","",o,s.replace(/\n$/,""),"","## Single source of truth","","- `spec.yaml` is authoritative (Tier A); code must conform to its `features[]` and"," `acceptance_criteria`. Feature detail lives in `spec/features/-.yaml` \u2014"," never hand-author `F-NNN` filenames; ask cladding via the `clad` CLI (or"," `clad_create_feature` when your host has cladding wired as an MCP server).","- For shell commands, use `node .cladding/host/serve.cjs ` when that"," project launcher exists; it pins the CLI to the same engine as MCP. Fall back to"," `clad ` only when the project has no launcher.","- Run the resolved Cladding command with `check --strict` to verify spec \u2194 code"," across every drift detector.",bNe(e).replace(/\n$/,""),"","## Feature cycle \u2014 one at a time","","Finish ONE feature end-to-end before the next: author its spec entry (`acceptance_criteria`","+ `modules`) \u2192 implement \u2192 author tests in a separate context \u2192 run the declared test","command and confirm it collected relevant tests \u2192 run the resolved Cladding command","with `done ` (sets `status: done` only when the strict pre-push gate is","GREEN). Package test scripts must not depend on shell-expanded glob patterns. Do not","author spec entries ahead of their code, or hand-write `status: done`.","","## Writing an acceptance criterion","","Each criterion may declare an `ears` pattern. When it does, its `condition` must open","with that pattern's trigger word \u2014 the gate rejects the entry otherwise:","","| `ears` | `condition` must | example |","|---|---|---|","| `ubiquitous` | be omitted \u2014 the rule always holds | *(none)* |","| `event` | start with **when** | `when the upload completes` |","| `state` | start with **while** | `while the queue is draining` |","| `optional` | start with **where** | `where telemetry is enabled` |","| `unwanted` | start with **if** | `if the checksum does not match` |","| `complex` | start with **while** and also contain a **when** clause | `while offline, when a retry fires` |","","Write the obligation in `text`, or in the `action` / `response` fields \u2014 both are read","as the requirement. Put the reasoning in `notes`; it is free prose and nothing parses it.","","## What language to write a spec entry in","","Default to English. If the spec already has entries, match the language THEY use \u2014 the","entries already written are the answer, so nothing needs configuring and nothing can go","stale. Where they disagree, write English. This keeps one repository speaking with one","voice no matter who is at the keyboard; it is a property of the project, not of whoever","you are talking to right now.","","If the user asks for another language, write `title`, `notes` and `text` in it. The next","entry then follows by the rule above, so a one-time request carries forward on its own.","Switching language applies to NEW entries; never rewrite existing ones into another","language \u2014 those are the project's own words.","","Four words stay English wherever they appear, because the gate matches them literally and","EARS is a published notation: **when**, **while**, **if**, **where**. Only the FIRST word","of a `condition` is constrained \u2014 the rest of the sentence is yours:","",' condition: "when the app exits" \xB7 condition: "when \uC571\uC774 \uC885\uB8CC\uB420 \uB54C"',"","Identifiers are not prose and are never translated: feature and criterion ids, the `ears`","values themselves, and file paths.","","## Design evolves with each feature","","Before implementation, classify the feature as: no design impact, an additive","capability/scenario link, or a structural change. Apply deterministic links directly;","preview architecture or project-context changes for the user. Do not finish a feature","while a material design impact remains unresolved, and do not churn design documents","for internal fixes that genuinely have no design impact.",_Ne(t).replace(/\n$/,""),"","## Personas \u2014 cross-host capability map (anti-self-cert)","",`The agent that writes a unit of work must not sign off on it.${c} Each`,"persona and the vendor-neutral capabilities it may use \u2014 so Codex, Gemini, and other","AGENTS.md readers receive the same guidance Claude does:","",a,"","These briefs are manuals for cladding's touchpoints, not a roster of permitted agents: any host agent may take up any of them, and an agent that never touches a cladding surface needs none. The gates judge a result the same way whoever produced it \u2014 the one thing tied to identity is the independence label, which records whether the verifier was independent of the author, never which brief (if any) an agent wore.","","## Speak the user's language","","Translate cladding's vocabulary into plain words in the user's own language when you","report progress \u2014 relay gate/hook messages by meaning, and never lead with an internal","id (`F-\u2026`, `AC-\u2026`, `stage_X.Y`): name the feature and the plain outcome instead."].join(` `).replace(/\n{3,}/g,` `).trim()}function SNe(t,e){let r=t.includes(`\r diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 8c3d5206..fcb4f079 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -17,15 +17,15 @@ attested_modules: .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: a67e4c092a7223c1 + CHANGELOG.md: 5b2341399d2f1352 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 0f4f9d52bca2e782 - README.ja.md: e0714533e64683d0 - README.ko.html: fe80f8363ff2c820 - README.ko.md: 079fc16a7a5b125f - README.md: 8fb8a73f601fe8a9 - README.zh.md: fc8d390a0d0a1aee + README.html: a2df07e5e20a4f73 + README.ja.md: ce56f385afe06d96 + README.ko.html: dd2f20cab0d9419f + README.ko.md: 91428537bd396ab7 + README.md: c01043c6b6877d4e + README.zh.md: 4e37e686c9923c50 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -207,7 +207,7 @@ attested_modules: src/hitl/audit.ts: 79b06e904815469a src/hitl/identity.ts: 52ff84aa666f1dab src/hitl/independence.ts: 202f4e5ef8bc69e3 - src/init/agents-md.ts: c0f853ca09b75670 + src/init/agents-md.ts: 5369a15847ce1ae7 src/init/git-hook.ts: b77910b0df392cbf src/init/host-instructions.ts: c598f8598d8d1cd4 src/init/host-setup.ts: 158cc9306a746da1 diff --git a/src/init/agents-md.ts b/src/init/agents-md.ts index 36d8a2b7..8615546b 100644 --- a/src/init/agents-md.ts +++ b/src/init/agents-md.ts @@ -170,6 +170,28 @@ export function renderAgentsMdManagedBlock(spec: Spec | null, cwd: string = '.') 'Write the obligation in `text`, or in the `action` / `response` fields — both are read', 'as the requirement. Put the reasoning in `notes`; it is free prose and nothing parses it.', '', + '## What language to write a spec entry in', + '', + 'Default to English. If the spec already has entries, match the language THEY use — the', + 'entries already written are the answer, so nothing needs configuring and nothing can go', + 'stale. Where they disagree, write English. This keeps one repository speaking with one', + 'voice no matter who is at the keyboard; it is a property of the project, not of whoever', + 'you are talking to right now.', + '', + 'If the user asks for another language, write `title`, `notes` and `text` in it. The next', + 'entry then follows by the rule above, so a one-time request carries forward on its own.', + 'Switching language applies to NEW entries; never rewrite existing ones into another', + 'language — those are the project\'s own words.', + '', + 'Four words stay English wherever they appear, because the gate matches them literally and', + 'EARS is a published notation: **when**, **while**, **if**, **where**. Only the FIRST word', + 'of a `condition` is constrained — the rest of the sentence is yours:', + '', + ' condition: "when the app exits" · condition: "when 앱이 종료될 때"', + '', + 'Identifiers are not prose and are never translated: feature and criterion ids, the `ears`', + 'values themselves, and file paths.', + '', '## Design evolves with each feature', '', 'Before implementation, classify the feature as: no design impact, an additive', diff --git a/tests/init/agents-md.test.ts b/tests/init/agents-md.test.ts index db21a5a7..ca97cd78 100644 --- a/tests/init/agents-md.test.ts +++ b/tests/init/agents-md.test.ts @@ -349,3 +349,47 @@ describe('the managed block teaches EARS, and cannot drift from the validator', } }); }); + +describe('the managed block says what language a spec entry is written in', () => { + // No rule existed, so adopters diverged: two repositories reached ~100% + // Korean titles while two others stayed fully English. The rule lives here + // rather than in the CLAUDE.md block (21 characters of headroom against a + // pinned ceiling) or a persona prompt (3 characters, and it only reaches + // hosts that install the plugin). + const block = () => renderAgentsMdManagedBlock(null, '.'); + + test('it states the default, and that existing entries decide instead', () => { + expect(block()).toContain('Default to English'); + expect(block()).toMatch(/match the language THEY use/); + expect(block()).toMatch(/Where they disagree, write English/); + }); + + test('a language request covers the prose fields and carries forward on its own', () => { + const b = block(); + expect(b).toMatch(/asks for another language/); + for (const field of ['`title`', '`notes`', '`text`']) expect(b).toContain(field); + expect(b).toMatch(/carries forward/); + }); + + test('it forbids rewriting existing entries into another language', () => { + expect(block()).toMatch(/never rewrite existing ones/); + }); + + test('the four trigger words are named as fixed, and only the first word is constrained', () => { + const b = block(); + for (const w of ['when', 'while', 'if', 'where']) expect(b).toContain(`**${w}**`); + expect(b).toMatch(/Only the FIRST word/); + }); + + test('it shows a mixed condition, so "English trigger" is not read as "English sentence"', () => { + // The whole point of naming only four words: everything after them is free. + // A reader who cannot see that will over-translate or under-translate. + const example = block().split('\n').find((l) => l.includes('condition:') && /[가-힣]/.test(l)); + expect(example, 'no mixed-language condition example in the block').toBeDefined(); + expect(example).toMatch(/^\s*condition: "when /m); + }); + + test('identifiers are excluded from translation', () => { + expect(block()).toMatch(/Identifiers are not prose/); + }); +}); From 98fafc20b354984fc4b05483856d1b2851ba16a5 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 4 Aug 2026 11:39:28 +0900 Subject: [PATCH 8/8] chore(release): 0.9.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eleven version sites via `npm run version-bump`, the lockfile regenerated so `npm ci` resolves, and the built mirrors refreshed. The changelog section is dated, and the record row in all six README variants now says v0.9.3 — it had been carrying this release's numbers under the previous release's label. 2815 tests green, `npm ci` clean from a fresh clone, `clad check --tier=pre-push --strict` exits 0. Co-Authored-By: Claude Opus 5 --- .claude-plugin/marketplace.json | 2 +- CHANGELOG.md | 2 +- README.html | 2 +- README.ja.md | 2 +- README.ko.html | 2 +- README.ko.md | 2 +- README.md | 2 +- README.zh.md | 2 +- package-lock.json | 4 +-- package.json | 2 +- .../claude-code/.claude-plugin/plugin.json | 2 +- plugins/claude-code/dist/clad.js | 4 +-- plugins/codex/.codex-plugin/plugin.json | 2 +- plugins/gemini-cli/gemini-extension.json | 2 +- spec.yaml | 2 +- spec/attestation.yaml | 32 +++++++++---------- src/cli/clad.ts | 2 +- src/serve/server.ts | 2 +- tests/cli/clad.test.ts | 2 +- 19 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 99984092..cbb1ced3 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "claude-code", "source": "./plugins/claude-code", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", - "version": "0.9.2", + "version": "0.9.3", "author": { "name": "qwerfunch" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index cede7064..4b2041b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to Cladding are documented here. Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). -## [0.9.3] — The review packet shows how the contract itself moved (unreleased) +## [0.9.3] — The review packet shows how the contract itself moved (2026-08-04) **In one line:** a pull request now shows which acceptance criteria were rewritten while the code changed, and the architecture gate stops failing on generated build output. diff --git a/README.html b/README.html index 5eeef3c2..1a91d7f2 100644 --- a/README.html +++ b/README.html @@ -556,7 +556,7 @@

Status

version
-
v0.9.2
+
v0.9.3
2026-07
diff --git a/README.ja.md b/README.ja.md index 4bebc680..13fb81ce 100644 --- a/README.ja.md +++ b/README.ja.md @@ -347,7 +347,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 段階 · 41 detectors | 273(269 done) | +| v0.9.3(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 段階 · 41 detectors | 273(269 done) | 249 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 7ea5ea61..a99bc012 100644 --- a/README.ko.html +++ b/README.ko.html @@ -590,7 +590,7 @@

Status

version
-
v0.9.2
+
v0.9.3
2026-07
diff --git a/README.ko.md b/README.ko.md index 3bf173cf..bbfa7ee1 100644 --- a/README.ko.md +++ b/README.ko.md @@ -346,7 +346,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.2 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | +| v0.9.3 · 2026-08 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 · all pass | 15 단계 · 41 detectors | 273 · 269 done · 자기 스펙 | 249 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index 7f164d8f..48df0442 100644 --- a/README.md +++ b/README.md @@ -360,7 +360,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 stages · 41 detectors | 273 (269 done) | +| v0.9.3 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 stages · 41 detectors | 273 (269 done) | 249 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 1ad38690..ff68b5df 100644 --- a/README.zh.md +++ b/README.zh.md @@ -343,7 +343,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.2(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 阶段 · 41 检测器 | 273(269 done) | +| v0.9.3(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2815 / 2815 | 15 阶段 · 41 检测器 | 273(269 done) | 249 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/package-lock.json b/package-lock.json index 2495dd1c..75f0bdaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.96.0", diff --git a/package.json b/package.json index afb136d5..a0834f37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Gemini · Antigravity · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", "type": "module", "license": "MIT", diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 48f15822..ff06fc9a 100644 --- a/plugins/claude-code/.claude-plugin/plugin.json +++ b/plugins/claude-code/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "author": { "name": "qwerfunch" diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 81956da4..5b5522e8 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -460,7 +460,7 @@ schema: "0.1" source: spec.yaml `});function Qc(t){let e=t.identity.timestamp??new Date().toISOString(),r=`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return{...t,id:r,identity:{...t.identity,timestamp:e}}}var xA=y(()=>{"use strict"});import{existsSync as h8e,mkdirSync as g8e,readFileSync as Xue,readdirSync as y8e,writeFileSync as Que}from"node:fs";import{dirname as _8e,join as Yq}from"node:path";function v8e(t,e){return`${b8e}/${t}.${e}.test.ts`}function S8e(t,e){let r=Yq(t,"spec/features");if(!h8e(r))return null;for(let n of y8e(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))){let i=Yq(r,n);try{if((0,lo.parseDocument)(Xue(i,"utf8")).get("id")===e)return i}catch{}}return null}function w8e(t,e,r,n){let i=S8e(t,e);if(!i)return!1;let o=(0,lo.parseDocument)(Xue(i,"utf8")),s=o.get("acceptance_criteria");if(!(0,lo.isSeq)(s))return!1;let a=s.items.find(l=>(0,lo.isMap)(l)&&l.get("id")===r);if(!a||!(0,lo.isMap)(a))return!1;let c=a.get("oracle_refs",!0);if((0,lo.isSeq)(c)){if(c.items.some(l=>((0,lo.isMap)(l)?void 0:l.value)===n))return!0;c.add(n)}else a.set("oracle_refs",[n]);return Que(i,String(o),"utf8"),!0}function ede(t){let e=t.cwd??".",r=v8e(t.featureId,t.acId),n=Yq(e,r);g8e(_8e(n),{recursive:!0}),Que(n,t.body.endsWith(` `)?t.body:`${t.body} -`,"utf8");let i=Qc({featureId:t.featureId,acId:t.acId,stage:"stage_2.3",identity:{author:"llm",name:t.authorName??"oracle-author"},kind:"oracle",content:`impl-blind oracle authored for ${t.featureId}.${t.acId} (blind=${t.blind===!0})`,artifact:r,readManifest:t.readManifest,blind:t.blind===!0});return Wa(e,i),w8e(e,t.featureId,t.acId,r)?{ok:!0,oraclePath:r,evidenceId:i.id}:{ok:!1,oraclePath:r,evidenceId:i.id,reason:`oracle + provenance written, but could not stamp oracle_refs (no shard for ${t.featureId}.${t.acId}) \u2014 add 'oracle_refs: [${r}]' to the AC manually`}}var lo,b8e,tde=y(()=>{"use strict";lo=St(er(),1);un();xA();b8e="tests/oracle"});var yde={};Dr(yde,{PERSONA_IDS:()=>lde,PERSONA_PROMPT_ALIASES:()=>ude,RESOURCE_URIS:()=>la,TOOL_NAMES:()=>P8e,buildServer:()=>C8e});import{spawnSync as rde}from"node:child_process";import{createHash as xy,randomUUID as x8e}from"node:crypto";import{readFileSync as da,existsSync as An,mkdirSync as Qq,realpathSync as nde,readdirSync as n4,rmSync as el,statSync as AA,writeFileSync as ade}from"node:fs";import{basename as $8e,dirname as wy,extname as k8e,isAbsolute as ide,join as Ct,relative as cde,resolve as e4,sep as E8e}from"node:path";import{fileURLToPath as A8e}from"node:url";import{TextDecoder as T8e}from"node:util";import{deflateRawSync as O8e,inflateRawSync as R8e}from"node:zlib";import{tmpdir as I8e}from"node:os";function C8e(t={}){let e=t.cwd??".",r=new vA({name:t.name??"cladding",version:t.version??"0.9.2"},{instructions:"For explicit Cladding onboarding, always call clad_prepare_init first, draft the requested structured data with the current host model, then call clad_stage_init before showing the planned changes. Wait for a separate user confirmation before calling clad_init with the confirmation verbatim. For each real user answer, call clad_prepare_clarify and then clad_clarify only after a new user message supplies the answer. Never infer an answer or call clarify during the initialization approval turn. Never run onboarding shell commands or request MCP sampling. Prepare tools are read-only; apply tools validate and write.",capabilities:{resources:{subscribe:!0}}});return G8e(r,e,t.onboarding),W8e(r,e),K8e(r,e),D8e(r),N8e(r,e),r}function D8e(t){t.server.setRequestHandler(n2,async()=>({})),t.server.setRequestHandler(i2,async()=>({}))}function N8e(t,e){X8(r=>{r===e&&t.server.sendResourceUpdated({uri:la.audit})})}function ua(t){try{return{spec:q(t)}}catch(e){return{error:`cladding: spec not loaded \u2014 ${e.message}. Run \`clad init\` to scaffold spec.yaml first.`}}}function j8e(t){return"error"in ua(t)?"cladding: not_initialized \u2014 this project has host wiring but no valid spec.yaml; ordinary work must remain ordinary until the user explicitly requests Cladding initialization.":null}function _y(t){let e=j8e(t);return e?{isError:!0,content:[{type:"text",text:e}]}:null}function by(t){try{let e=si({cwd:t}),r=e.findings.filter(n=>n.severity!=="info").slice(0,3).map(n=>({detector:n.detector,severity:n.severity,message:n.message.slice(0,220)}));return e.pass?{pass:!0,findings:r}:{pass:!1,findings:r,next:"Resolve these findings, then verify with clad_run_gate (or `clad check --strict`) before `clad done`."}}catch{return{pass:!1,unavailable:!0,findings:[],next:"gate could not run \u2014 verify with `clad check --strict`."}}}function Xq(t,e,r,n,i){try{tr(t,"working_set_served",{tool:e,query:r,resolved:n,...i??{}})}catch{}}function ode(){let t=wy(A8e(import.meta.url));for(let r=0;r<5;r++){let n=Ct(t,"bin","clad");if(An(n))return n;t=wy(t)}let e=process.argv[1];return e&&$8e(e)==="clad.js"&&An(e)?e:null}function F8e(t,e){if(!e.trim())return{error:"document_path is required for document mode"};if(ide(e))return{error:"document_path must be relative to the connected project"};let r=nde(e4(t)),n=e4(r,e);if(!An(n))return{error:`planning document not found: ${e}`};let i;try{i=nde(n)}catch(s){return{error:`planning document could not be resolved: ${s.message}`}}let o=cde(r,i);if(o===".."||o.startsWith(`..${E8e}`)||ide(o))return{error:"planning document must stay inside the connected project"};if(!AA(i).isFile())return{error:"planning document must be a regular file"};if(!M8e.has(k8e(i).toLowerCase()))return{error:"planning document must be .md, .txt, .yaml, .yml, or .markdown"};try{let s=new T8e("utf-8",{fatal:!0}).decode(da(i));return{path:o,text:s}}catch(s){return{error:`planning document is not readable UTF-8 text: ${s.message}`}}}function dde(t){let e=O8e(Buffer.from(JSON.stringify(t))).toString("base64url");return`v1.${xy("sha256").update(e).digest("hex").slice(0,24)}.${e}`}function t4(t){let e=/^v1\.([a-f0-9]{24})\.([A-Za-z0-9_-]+)$/.exec(t);if(!e||xy("sha256").update(e[2]).digest("hex").slice(0,24)!==e[1])return null;try{let r=JSON.parse(R8e(Buffer.from(e[2],"base64url"),{maxOutputLength:kA}).toString("utf8"));return r.kind!=="init"&&r.kind!=="clarify"||typeof r.snapshot!="string"||typeof r.intent!="string"?null:r}catch{return null}}function EA(t,e,r=!1){let n=xy("sha256").update(`${e4(t)}\0${e}`).digest("hex");return r?Ct(t,".cladding","host","onboarding-pending",`${n}.json`):Ct(I8e(),"cladding-onboarding-pending",`${n}.json`)}function z8e(t){let e;try{e=n4(t)}catch{return}for(let r of e){if(!r.endsWith(".json"))continue;let n=Ct(t,r);try{let i=JSON.parse(da(n,"utf8"));(!i.expiresAt||i.expiresAt{if(An(n))for(let i of n4(n,{withFileTypes:!0}).sort((o,s)=>o.name.localeCompare(s.name))){if(i.name===".git"||i.name===".cladding"||i.name==="node_modules")continue;let o=Ct(n,i.name),s=cde(t,o);if(i.isDirectory())r(o);else if(i.isFile()){let a=AA(o);e.update(`${s}\0${a.size}\0${a.mtimeMs} +`,"utf8");let i=Qc({featureId:t.featureId,acId:t.acId,stage:"stage_2.3",identity:{author:"llm",name:t.authorName??"oracle-author"},kind:"oracle",content:`impl-blind oracle authored for ${t.featureId}.${t.acId} (blind=${t.blind===!0})`,artifact:r,readManifest:t.readManifest,blind:t.blind===!0});return Wa(e,i),w8e(e,t.featureId,t.acId,r)?{ok:!0,oraclePath:r,evidenceId:i.id}:{ok:!1,oraclePath:r,evidenceId:i.id,reason:`oracle + provenance written, but could not stamp oracle_refs (no shard for ${t.featureId}.${t.acId}) \u2014 add 'oracle_refs: [${r}]' to the AC manually`}}var lo,b8e,tde=y(()=>{"use strict";lo=St(er(),1);un();xA();b8e="tests/oracle"});var yde={};Dr(yde,{PERSONA_IDS:()=>lde,PERSONA_PROMPT_ALIASES:()=>ude,RESOURCE_URIS:()=>la,TOOL_NAMES:()=>P8e,buildServer:()=>C8e});import{spawnSync as rde}from"node:child_process";import{createHash as xy,randomUUID as x8e}from"node:crypto";import{readFileSync as da,existsSync as An,mkdirSync as Qq,realpathSync as nde,readdirSync as n4,rmSync as el,statSync as AA,writeFileSync as ade}from"node:fs";import{basename as $8e,dirname as wy,extname as k8e,isAbsolute as ide,join as Ct,relative as cde,resolve as e4,sep as E8e}from"node:path";import{fileURLToPath as A8e}from"node:url";import{TextDecoder as T8e}from"node:util";import{deflateRawSync as O8e,inflateRawSync as R8e}from"node:zlib";import{tmpdir as I8e}from"node:os";function C8e(t={}){let e=t.cwd??".",r=new vA({name:t.name??"cladding",version:t.version??"0.9.3"},{instructions:"For explicit Cladding onboarding, always call clad_prepare_init first, draft the requested structured data with the current host model, then call clad_stage_init before showing the planned changes. Wait for a separate user confirmation before calling clad_init with the confirmation verbatim. For each real user answer, call clad_prepare_clarify and then clad_clarify only after a new user message supplies the answer. Never infer an answer or call clarify during the initialization approval turn. Never run onboarding shell commands or request MCP sampling. Prepare tools are read-only; apply tools validate and write.",capabilities:{resources:{subscribe:!0}}});return G8e(r,e,t.onboarding),W8e(r,e),K8e(r,e),D8e(r),N8e(r,e),r}function D8e(t){t.server.setRequestHandler(n2,async()=>({})),t.server.setRequestHandler(i2,async()=>({}))}function N8e(t,e){X8(r=>{r===e&&t.server.sendResourceUpdated({uri:la.audit})})}function ua(t){try{return{spec:q(t)}}catch(e){return{error:`cladding: spec not loaded \u2014 ${e.message}. Run \`clad init\` to scaffold spec.yaml first.`}}}function j8e(t){return"error"in ua(t)?"cladding: not_initialized \u2014 this project has host wiring but no valid spec.yaml; ordinary work must remain ordinary until the user explicitly requests Cladding initialization.":null}function _y(t){let e=j8e(t);return e?{isError:!0,content:[{type:"text",text:e}]}:null}function by(t){try{let e=si({cwd:t}),r=e.findings.filter(n=>n.severity!=="info").slice(0,3).map(n=>({detector:n.detector,severity:n.severity,message:n.message.slice(0,220)}));return e.pass?{pass:!0,findings:r}:{pass:!1,findings:r,next:"Resolve these findings, then verify with clad_run_gate (or `clad check --strict`) before `clad done`."}}catch{return{pass:!1,unavailable:!0,findings:[],next:"gate could not run \u2014 verify with `clad check --strict`."}}}function Xq(t,e,r,n,i){try{tr(t,"working_set_served",{tool:e,query:r,resolved:n,...i??{}})}catch{}}function ode(){let t=wy(A8e(import.meta.url));for(let r=0;r<5;r++){let n=Ct(t,"bin","clad");if(An(n))return n;t=wy(t)}let e=process.argv[1];return e&&$8e(e)==="clad.js"&&An(e)?e:null}function F8e(t,e){if(!e.trim())return{error:"document_path is required for document mode"};if(ide(e))return{error:"document_path must be relative to the connected project"};let r=nde(e4(t)),n=e4(r,e);if(!An(n))return{error:`planning document not found: ${e}`};let i;try{i=nde(n)}catch(s){return{error:`planning document could not be resolved: ${s.message}`}}let o=cde(r,i);if(o===".."||o.startsWith(`..${E8e}`)||ide(o))return{error:"planning document must stay inside the connected project"};if(!AA(i).isFile())return{error:"planning document must be a regular file"};if(!M8e.has(k8e(i).toLowerCase()))return{error:"planning document must be .md, .txt, .yaml, .yml, or .markdown"};try{let s=new T8e("utf-8",{fatal:!0}).decode(da(i));return{path:o,text:s}}catch(s){return{error:`planning document is not readable UTF-8 text: ${s.message}`}}}function dde(t){let e=O8e(Buffer.from(JSON.stringify(t))).toString("base64url");return`v1.${xy("sha256").update(e).digest("hex").slice(0,24)}.${e}`}function t4(t){let e=/^v1\.([a-f0-9]{24})\.([A-Za-z0-9_-]+)$/.exec(t);if(!e||xy("sha256").update(e[2]).digest("hex").slice(0,24)!==e[1])return null;try{let r=JSON.parse(R8e(Buffer.from(e[2],"base64url"),{maxOutputLength:kA}).toString("utf8"));return r.kind!=="init"&&r.kind!=="clarify"||typeof r.snapshot!="string"||typeof r.intent!="string"?null:r}catch{return null}}function EA(t,e,r=!1){let n=xy("sha256").update(`${e4(t)}\0${e}`).digest("hex");return r?Ct(t,".cladding","host","onboarding-pending",`${n}.json`):Ct(I8e(),"cladding-onboarding-pending",`${n}.json`)}function z8e(t){let e;try{e=n4(t)}catch{return}for(let r of e){if(!r.endsWith(".json"))continue;let n=Ct(t,r);try{let i=JSON.parse(da(n,"utf8"));(!i.expiresAt||i.expiresAt{if(An(n))for(let i of n4(n,{withFileTypes:!0}).sort((o,s)=>o.name.localeCompare(s.name))){if(i.name===".git"||i.name===".cladding"||i.name==="node_modules")continue;let o=Ct(n,i.name),s=cde(t,o);if(i.isDirectory())r(o);else if(i.isFile()){let a=AA(o);e.update(`${s}\0${a.size}\0${a.mtimeMs} `)}}};return r(t),e.digest("hex")}function Sy(t){let e=xy("sha256").update(q8e(t)),r=Ct(t,".cladding","onboarding","state.yaml");return e.update(An(r)?da(r):Buffer.from("absent")),e.digest("hex")}function hde(t,e){let r=new Map,n=new Set,i=o=>{let s=Ct(t,o);if(!An(s))return;let a=AA(s);if(a.isFile()){r.set(o,da(s));return}if(a.isDirectory()){n.add(o);for(let c of n4(s))i(Ct(o,c))}};for(let o of e)i(o);return{files:r,directories:n}}function gde(t,e,r){for(let n of e)el(Ct(t,n),{recursive:!0,force:!0});for(let n of[...r.directories].sort((i,o)=>i.length-o.length))Qq(Ct(t,n),{recursive:!0});for(let[n,i]of r.files)Qq(wy(Ct(t,n)),{recursive:!0}),ade(Ct(t,n),i)}function B8e(t){return hde(t,mde)}function H8e(t,e){gde(t,mde,e)}function mt(t,e=!1){return{...e?{isError:!0}:{},structuredContent:t,content:[{type:"text",text:JSON.stringify(t,null,2)}]}}function G8e(t,e,r){let n=new Map,i=!1,o=()=>{i||(i=!0,Z8e(t,e,n,r))};t.registerTool("clad_prepare_init",{title:"Prepare Cladding onboarding context",description:"Non-destructive first step for every explicit Cladding initialization request: writes no authored project files (only a TTL'd consent cache). Inspect the connected project, then use this tool result to draft the structured input for clad_init. Never run clad init in a shell.",inputSchema:{mode:E.enum(["idea","document","existing"]),intent:E.string().optional(),document_path:E.string().optional(),refresh:E.boolean().optional()},outputSchema:{status:E.string(),changed:E.boolean(),schemaVersion:E.number().optional(),token:E.string().optional(),prompt:E.string().optional(),request:E.object({mode:E.string(),intent:E.string()}).optional(),observation:E.record(E.string(),E.unknown()).optional(),question:E.string().optional(),error:E.string().optional(),plannedChanges:E.array(E.string()).optional(),confirmationQuestion:E.string().optional(),requiresSeparateUserConfirmation:E.boolean().optional(),approvalChallenge:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async s=>{if(!r)return mt({status:"unavailable",changed:!1},!0);if(An(Ct(e,"spec.yaml"))&&!s.refresh)return mt({status:"already_initialized",changed:!1});let a=s.intent?.trim()??"";if(s.mode==="idea"&&!a)return mt({status:"needs_input",changed:!1,question:"What kind of project are you building?"});if(s.mode==="document"){let p=F8e(e,s.document_path??"");if(p.error)return mt({status:"invalid_request",changed:!1,error:p.error},!0);a=p.text}s.mode==="existing"&&!a&&(a="Adopt Cladding into the observed existing project.");let c=r.prepareInit({cwd:e,mode:s.mode,intent:a}),l=U8e(),u=Number(c.observation.source_file_count??0),d={kind:"init",snapshot:Sy(e),mode:s.mode,intent:a,refresh:s.refresh,approvalChallenge:l,scan:s.mode==="existing"||u>0},f=dde(d);return n.set(f,d),r4(e,l,f,d),mt({status:"needs_confirmation",changed:!1,schemaVersion:1,token:f,prompt:c.prompt,request:c.request,observation:c.observation,plannedChanges:s.refresh?["Preserve authored files and write review proposals under .cladding/scan/.","Propose refreshed docs/project-context.md, spec/architecture.yaml, and spec/capabilities.yaml."]:["Create spec.yaml, spec/architecture.yaml, and spec/capabilities.yaml.","Create 1-3 spec/scenarios/*.yaml journey files.","Create docs/project-context.md and docs/conventions.md.","Create .cladding/onboarding/state.yaml and append .cladding/ to .gitignore.","Create a managed AGENTS.md block; preserve an existing unmanaged AGENTS.md.","Preserve any existing CLAUDE.md unchanged; AGENTS.md is the shared host instruction surface."],confirmationQuestion:`To apply these changes, reply with the exact approval phrase: ${l}`,approvalChallenge:l,requiresSeparateUserConfirmation:!0})}),t.registerTool("clad_stage_init",{title:"Stage a Cladding onboarding draft for approval",description:"Validate and temporarily cache the host-model draft from clad_prepare_init before showing the approval phrase. This does not modify project files and lets a later host process apply the exact staged draft.",inputSchema:{token:E.string().min(1).max(kA),draft:$A},outputSchema:{status:E.string(),changed:E.boolean(),approvalChallenge:E.string().optional(),confirmationQuestion:E.string().optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async s=>{let a=n.get(s.token)??t4(s.token);return!a||a.kind!=="init"||!a.approvalChallenge?mt({status:"invalid_token",changed:!1},!0):a.snapshot!==Sy(e)?mt({status:"stale_preparation",changed:!1},!0):(r4(e,a.approvalChallenge,s.token,a,s.draft),mt({status:"staged",changed:!1,approvalChallenge:a.approvalChallenge,confirmationQuestion:`To apply these changes, reply with the exact approval phrase: ${a.approvalChallenge}`}))}),t.registerTool("clad_init",{title:"Apply a validated Cladding onboarding draft",description:"Write Cladding artifacts from the host model draft returned after clad_prepare_init. Use the one-time token when the host retained it; process-per-turn hosts may use the exact approval phrase through the short-lived project runtime cache. Copy the complete user message, including the APPLY CLADDING prefix, into confirmation. Malformed, stale, or replayed requests do not write files.",inputSchema:{token:E.string().min(1).max(kA).optional(),confirmation:E.string().regex(/^APPLY CLADDING [A-F0-9]{6}$/).describe("The complete separate user reply, verbatim, including the APPLY CLADDING prefix"),draft:$A.optional()},outputSchema:{status:E.string(),changed:E.boolean(),created:E.array(E.string()).optional(),skipped:E.array(E.string()).optional(),language:E.string().optional(),proposals:E.array(E.string()).optional(),clarifyingQuestions:E.array(E.string()).optional(),onboardingMode:E.enum(["greenfield","existing-adoption","mixed"]).optional(),onboardingSource:E.string().optional(),nextQuestion:E.string().nullable().optional(),remainingQuestions:E.number().optional(),error:E.string().optional(),confirmation:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async s=>{let a=fde(e,s.confirmation.trim()),c=(s.token?n.get(s.token)??t4(s.token):null)??a?.request;if(!c||c.kind!=="init")return mt({status:"invalid_token",changed:!1},!0);if(!c.approvalChallenge||s.confirmation.trim()!==c.approvalChallenge)return mt({status:"confirmation_required",changed:!1,error:"The exact one-time approval phrase shown in the preview is required."},!0);if(c.snapshot!==Sy(e))return mt({status:"stale_preparation",changed:!1},!0);if(!r)return mt({status:"unavailable",changed:!1},!0);let l=s.draft??a?.draft;if(!l)return mt({status:"draft_required",changed:!1,error:"No staged onboarding draft is available. Prepare and stage the draft again before approval."},!0);s.token&&n.delete(s.token),pde(e,s.confirmation.trim());let u=r.renderDraft(l),d=B8e(e),f;try{f=await r.initialize({cwd:e,intent:c.intent,scan:c.scan?!0:void 0,hostDispatcher:async()=>u})}catch(h){return H8e(e,d),mt({status:"failed",changed:!1,error:`Initialization failed; all onboarding files were restored: ${h.message}`},!0)}let p=f.clarifyingQuestions??[],m={status:p.length>0?"needs_answers":"initialized",changed:!0,...f,onboardingSource:"host",confirmation:s.confirmation,nextQuestion:p[0]??null,remainingQuestions:p.length};return o(),mt(m)}),An(Ct(e,"spec.yaml"))&&o()}function Z8e(t,e,r,n){t.registerTool("clad_prepare_clarify",{title:"Prepare the next Cladding onboarding answer",description:"Use only after a new user message answers the displayed pending question. Pass that answer verbatim. Never call during the initialization approval turn and never invent an answer.",inputSchema:{answer:E.string().min(1)},outputSchema:{status:E.string(),changed:E.boolean(),schemaVersion:E.number().optional(),token:E.string().optional(),prompt:E.string().optional(),request:E.object({mode:E.string(),intent:E.string()}).optional(),observation:E.record(E.string(),E.unknown()).optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async i=>{if(!n)return mt({status:"unavailable",changed:!1},!0);let o=n.prepareClarify(i.answer,{cwd:e});if("error"in o)return mt({status:"invalid_state",changed:!1,error:o.error},!0);let s={kind:"clarify",snapshot:Sy(e),mode:"idea",intent:o.request.intent,answer:i.answer},a=dde(s);return r.set(a,s),r4(e,`clarify:${i.answer}`,a,s),mt({status:"needs_host_draft",changed:!1,schemaVersion:1,token:a,prompt:o.prompt,request:o.request,observation:o.observation})}),t.registerTool("clad_clarify",{title:"Answer the next Cladding onboarding question",description:"Apply a host-model refinement only for an answer supplied in a new user message after the pending question. Never call during the initialization approval turn; do not invent or alter the user answer.",inputSchema:{answer:E.string().min(1).describe("The user's answer, verbatim"),token:E.string().min(1).max(kA).optional(),draft:$A},outputSchema:{status:E.string(),changed:E.boolean(),cwd:E.string().optional(),answered:E.unknown().optional(),newQuestions:E.array(E.string()).optional(),mode:E.enum(["greenfield","existing-adoption","mixed"]).nullable().optional(),nextQuestion:E.string().nullable().optional(),remainingQuestions:E.number().optional(),refinementSource:E.string().optional(),pendingReview:E.array(E.string()).optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async i=>{let o=fde(e,`clarify:${i.answer}`),s=(i.token?r.get(i.token)??t4(i.token):null)??o?.request;if(!s||s.kind!=="clarify"||s.answer!==i.answer)return mt({status:"invalid_token",changed:!1},!0);if(s.snapshot!==Sy(e))return mt({status:"stale_preparation",changed:!1},!0);if(!n)return mt({status:"unavailable",changed:!1},!0);i.token&&r.delete(i.token),pde(e,`clarify:${i.answer}`);let a=n.renderDraft(i.draft),c=await n.clarify(i.answer,{cwd:e,hostDispatcher:async()=>a});return c.ok?mt({...c.report??{},changed:!0,refinementSource:"host"}):mt({status:"failed",changed:!1,error:c.error??"onboarding clarification failed"},!0)}),t.registerTool("clad_resolve_onboarding_review",{title:"Apply reviewed onboarding design proposals",description:"After showing proposal diffs and receiving explicit user approval, applies only the selected pending proposal targets. Never call this automatically; authored design is preserved until the user reviews it.",inputSchema:{targets:E.array(E.string()).min(1).describe("Exact active artifact paths returned in pendingReview.")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async i=>{if(!n)return mt({status:"unavailable",changed:!1},!0);let o=n.resolveReview(i.targets,{cwd:e});return mt({status:o.status??(o.ok?"resolved":"failed"),changed:o.changed,remaining:o.remaining,error:o.error},!o.ok)}),t.registerTool("clad_list_features",{title:"List cladding features",description:"List features from spec.yaml. Optionally filter by status or slug substring, and sort alphabetically (default) or by recent file mtime.",inputSchema:{statusFilter:E.enum(["planned","in_progress","done","archived"]).optional().describe("Limit to features with this status"),slugSubstring:E.string().optional().describe("Case-insensitive substring match on slug (e.g. 'auth')"),sort:E.enum(["alphabetical","recent"]).optional().describe("'alphabetical' (default \u2014 by id) or 'recent' (by file mtime, newest first)")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{let o=ua(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let a=o.spec.features;if(i.statusFilter&&(a=a.filter(u=>u.status===i.statusFilter)),i.slugSubstring){let u=i.slugSubstring.toLowerCase();a=a.filter(d=>{let f=d.slug;return f?f.toLowerCase().includes(u):!1})}let l=(i.sort==="recent"?V8e(a,e):a).map(u=>({id:u.id,slug:u.slug,title:u.title,status:u.status}));return{content:[{type:"text",text:JSON.stringify({total:l.length,features:l},null,2)}]}}),t.registerTool("clad_get_feature",{title:"Get a cladding feature",description:'Returns one feature record by id (e.g. "F-049" or "F-a3f9c2") or by slug (e.g. "login-flow"). When a slug matches multiple features, all matches are returned.',inputSchema:{id:E.string().optional().describe('Feature id such as "F-049" or "F-a3f9c2"'),slug:E.string().optional().describe("Feature slug such as 'login-flow'")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{if(!i.id&&!i.slug)return{isError:!0,content:[{type:"text",text:"provide either id or slug"}]};let o=ua(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=o.spec.features.filter(c=>!!(i.id&&c.id===i.id||i.slug&&c.slug===i.slug));if(s.length===0)return{isError:!0,content:[{type:"text",text:`no feature with ${i.id?`id "${i.id}"`:`slug "${i.slug}"`} found`}]};let a=s.length===1?s[0]:{matches:s};return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}),t.registerTool("clad_run_check",{title:"Run cladding drift check",description:"Runs `clad check` drift detection. Returns a TERSE report by default (pass, error/warn counts, top 3 blocking findings) to keep the agent loop cheap; pass verbose:true for every finding incl. info-severity + suggestions.",inputSchema:{strict:E.boolean().optional().describe("Treat warnings as errors when true"),verbose:E.boolean().optional().describe("Return the full report (all findings incl. info + suggestions) instead of the terse top-3 summary")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{let o=si({strict:i.strict,cwd:e});if(i.verbose)return{content:[{type:"text",text:JSON.stringify(o,null,2)}],isError:!o.pass};let s=o.findings??[],a=s.filter(d=>d.severity==="error"),c=s.filter(d=>d.severity==="warn"),l=(a.length>0?a:c).slice(0,3).map(d=>({detector:d.detector,severity:d.severity,message:d.message,...d.path?{path:d.path}:{},...d.line?{line:d.line}:{}})),u={stage:o.stage,pass:o.pass,errorCount:a.length,warnCount:c.length,findings:l,...a.length+c.length>l.length?{truncated:!0,hint:"call clad_run_check with verbose:true for all findings"}:{}};return{content:[{type:"text",text:JSON.stringify(u,null,2)}],isError:!o.pass}}),t.registerTool("clad_run_gate",{title:"Run the full Iron Law gate",description:"Runs the real `clad check` pipeline for a tier (default pre-commit for latency; pre-push runs type/lint/tests/coverage/conformance/smoke) and returns the untruncated JSON outcome. Strict by default \u2014 this is the verification surface; use clad_run_check for the cheap drift-only view.",inputSchema:{tier:E.enum(["pre-commit","pre-push","all"]).optional().describe("Stage tier (default pre-commit)"),strict:E.boolean().optional().describe("Promote warn findings to blocking (default true)")}},async i=>{let o=ode();if(!o)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Lt,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let s=i.tier??"pre-commit",a=i.strict!==!1,c=rde(o,["check",`--tier=${s}`,...a?["--strict"]:[],"--json"],{cwd:e,encoding:"utf8",timeout:3e5});try{let l=JSON.parse(c.stdout||"");return{isError:(l.worst??1)!==0,content:[{type:"text",text:JSON.stringify({schema_version:Lt,...l},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Lt,error:"gate produced no parseable JSON",stderr:(c.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_verdict",{title:"Poll the loop verdict",description:"One-poll loop decision over the real pre-push strict gate + feature statuses. Runs the gate ONCE and reduces it to {verdict, next_action, remaining} \u2014 call this INSTEAD OF clad_run_gate per loop turn, not in addition. verdict is one of DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP; DONE requires a green gate AND every feature done AND at least one non-liveness behavioral proof.",inputSchema:{tier:E.enum(["pre-commit","pre-push","all"]).optional().describe("Gate tier (default pre-push)")}},async i=>{let o=ode();if(!o)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Lt,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let s=rde(o,["verdict","--json",...i.tier?[`--tier=${i.tier}`]:[]],{cwd:e,encoding:"utf8",timeout:3e5});try{let a=JSON.parse(s.stdout||"");return{isError:!1,content:[{type:"text",text:JSON.stringify({schema_version:Lt,...a},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Lt,error:"verdict produced no parseable JSON",stderr:(s.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_get_context",{title:"Get the context slice for one feature",description:"Returns the working set for ONE feature in one call: the focus feature (full), its transitive depends_on ancestors (title+status), bound scenarios, the matching ai_hints patterns, and the union of the feature's test_refs. Look up by feature id (F-\u2026), slug, or a module path. Prefer this over reading shards by hand \u2014 dispatch the slice, never the whole spec.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)")}},async i=>{try{let o=ua(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=gl(o.spec,i.query),a="not_found"in s;return Xq(e,"clad_get_context",i.query,!a),{isError:a,content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_working_set",{title:"Get the token-budgeted working set for one feature (code + needs + breaks)",description:"Returns ONE token-budgeted working set for a feature/module: must_edit (focus + full ACs + the ACTUAL source code of its modules), needs (forward depends_on), breaks_if_changed (direct dependents + the regression test set), verify (scenarios + tests + oracle_refs + EARS unwanted/state high-risk ACs), guidance (ai_hints), and budget (what was clipped to fit). One call replaces reading the shard + opening each module file + grepping deps/tests. Look up by feature id (F-\u2026), slug, or module path.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)"),max_tokens:E.number().int().positive().max(2e4).optional().describe("Token budget for the payload (default 3000); distant deps then code then tests are clipped to fit")}},async i=>{try{let o=ua(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=xa(o.spec,i.query,{cwd:e,maxTokens:i.max_tokens}),a="not_found"in s?null:{truncated:s.budget.truncated.length>0,sliceTokens:s.budget.used_tokens};return Xq(e,"clad_get_working_set",i.query,a!==null,a??void 0),{isError:"not_found"in s,content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_impact",{title:"Get the blast radius for a change (reverse / impact slice)",description:"Returns what a change to ONE feature or file could break: the transitive dependents (id+title+status), the scenarios bound to any of them, the deduped union of their test_refs (the regression set to re-run), and the modules in the radius. Look up by feature id (F-\u2026), slug, or a module path \u2014 a module fans out to ALL features that touch it. The backward complement of clad_get_context: forward = what this needs, impact = what depends on this. Prefer this over grepping to scope a safe refactor.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/spec/load.ts)"),max_depth:E.number().int().positive().max(6).optional().describe("Bound the dependent walk to N hops (default: unbounded \u2014 the full transitive radius)")}},async i=>{try{let o=ua(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=Sr(o.spec,i.query,{depth:i.max_depth}),a="not_found"in s;return Xq(e,"clad_get_impact",i.query,!a),{isError:a,content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_graph",{title:"Get the live knowledge graph (focused neighborhood, or a stats summary)",description:"With query: the focus node\u2019s N-hop neighborhood (typed nodes + edges; a path query unions its kind-twins). WITHOUT query: a compact stats summary (counts by kind + top hubs) \u2014 the full graph is tens of thousands of tokens, so use `clad graph export --format json` for a complete dump. Recomputed live, never stale. Node kinds + edge types: docs/knowledge-graph/design.md.",inputSchema:{query:E.string().optional().describe("Focus node: feature id (F-\u2026), slug, or module path. Omit for the stats summary."),max_depth:E.number().int().positive().max(6).optional().describe("Neighborhood radius around the focus node (default: full reachable subgraph from the focus)")}},async i=>{try{let o=ua(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=o.spec,a=$c(s,e);if(!i.query)return{content:[{type:"text",text:JSON.stringify({schema_version:Lt,summary:!0,stats:Gx(a),hint:"pass query (feature id, slug, or module path) for a neighborhood subgraph; `clad graph export --format json` dumps the full graph"},null,2)}]};let c=Fx(s,a,i.query);if(c.length===0)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Lt,not_found:i.query,accepted_forms:["feature id (F-\u2026)","slug","module path"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); if the query is a file, fall back to normal code search"},null,2)}]};let l=Mx(a,c,i.max_depth??1/0);return{content:[{type:"text",text:JSON.stringify({schema_version:Lt,...l},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_changelog",{title:"Collect shipped changes since a git ref (changelog manifest)",description:"The deterministic shipped-changes manifest for ..HEAD (default since: latest tag): done-feature shards grouped by capability, the inventory count diff, and feat:/fix: commits naming no feature id. For human release notes, render FROM the manifest \u2014 never invent a change it does not carry. Formats (manifest/markdown/audit/catalog): skills/changelog/SKILL.md.",inputSchema:{since:E.string().optional().describe("Git ref to diff from (default: latest tag via `git describe --tags --abbrev=0`)"),format:E.enum(["manifest","markdown","catalog","audit"]).optional().describe("Payload format (default 'manifest')")}},async i=>{try{let o=i.format??"manifest";if(o==="catalog"){let l=vl(q(e));return{content:[{type:"text",text:JSON.stringify({schema_version:Lt,format:o,content:l},null,2)}]}}let s=i.since??ns(e),a=is(e,s);if(o==="manifest")return{content:[{type:"text",text:JSON.stringify({schema_version:Lt,...a},null,2)}]};let c=o==="audit"?bl(a,q(e),e):_l(a);return{content:[{type:"text",text:JSON.stringify({schema_version:Lt,format:o,content:c},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_events",{title:"Get recent cladding events",description:"Reads .cladding/events.log and returns the most recent entries.",inputSchema:{limit:E.number().int().positive().max(500).optional().describe("Maximum entries to return (default 50)")}},async i=>{let o=i.limit??50,s=Ct(e,".cladding","events.log.jsonl");if(!An(s))return{content:[{type:"text",text:JSON.stringify({events:[],note:"no events log yet"})}]};let l=da(s,"utf8").split(` `).filter(u=>u.trim().length>0).slice(-o).map(u=>{try{return JSON.parse(u)}catch{return{unparseable:u.slice(0,200)}}});return{content:[{type:"text",text:JSON.stringify({events:l},null,2)}]}}),t.registerTool("clad_create_feature",{title:"Create a new cladding feature",description:"Creates spec/features/.yaml with an auto-generated F- id. Author the feature WITH its acceptance_criteria (and modules) in this one call \u2014 an AC-less feature is a hollow stub that governs nothing. Hash ids are collision-safe across concurrent branches; see docs/spec-ids-multi-dev.md.",inputSchema:{slug:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Kebab-case slug \u2014 filename + spec.slug field (e.g. 'login-flow')"),title:E.string().optional().describe("Optional human-readable title; defaults to slug"),status:E.enum(["planned","in_progress","done","blocked","archived"]).optional().describe("Optional status; defaults to 'planned'"),modules:E.array(E.string()).optional().describe('Module paths the feature binds to (e.g. ["src/auth/login.ts"]).'),acceptance_criteria:E.array(E.object({ears:E.enum(["ubiquitous","event","state","optional","unwanted","complex"]).optional(),text:E.string().optional().describe('The "The system shall \u2026" statement.'),action:E.string().optional(),response:E.string().optional(),condition:E.string().optional().describe("Trigger/precondition for event/state EARS."),test_refs:E.array(E.string()).optional().describe("Paths to verifying tests."),evidence_refs:E.array(E.string()).optional(),notes:E.string().optional()})).optional().describe("Acceptance criteria authored now (ids auto-assigned AC-001\u2026). Strongly preferred over an empty feature \u2014 this is what makes the feature governable."),design_impact:E.discriminatedUnion("classification",[E.object({classification:E.literal("none"),rationale:E.string().min(1)}),E.object({classification:E.literal("additive"),rationale:E.string().min(1),capability:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/),capability_title:E.string().min(1).optional(),scenario:E.string().min(1).optional()}),E.object({classification:E.literal("structural"),rationale:E.string().min(1),artifacts:E.array(E.enum(["spec/architecture.yaml","spec/capabilities.yaml","docs/project-context.md"])).min(1)})]).optional().describe("Optional design-impact decision. Omit for the legacy-compatible create-only path; structural changes remain review_required until resolved.")}},async i=>{let o=_y(e);if(o)return o;let s=hde(e,sde);try{let a=Kue({slug:i.slug,title:i.title,status:i.status,modules:i.modules,acceptance_criteria:i.acceptance_criteria,design_impact:i.design_impact?{classification:i.design_impact.classification,rationale:i.design_impact.rationale,artifacts:i.design_impact.classification==="structural"?i.design_impact.artifacts:void 0}:void 0,cwd:e});i.design_impact?.classification==="additive"&&(Jq({capability:i.design_impact.capability,feature:a.id,title:i.design_impact.capability_title,cwd:e}),i.design_impact.scenario&&Vue({scenario:i.design_impact.scenario,feature:a.id,cwd:e})),vy(e);let c=i.design_impact,l={schema_version:Lt,...a,gate:by(e),...c?{designImpact:c.classification==="structural"?{status:"review_required",artifacts:c.artifacts,next:"Preview and apply the listed Tier-B design changes, then call clad_resolve_design_impact."}:{status:"resolved",classification:c.classification}}:{hint:`If this feature is user-facing, link it to a capability with clad_link_capability (capability: , feature: ${a.id}) so the Tier-B design SSoT grows with development instead of being left an empty seed.`}};return{content:[{type:"text",text:JSON.stringify(l,null,2)}]}}catch(a){return gde(e,sde,s),{isError:!0,content:[{type:"text",text:a.message}]}}}),t.registerTool("clad_resolve_design_impact",{title:"Resolve a reviewed structural design impact",description:"Marks a feature structural design impact resolved only after the user-approved Tier-B changes have been applied. Do not call this merely to clear the gate; verify every artifact listed in the feature first.",inputSchema:{feature:E.string().describe("Feature id whose listed Tier-B design changes are now applied.")}},async i=>{let o=_y(e);if(o)return o;try{let s=Wue({feature:i.feature,cwd:e});return vy(e),{content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s,gate:by(e)},null,2)}]}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}}),t.registerTool("clad_author_oracle",{title:"Record an impl-blind spec-conformance oracle",description:"Records a host-authored conformance oracle for a feature AC + its impl-blind PROVENANCE, writes the test under tests/oracle/, and stamps oracle_refs so the SPEC_CONFORMANCE gate verifies it. cladding does NOT author the oracle. AUTHOR ONLY ACs on the policy worklist (`clad oracle --required`) \u2014 an empty worklist means do not author unless the user explicitly asks (out-of-policy recordings are labeled voluntary). FIRST run `clad oracle --ac ` for the spec-only brief; spawn a FRESH sub-agent given ONLY that brief (never the implementation); have it write the test; then call this with the body + the manifest of exactly what the sub-agent saw. Blindness is your discipline \u2014 the gate audits the manifest (manifest\u2229modules must be empty) and the author\u2260implementer identity, and records whether you attested a clean (blind) context.",inputSchema:{featureId:E.string().describe("The F- feature id."),acId:E.string().describe("The AC- the oracle verifies."),body:E.string().describe("The authored vitest oracle source (imports the module under test)."),readManifest:E.array(E.string()).describe("EXACTLY what the blind sub-agent was shown (the clad oracle brief: spec/AC + signatures). MUST NOT include an implementation file the feature owns."),blind:E.boolean().optional().describe("True only if the sub-agent saw the spec-only brief and nothing else."),authorName:E.string().optional().describe("Oracle author identity (sub-agent / model id) \u2014 must differ from the implementer for the gate to pass.")}},async i=>{let o=_y(e);if(o)return o;try{let s=ede({featureId:i.featureId,acId:i.acId,body:i.body,readManifest:i.readManifest,blind:i.blind,authorName:i.authorName,cwd:e});vy(e);let a={};try{let c=q(e),l=Lp(c.project,zp(c)),d=c.features.find(f=>f.id===i.featureId)?.acceptance_criteria?.find(f=>f.id===i.acId);(!d||!Up(l,i.featureId,d))&&(a={voluntary:!0,cost_note:"this AC is not on the project's oracle worklist (`clad oracle --required`) \u2014 recording anyway as voluntary; prefer policy-listed ACs to keep token spend inside the declared verification budget."})}catch{}return{content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s,...a,gate:by(e)},null,2)}],isError:!s.ok}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}}),t.registerTool("clad_create_scenario",{title:"Create a new cladding scenario",description:"Creates spec/scenarios/-.yaml with an auto-generated S- id. Same multi-dev safety property as clad_create_feature: two concurrent invocations on separate branches produce distinct hash ids by construction.",inputSchema:{slug:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Kebab-case slug (e.g. 'checkout-happy-path')"),title:E.string().optional().describe("Optional human-readable title; defaults to slug"),flow:E.string().optional().describe("Prose user-journey flow (what the user does, step by step)."),features:E.array(E.string().regex(/^F-(\d{3,}|[a-f0-9]{6,})$/)).optional().describe("Optional list of feature ids the scenario touches")}},async i=>{let o=_y(e);if(o)return o;try{let s=Jue({slug:i.slug,title:i.title,flow:i.flow,features:i.features,cwd:e});return vy(e),{content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s,gate:by(e)},null,2)}]}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}}),t.registerTool("clad_link_capability",{title:"Link a feature to a capability",description:"Upserts a feature into spec/capabilities.yaml: creates the capability if absent, else appends the feature to its features[] (deduped). A capability is ACCUMULATIVE, so the verb is link, not create. Use this when a user-facing feature lands so the design tier grows with development instead of being left an empty seed.",inputSchema:{capability:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Capability id (kebab-slug, e.g. 'auth'). Created if it does not exist yet."),feature:E.string().regex(/^F-(\d{3,}|[a-f0-9]{6,})$/).describe("Feature id to add to the capability"),title:E.string().optional().describe("Title, used only when the capability is newly created"),summary:E.string().optional().describe("Summary, used only when newly created"),surface:E.enum(["feature","platform","tool","infrastructure"]).optional().describe("Surface, used only when newly created")}},async i=>{let o=_y(e);if(o)return o;try{let s=Jq({capability:i.capability,feature:i.feature,title:i.title,summary:i.summary,surface:i.surface,cwd:e});return vy(e),{content:[{type:"text",text:JSON.stringify({schema_version:Lt,...s,gate:by(e)},null,2)}]}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}})}function vy(t){try{if(An(Ct(t,"spec.yaml"))){if(_a(t))return;Yl(t,bs(t)),Ja(t),i0(t)}}catch{}}function V8e(t,e){let r=Ct(e,"spec","features"),n=t.map(i=>{let o=i.slug,s=[o?Ct(r,`${o}-${i.id.slice(2)}.yaml`):null,Ct(r,`${i.id}.yaml`)].filter(c=>c!==null),a=0;for(let c of s)try{if(An(c)){a=AA(c).mtimeMs;break}}catch{}return{feature:i,mtime:a}});return n.sort((i,o)=>o.mtime-i.mtime),n.map(i=>i.feature)}function W8e(t,e){t.registerResource("spec",la.spec,{title:"Cladding spec",description:"The active spec.yaml \u2014 aggregated when sharded.",mimeType:"application/json"},async()=>{let r=ua(e),n="error"in r?JSON.stringify({error:r.error},null,2):JSON.stringify(r.spec,null,2);return{contents:[{uri:la.spec,mimeType:"application/json",text:n}]}}),t.registerResource("events",la.events,{title:"Cladding events log",description:"Raw JSONL stream of feature_activated, evidence_appended, gate_run, \u2026",mimeType:"application/x-ndjson"},async()=>{let r=Ct(e,".cladding","events.log.jsonl"),n=An(r)?da(r,"utf8"):"";return{contents:[{uri:la.events,mimeType:"application/x-ndjson",text:n}]}}),t.registerResource("audit",la.audit,{title:"Cladding audit log",description:"HITL audit log \u2014 every persona dispatch and human signoff.",mimeType:"application/x-ndjson"},async()=>{let r=Ct(e,".cladding","audit.log.jsonl"),n=An(r)?da(r,"utf8"):"";return{contents:[{uri:la.audit,mimeType:"application/x-ndjson",text:n}]}})}function K8e(t,e){let r=(n,i,o)=>{t.registerPrompt(n,{title:`Cladding persona \u2014 ${i}`,description:o,argsSchema:{featureId:E.string().optional().describe("Optional feature id to interpolate into the persona context")}},s=>{let a=my(i),c=s.featureId?` Active feature: ${s.featureId} @@ -960,4 +960,4 @@ ${o.length} AC(s) required, ${s.length} missing an oracle. `);e.length>5&&B.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` `)}}function y4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function V5e(t){let e=q();if(t.json){B.stdout.write(`${JSON.stringify(o0(e,"."),null,2)} `),B.exitCode=0;return}B.stdout.write(`${nre(e,".",{internal:t.internal})} -`),B.exit(0)}function W5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),B.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=vl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:_l(u),auditMarkdown:bl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=NG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),B.exit(1);return}try{O5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),B.exit(1);return}L("pass","bundle",`${r} \xB7 ${W5e(Buffer.byteLength(n,"utf8"))}`),B.exit(0)}function J5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),B.exit(e==="unknown"?1:0)}function Y5e(){let t=new I4;t.name("clad").description("Reference Ironclad CLI").version("0.9.2"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(I5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(P5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(C5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(j5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(M5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(B5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(D5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(H5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>G5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(N5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(V5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(L5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>z5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>XX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>U5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>q5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>wte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>xte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{$te(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>SG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>NY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>K5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(J5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(BX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(R5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){uX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}FY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ote),t}var X5e=!!globalThis.__CLADDING_BUNDLED,Q5e=X5e||import.meta.url===`file://${B.argv[1]}`;Q5e&&Y5e().parse();export{F5e as TIER_STAGES,Y5e as createProgram,K5e as runBundleCommand,B5e as runCheckCommand,IA as runCheckStages,D5e as runCheckpointCommand,L5e as runContextCommand,H5e as runDoneCommand,z5e as runImpactCommand,U5e as runInferDepsCommand,I5e as runInitCommand,q5e as runMeasureCommand,G5e as runOracleCommand,N5e as runRollbackCommand,J5e as runRouteCommand,P5e as runRunCommand,R5e as runServeCommand,j5e as runSetupCommand,V5e as runStatusCommand,C5e as runSyncCommand,M5e as runUpdateCommand}; +`),B.exit(0)}function W5e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K5e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){L("fail","bundle","missing --out \u2014 the bundle needs a destination path"),B.exit(1);return}let n;try{let i=q(e),o=o0(i,e),s={gitHead:Sa(e),version:ru(),generatedAt:t.now??new Date().toISOString()},a=vl(i),c;try{let l=t.since??ns(e),u=is(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:_l(u),auditMarkdown:bl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=NG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),B.exit(1);return}try{O5e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),B.exit(1);return}L("pass","bundle",`${r} \xB7 ${W5e(Buffer.byteLength(n,"utf8"))}`),B.exit(0)}function J5e(t){let e=JA(t);L("note",`route \u2192 ${e}`,t),B.exit(e==="unknown"?1:0)}function Y5e(){let t=new I4;t.name("clad").description("Reference Ironclad CLI").version("0.9.3"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(I5e),t.command("run [goal]").description("(experimental) Headless autonomous loop \u2014 iterate ready features, dispatch developer + reviewer personas, run L1 gates, record evidence. The supported, exercised path is host-delegated (clad serve + your AI host loops the cadence); this loop needs a real LLM transport and is not auto-invoked").option("--cwd ","target project directory (default cwd)").option("--max-iterations ","cap iterations (default 50)","50").option("--max-wall-clock-ms ","cap wall clock (default 600000)","600000").option("--max-retries ","cap retries per feature (default 3)","3").option("--json","emit the raw internal result (Iron Core view); default is a plain Soft Shell summary").action(P5e),t.command("sync").description("Validate spec.yaml against schema and report").option("--propose-archive","list STALE_SPECIFICATION findings whose suggestion.action is propose-archive (Phased Decommissioning Tier 2)").action(C5e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Gemini / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate detected hosts (default), all, or one of: claude, codex, gemini, antigravity, cursor").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(j5e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh managed CLAUDE.md/AGENTS.md, then report stricter detector findings").action(M5e),t.command("check").description("Run every Iron Law stage and the drift detector suite").option("--internal","show stage codes (`stage_1.1`) instead of names (`Type`)").option("--strict","promote warn-severity drift findings to errors (CI / pre-publish gate)").option("--tier ","run only the stages for a trigger: pre-commit (drift/arch/secret) | pre-push (+ type/lint/unit/cov/spec-conformance/deliverable-smoke) | all (default; full 15-stage gate, used by CI)").option("--json","emit structured per-stage results (machine-readable: findings with file/line/suggestion, untruncated) \u2014 for agents/CI; cuts RED\u2192fix round-trips").option("--feature ","scope the gate to this feature's modules[] (Gradle monorepos): runs only :project: tasks instead of the root aggregate. No-op for non-Gradle repos or modules-less features").action(B5e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(D5e),t.command("done ").description("Mark a feature done ONLY if `clad check --tier=pre-push --strict` is GREEN (flip \u2192 gate \u2192 revert-on-red). Keeps `done` honest.").action(H5e),t.command("oracle [featureId]").description("Print the impl-blind oracle authoring brief (acceptance criteria + signatures, never the implementation). Hand it to a fresh blind sub-agent; record the result with clad_author_oracle. cladding calls no LLM. Use --required to list which done ACs the project policy needs an oracle for.").option("--ac ","restrict the brief to a single acceptance criterion").option("--required","list the done ACs the oracle_policy / require_oracles requires an oracle for (worklist), instead of a brief").option("--cwd ","project root (defaults to .)").action((r,n)=>G5e(r,n)),t.command("rollback ").description("Record a rollback event and print the maintainer-runnable git command for the latest checkpoint").option("-r, --reason ","optional free-text reason recorded on the event payload").action(N5e),t.command("status").description("Render the feature \xD7 stage integrity matrix (business titles; use --internal for raw F-NNN ids)").option("--internal","show internal F-NNN ids and stage codes").option("--json","emit the row model as JSON \u2014 the same feature \xD7 stage integrity matrix rendered to the terminal (columns + per-feature glyph cells), one SSoT for terminal, JSON, and the audit bundle").action(V5e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(L5e),t.command("impact ").description("Print the blast radius for a change \u2014 what depends on a feature/file + the tests to re-run (F-7794a6bc)").option("--depth ","bound the dependent walk to N hops (default: the full transitive radius)").action((r,n)=>z5e(r,n)),t.command("verdict").description("One-poll loop decision: DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP over the pre-push strict gate + feature statuses (F-2e28cc72). Single gate touch; DONE requires \u22651 non-liveness proof.").option("--json","emit the verdict object as JSON").option("--tier ","gate tier (default pre-push)").action(r=>XX(r,{checkStages:IA})),t.command("infer-deps").description("Suggest feature depends_on edges from the code import graph \u2014 the dependency edges cladding never auto-produced (F-2be3e3bb). Prints reviewable suggestions; does not write the spec.").option("--ambiguity ","emit edges for imports owned by \u2264 N features (default 1 = unambiguous single-owner only)").action(r=>U5e(r)),t.command("measure").description("Report the search + context efficiency the graph provides per feature \u2014 working-set tokens vs the naive baseline, dependency depth/edges resolved, regression-set coverage (F-16138071). Deterministic; no agent.").option("--json","emit the full report as JSON").option("--sessions","summarize recorded value-delivery telemetry instead \u2014 impact-card fire rate over eligible edits, the per-reason skip histogram, and MCP read-serve counts. Measures DELIVERY (did the surfaces fire), NOT adoption (F-6ba22c5c).").option("--trend [n]","render the last N (default 5) recorded measure snapshots with signed deltas \u2014 spot efficiency drift over time from the deduped .cladding/measure.jsonl ledger (F-39609db4)").action(r=>q5e(r));let e=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return e.command("export").description("Export the graph: mermaid/dot/json to stdout, or an Obsidian vault to --out").option("--format ","mermaid | dot | json | obsidian | html (default: mermaid). html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to a feature/file node\u2019s neighborhood (id, slug, or module path)").option("--depth ","neighborhood radius around --focus (default: unbounded)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(r=>wte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>xte()),e.command("serve").description("Serve a LIVE graph at localhost \u2014 recomputes on each load + auto-reloads on spec/doc changes (F-64a5c159)").option("--port ","port to listen on (default 3000)").action(r=>{$te(r)}),t.command("changelog").description("Render shipped changes since a git ref into human-facing documents (F-904495a5). Default: capability-grouped markdown from feature titles + acceptance sentences (no internal ids). --json emits the deterministic manifest hosts render release notes from; --audit the id-keeping verification table; --catalog the full capability \u2192 feature \u2192 acceptance catalog.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--json","print the deterministic ChangelogManifest as JSON (byte-identical across runs on the same state)").option("--audit","print the audit table \u2014 feature | AC | EARS | verification refs, each marked resolved \u2713/\u2717").option("--catalog","print the full capability \u2192 feature \u2192 acceptance listing of the living spec (no git range)").option("--measure","embed the release's own re-derivable measurement \u2014 but ONLY a snapshot taken at the current HEAD; no match renders a not-measured notice, never an older snapshot (F-ede6fa75)").action(r=>SG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec entry movement (from the changelog), how each acceptance criterion moved, changed source files resolved to their owning features via the reverse index, the tests those features declare, the deduped regression set, and gate + attestation state. For PR reviewers, team-leads, and auditors: it RENDERS, it gates nothing. Byte-identical across two runs on the same repository state.").option("--since ","git ref to diff from (default: the latest tag via `git describe --tags --abbrev=0`)").option("--format ","md (default, the six-section markdown packet) | sarif (SARIF 2.1.0 \u2014 one result per error/warn drift finding, for code-scanning UIs) | json (the raw deterministic model)").action(r=>NY(r)),t.command("bundle").description("Write ONE self-contained HTML audit bundle (F-e940fffe) a non-coder can double-click \u2014 offline, zero network, no CDN, no scripts. Contains the project header + inventory, the feature \xD7 stage matrix, the capability catalog, shipped changes for the range, the audit table with resolved refs, and the attestation summary, under a provenance banner (git HEAD, date, version). Deterministic modulo the date stamp. If no anchor ref resolves, the changelog + audit sections show an omitted notice while the rest still renders.").requiredOption("--out ","destination path for the HTML bundle").option("--since ","git ref to diff shipped changes from (default: the latest tag via `git describe --tags --abbrev=0`)").action(r=>K5e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(J5e),t.command("hook ").description("Host hook protocol adapter \u2014 consume one host lifecycle event (SessionStart | UserPromptSubmit | PreToolUse | PostToolUse | Stop) as stdin JSON and print the protocol response on stdout. Always exits 0 so a hook failure never bricks the host session.").action(BX),t.command("serve").description("Run cladding as an MCP server over stdio \u2014 tools/resources/prompts for any MCP client").option("--cwd ","project directory exposed to the client (default cwd)").action(R5e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").option("--cwd ","project directory to read events from (default cwd)").option("--json","emit the raw DoctorReport for tooling; default is the human-readable surface").option("--hosts","smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring \u2192 dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run").option("--yes","grant live-run consent for --hosts (equivalent to CLAD_HOST_SMOKE=1)").option("--matrix-only","regenerate docs/dogfood/matrix.md from the newest host-smoke artifact without any probing").action(r=>{if(r.hosts||r.matrixOnly){uX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}FY(r)}),t.command("clarify [answer...]").description("Advance the onboarding Q&A loop. Pass the user's answer to the next pending question as a positional (no quotes needed, free text in any language, e.g. `clad clarify B2B only`); the LLM refines spec/docs based on the full Q-A history and may emit new follow-up questions. Reads/writes `.cladding/onboarding/state.yaml`. Requires `clad init ` to have started a session first.").option("--cwd ","project directory containing .cladding/onboarding/state.yaml (default cwd)").option("--no-llm","force the deterministic interpreter (preserves current artifacts, logs the answer)").option("--json","emit the raw RefineReport for tooling; default is the human-readable surface").action(ote),t}var X5e=!!globalThis.__CLADDING_BUNDLED,Q5e=X5e||import.meta.url===`file://${B.argv[1]}`;Q5e&&Y5e().parse();export{F5e as TIER_STAGES,Y5e as createProgram,K5e as runBundleCommand,B5e as runCheckCommand,IA as runCheckStages,D5e as runCheckpointCommand,L5e as runContextCommand,H5e as runDoneCommand,z5e as runImpactCommand,U5e as runInferDepsCommand,I5e as runInitCommand,q5e as runMeasureCommand,G5e as runOracleCommand,N5e as runRollbackCommand,J5e as runRouteCommand,P5e as runRunCommand,R5e as runServeCommand,j5e as runSetupCommand,V5e as runStatusCommand,C5e as runSyncCommand,M5e as runUpdateCommand}; diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json index 5751c097..0d5cc9d7 100644 --- a/plugins/codex/.codex-plugin/plugin.json +++ b/plugins/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for OpenAI Codex CLI / IDE / cloud. Exposes spec validation, drift detection, the Iron Law stage runner, and 5 agent personas as Codex skills + an auto-launched MCP server.", "author": { "name": "qwerfunch", diff --git a/plugins/gemini-cli/gemini-extension.json b/plugins/gemini-cli/gemini-extension.json index a00d0f3b..f3f74882 100644 --- a/plugins/gemini-cli/gemini-extension.json +++ b/plugins/gemini-cli/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.2", + "version": "0.9.3", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Gemini CLI. Exposes spec validation, drift detection, 15 Iron Law stages, and 5 agent personas as custom commands + an auto-launched MCP server.", "contextFileName": "GEMINI.md", "mcpServers": { diff --git a/spec.yaml b/spec.yaml index 149945fa..6afa3f68 100644 --- a/spec.yaml +++ b/spec.yaml @@ -11,7 +11,7 @@ project: name: cladding language: typescript description: "Reference implementation of the Ironclad harness for AI-coupled software." - version: "0.9.2" + version: "0.9.3" repository: "https://github.com/qwerfunch/cladding" intent_summary: "Make AI-coupled development measurably safer and more honest — 41 drift detectors + 4-tier SSoT governance + A/B-measurable cladding-vs-vanilla evaluation." deliverable: diff --git a/spec/attestation.yaml b/spec/attestation.yaml index fcb4f079..8c131933 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -17,15 +17,15 @@ attested_modules: .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: 5b2341399d2f1352 + CHANGELOG.md: f2d8bae463e3279e CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: a2df07e5e20a4f73 - README.ja.md: ce56f385afe06d96 - README.ko.html: dd2f20cab0d9419f - README.ko.md: 91428537bd396ab7 - README.md: c01043c6b6877d4e - README.zh.md: 4e37e686c9923c50 + README.html: 042398234df7c6db + README.ja.md: c0e21f65682fdddf + README.ko.html: c6c9c457101a7faa + README.ko.md: d5c8665fb5126908 + README.md: 988329327e2b04dd + README.zh.md: ac6e59d1dfb425da SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -71,9 +71,9 @@ attested_modules: docs/spec-ids-multi-dev.md: 28d58e84879f58b1 docs/ssot-model.md: 66b9439e2f71ac4b docs/ssot-testing.md: abf3b2bd5acb29a1 - package-lock.json: efa9090e0ef4bf1f - package.json: 00272205b48b15df - plugins/claude-code/.claude-plugin/plugin.json: fcfe09c82ca6492b + package-lock.json: 505b6ea10c37fcf6 + package.json: bc72ea4dbf16fc7d + plugins/claude-code/.claude-plugin/plugin.json: e46cfdf3bf480696 plugins/claude-code/agents/developer.md: 3002b4ef69ddab43 plugins/claude-code/agents/observability.md: 637fde18c012e2a7 plugins/claude-code/agents/orchestrator.md: 1b758de0bdab8eb0 @@ -81,7 +81,7 @@ attested_modules: plugins/claude-code/agents/reviewer.md: cdf7469a3e58b438 plugins/claude-code/commands/init.md: 5529b13d0f1ab4bf plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 - plugins/codex/.codex-plugin/plugin.json: da272fa283026dc2 + plugins/codex/.codex-plugin/plugin.json: b662ba85804e6abb plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 6a665422af510e72 plugins/codex/skills/developer/SKILL.md: 3002b4ef69ddab43 @@ -97,7 +97,7 @@ attested_modules: plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd plugins/gemini-cli/commands/init.toml: e7f310fd7af23f95 - plugins/gemini-cli/gemini-extension.json: 729b2c69fdc0b650 + plugins/gemini-cli/gemini-extension.json: 082af8a03ae1601d scripts/build-plugin.mjs: 7fabe2b6301b142a scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 @@ -117,7 +117,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: a4b96c80076cda52 + spec.yaml: 35b159a6c3949112 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -150,7 +150,7 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: cc75609f5b7633a4 + src/cli/clad.ts: a02fe02bcb5e942d src/cli/clarify.ts: f17177969d5b75ff src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 src/cli/doctor.ts: b98b955fe75e7f7e @@ -234,7 +234,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: a63dde88609a6abe + src/serve/server.ts: 0a76fefb0aca1434 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -341,7 +341,7 @@ attested_modules: tests/adapters/transport.test.ts: 68f22e9e8df7b813 tests/agents/loader.test.ts: a7df7b1c9a95d37d tests/cli/benchmark.test.ts: b4a87289605ee75f - tests/cli/clad.test.ts: d559fff3bd530bad + tests/cli/clad.test.ts: 95a6303c6d9437e2 tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 686cf3e0..613bf3c7 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -1096,7 +1096,7 @@ export function runRouteCommand(prompt: string): void { */ export function createProgram(): Command { const program = new Command(); - program.name('clad').description('Reference Ironclad CLI').version('0.9.2'); + program.name('clad').description('Reference Ironclad CLI').version('0.9.3'); program .command('init [intent...]') diff --git a/src/serve/server.ts b/src/serve/server.ts index c340949a..c8930933 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -174,7 +174,7 @@ export function buildServer(opts: ServerOptions = {}): McpServer { const server = new McpServer( { name: opts.name ?? 'cladding', - version: opts.version ?? '0.9.2', + version: opts.version ?? '0.9.3', }, { instructions: diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 2364cfc1..1891590e 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -561,7 +561,7 @@ describe('cli/clad — createProgram', () => { test('program version matches current package version', () => { const program = clad.createProgram(); - expect(program.version()).toBe('0.9.2'); + expect(program.version()).toBe('0.9.3'); }); });