@coryrylan/cradle 0.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var r2=Object.create;var{getPrototypeOf:a2,defineProperty:NF,getOwnPropertyNames:e2}=Object;var D8=Object.prototype.hasOwnProperty;function u8(D){return this[D]}var F8,C8,E8=(D,u,F)=>{var C=D!=null&&typeof D==="object";if(C){var E=u?F8??=new WeakMap:C8??=new WeakMap,B=E.get(D);if(B)return B}F=D!=null?r2(a2(D)):{};let z=u||!D||!D.__esModule?NF(F,"default",{value:D,enumerable:!0}):F;for(let X of e2(D))if(!D8.call(z,X))NF(z,X,{get:u8.bind(D,X),enumerable:!0});if(C)E.set(D,z);return z};var B8=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var f0=B8((q7,Y0)=>{Y0.exports=function(u){if(u===void 0)u=2;if(u>=Error.stackTraceLimit)throw TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+u+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var F=Error.prepareStackTrace;Error.prepareStackTrace=function(E,B){return B};var C=Error().stack;if(Error.prepareStackTrace=F,C!==null&&typeof C==="object")return C[u]?C[u].getFileName():void 0}});import{basename as E6,join as s2}from"path";import{notStrictEqual as n8,strictEqual as i8}from"assert";var $8={right:X8,center:G8};class AF{constructor(D){var u;this.width=D.width,this.wrap=(u=D.wrap)!==null&&u!==void 0?u:!0,this.rows=[]}span(...D){let u=this.div(...D);u.span=!0}resetOutput(){this.rows=[]}div(...D){if(D.length===0)this.div("");if(this.wrap&&this.shouldApplyLayoutDSL(...D)&&typeof D[0]==="string")return this.applyLayoutDSL(D[0]);let u=D.map((F)=>{if(typeof F==="string")return this.colFromString(F);return F});return this.rows.push(u),u}shouldApplyLayoutDSL(...D){return D.length===1&&typeof D[0]==="string"&&/[\t\n]/.test(D[0])}applyLayoutDSL(D){let u=D.split(`
4
- `).map((C)=>C.split("\t")),F=0;return u.forEach((C)=>{if(C.length>1&&MD.stringWidth(C[0])>F)F=Math.min(Math.floor(this.width*0.5),MD.stringWidth(C[0]))}),u.forEach((C)=>{this.div(...C.map((E,B)=>{return{text:E.trim(),padding:this.measurePadding(E),width:B===0&&C.length>1?F:void 0}}))}),this.rows[this.rows.length-1]}colFromString(D){return{text:D,padding:this.measurePadding(D)}}measurePadding(D){let u=MD.stripAnsi(D);return[0,u.match(/\s*$/)[0].length,0,u.match(/^\s*/)[0].length]}toString(){let D=[];return this.rows.forEach((u)=>{this.rowToString(u,D)}),D.filter((u)=>!u.hidden).map((u)=>u.text).join(`
5
- `)}rowToString(D,u){return this.rasterize(D).forEach((F,C)=>{let E="";F.forEach((B,z)=>{let{width:X}=D[z],J=this.negatePadding(D[z]),f=B;if(J>MD.stringWidth(B))f+=" ".repeat(J-MD.stringWidth(B));if(D[z].align&&D[z].align!=="left"&&this.wrap){let O=$8[D[z].align];if(f=O(f,J),MD.stringWidth(f)<J)f+=" ".repeat((X||0)-MD.stringWidth(f)-1)}let W=D[z].padding||[0,0,0,0];if(W[3])E+=" ".repeat(W[3]);if(E+=RF(D[z],f,"| "),E+=f,E+=RF(D[z],f," |"),W[1])E+=" ".repeat(W[1]);if(C===0&&u.length>0)E=this.renderInline(E,u[u.length-1])}),u.push({text:E.replace(/ +$/,""),span:D.span})}),u}renderInline(D,u){let F=D.match(/^ */),C=F?F[0].length:0,E=u.text,B=MD.stringWidth(E.trimRight());if(!u.span)return D;if(!this.wrap)return u.hidden=!0,E+D;if(C<B)return D;return u.hidden=!0,E.trimRight()+" ".repeat(C-B)+D.trimLeft()}rasterize(D){let u=[],F=this.columnWidths(D),C;return D.forEach((E,B)=>{if(E.width=F[B],this.wrap)C=MD.wrap(E.text,this.negatePadding(E),{hard:!0}).split(`
3
+ var U8=Object.create;var{getPrototypeOf:W8,defineProperty:xF,getOwnPropertyNames:V8}=Object;var T8=Object.prototype.hasOwnProperty;function f8(D){return this[D]}var I8,L8,K8=(D,u,F)=>{var C=D!=null&&typeof D==="object";if(C){var E=u?I8??=new WeakMap:L8??=new WeakMap,B=E.get(D);if(B)return B}F=D!=null?U8(W8(D)):{};let $=u||!D||!D.__esModule?xF(F,"default",{value:D,enumerable:!0}):F;for(let Z of V8(D))if(!T8.call($,Z))xF($,Z,{get:f8.bind(D,Z),enumerable:!0});if(C)E.set(D,$);return $};var j8=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var T0=j8((B9,V0)=>{V0.exports=function(u){if(u===void 0)u=2;if(u>=Error.stackTraceLimit)throw TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+u+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var F=Error.prepareStackTrace;Error.prepareStackTrace=function(E,B){return B};var C=Error().stack;if(Error.prepareStackTrace=F,C!==null&&typeof C==="object")return C[u]?C[u].getFileName():void 0}});import{join as O8}from"path";import{notStrictEqual as G3,strictEqual as J3}from"assert";var _8={right:A8,center:S8};class hF{constructor(D){var u;this.width=D.width,this.wrap=(u=D.wrap)!==null&&u!==void 0?u:!0,this.rows=[]}span(...D){let u=this.div(...D);u.span=!0}resetOutput(){this.rows=[]}div(...D){if(D.length===0)this.div("");if(this.wrap&&this.shouldApplyLayoutDSL(...D)&&typeof D[0]==="string")return this.applyLayoutDSL(D[0]);let u=D.map((F)=>{if(typeof F==="string")return this.colFromString(F);return F});return this.rows.push(u),u}shouldApplyLayoutDSL(...D){return D.length===1&&typeof D[0]==="string"&&/[\t\n]/.test(D[0])}applyLayoutDSL(D){let u=D.split(`
4
+ `).map((C)=>C.split("\t")),F=0;return u.forEach((C)=>{if(C.length>1&&JD.stringWidth(C[0])>F)F=Math.min(Math.floor(this.width*0.5),JD.stringWidth(C[0]))}),u.forEach((C)=>{this.div(...C.map((E,B)=>{return{text:E.trim(),padding:this.measurePadding(E),width:B===0&&C.length>1?F:void 0}}))}),this.rows[this.rows.length-1]}colFromString(D){return{text:D,padding:this.measurePadding(D)}}measurePadding(D){let u=JD.stripAnsi(D);return[0,u.match(/\s*$/)[0].length,0,u.match(/^\s*/)[0].length]}toString(){let D=[];return this.rows.forEach((u)=>{this.rowToString(u,D)}),D.filter((u)=>!u.hidden).map((u)=>u.text).join(`
5
+ `)}rowToString(D,u){return this.rasterize(D).forEach((F,C)=>{let E="";F.forEach((B,$)=>{let{width:Z}=D[$],M=this.negatePadding(D[$]),O=B;if(M>JD.stringWidth(B))O+=" ".repeat(M-JD.stringWidth(B));if(D[$].align&&D[$].align!=="left"&&this.wrap){let Y=_8[D[$].align];if(O=Y(O,M),JD.stringWidth(O)<M)O+=" ".repeat((Z||0)-JD.stringWidth(O)-1)}let V=D[$].padding||[0,0,0,0];if(V[3])E+=" ".repeat(V[3]);if(E+=bF(D[$],O,"| "),E+=O,E+=bF(D[$],O," |"),V[1])E+=" ".repeat(V[1]);if(C===0&&u.length>0)E=this.renderInline(E,u[u.length-1])}),u.push({text:E.replace(/ +$/,""),span:D.span})}),u}renderInline(D,u){let F=D.match(/^ */),C=F?F[0].length:0,E=u.text,B=JD.stringWidth(E.trimRight());if(!u.span)return D;if(!this.wrap)return u.hidden=!0,E+D;if(C<B)return D;return u.hidden=!0,E.trimRight()+" ".repeat(C-B)+D.trimLeft()}rasterize(D){let u=[],F=this.columnWidths(D),C;return D.forEach((E,B)=>{if(E.width=F[B],this.wrap)C=JD.wrap(E.text,this.negatePadding(E),{hard:!0}).split(`
6
6
  `);else C=E.text.split(`
7
- `);if(E.border)C.unshift("."+"-".repeat(this.negatePadding(E)+2)+"."),C.push("'"+"-".repeat(this.negatePadding(E)+2)+"'");if(E.padding)C.unshift(...Array(E.padding[0]||0).fill("")),C.push(...Array(E.padding[2]||0).fill(""));C.forEach((z,X)=>{if(!u[X])u.push([]);let J=u[X];for(let f=0;f<B;f++)if(J[f]===void 0)J.push("");J.push(z)})}),u}negatePadding(D){let u=D.width||0;if(D.padding)u-=(D.padding[3]||0)+(D.padding[1]||0);if(D.border)u-=4;return u}columnWidths(D){if(!this.wrap)return D.map((B)=>{return B.width||MD.stringWidth(B.text)});let u=D.length,F=this.width,C=D.map((B)=>{if(B.width)return u--,F-=B.width,B.width;return}),E=u?Math.floor(F/u):0;return C.map((B,z)=>{if(B===void 0)return Math.max(E,z8(D[z]));return B})}}function RF(D,u,F){if(D.border){if(/[.']-+[.']/.test(u))return"";if(u.trim().length!==0)return F;return" "}return""}function z8(D){let u=D.padding||[],F=1+(u[3]||0)+(u[1]||0);if(D.border)return F+4;return F}function Z8(){if(typeof process==="object"&&process.stdout&&process.stdout.columns)return process.stdout.columns;return 80}function X8(D,u){D=D.trim();let F=MD.stringWidth(D);if(F<u)return" ".repeat(u-F)+D;return D}function G8(D,u){D=D.trim();let F=MD.stringWidth(D);if(F>=u)return D;return" ".repeat(u-F>>1)+D}var MD;function SF(D,u){return MD=u,new AF({width:(D===null||D===void 0?void 0:D.width)||Z8(),wrap:D===null||D===void 0?void 0:D.wrap})}function tu({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var Q8=tu();function vD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);if(!D.includes("\x1B")&&!D.includes("\x9B"))return D;return D.replace(Q8,"")}var xF=161,PF=1114109,bF=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],hF=12288,wF=65510,mF=[12288,12288,65281,65376,65504,65510];var cF=4352,vF=262141,du=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Wu=(D,u)=>{let F=0,C=Math.floor(D.length/2)-1;while(F<=C){let E=Math.floor((F+C)/2),B=E*2;if(u<D[B])C=E-1;else if(u>D[B+1])F=E+1;else return!0}return!1};var pF=19968,[J8,M8]=O8(du);function O8(D){let u=D[0],F=D[1];for(let C=0;C<D.length;C+=2){let E=D[C],B=D[C+1];if(pF>=E&&pF<=B)return[E,B];if(B-E>F-u)u=E,F=B}return[u,F]}var tF=(D)=>{if(D<xF||D>PF)return!1;return Wu(bF,D)},dF=(D)=>{if(D<hF||D>wF)return!1;return Wu(mF,D)};var kF=(D)=>{if(D>=J8&&D<=M8)return!0;if(D<cF||D>vF)return!1;return Wu(du,D)};function Y8(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function yF(D,{ambiguousAsWide:u=!1}={}){if(Y8(D),dF(D)||kF(D)||u&&tF(D))return 2;return 1}var nF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var f8=new Intl.Segmenter,U8=/^\p{Default_Ignorable_Code_Point}$/u;function TD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:C=!1}=u;if(!C)D=vD(D);if(D.length===0)return 0;let E=0,B={ambiguousAsWide:!F};for(let{segment:z}of f8.segment(D)){let X=z.codePointAt(0);if(X<=31||X>=127&&X<=159)continue;if(X>=8203&&X<=8207||X===65279)continue;if(X>=768&&X<=879||X>=6832&&X<=6911||X>=7616&&X<=7679||X>=8400&&X<=8447||X>=65056&&X<=65071)continue;if(X>=55296&&X<=57343)continue;if(X>=65024&&X<=65039)continue;if(U8.test(z))continue;if(nF().test(z)){E+=2;continue}E+=yF(X,B)}return E}var iF=(D=0)=>(u)=>`\x1B[${u+D}m`,oF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,gF=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,g={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},b6=Object.keys(g.modifier),q8=Object.keys(g.color),H8=Object.keys(g.bgColor),h6=[...q8,...H8];function W8(){let D=new Map;for(let[u,F]of Object.entries(g)){for(let[C,E]of Object.entries(F))g[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},F[C]=g[C],D.set(E[0],E[1]);Object.defineProperty(g,u,{value:F,enumerable:!1})}return Object.defineProperty(g,"codes",{value:D,enumerable:!1}),g.color.close="\x1B[39m",g.bgColor.close="\x1B[49m",g.color.ansi=iF(),g.color.ansi256=oF(),g.color.ansi16m=gF(),g.bgColor.ansi=iF(10),g.bgColor.ansi256=oF(10),g.bgColor.ansi16m=gF(10),Object.defineProperties(g,{rgbToAnsi256:{value(u,F,C){if(u===F&&F===C){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[C]=F;if(C.length===3)C=[...C].map((B)=>B+B).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(u)=>g.rgbToAnsi256(...g.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,E;if(u>=232)F=((u-232)*10+8)/255,C=F,E=F;else{u-=16;let X=u%36;F=Math.floor(u/36)/5,C=Math.floor(X/6)/5,E=X%6/5}let B=Math.max(F,C,E)*2;if(B===0)return 30;let z=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(F));if(B===2)z+=60;return z},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>g.ansi256ToAnsi(g.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>g.ansi256ToAnsi(g.hexToAnsi256(u)),enumerable:!1}}),g}var T8=W8(),lF=T8;var Vu=new Set(["\x1B","\x9B"]),V8=39,yu="\x07",aF="[",I8="]",eF="m",Tu=`${I8}8;;`,sF=(D)=>`${Vu.values().next().value}${aF}${D}${eF}`,rF=(D)=>`${Vu.values().next().value}${Tu}${D}${yu}`,L8=(D)=>D.split(" ").map((u)=>TD(u)),ku=(D,u,F)=>{let C=[...u],E=!1,B=!1,z=TD(vD(D.at(-1)));for(let[X,J]of C.entries()){let f=TD(J);if(z+f<=F)D[D.length-1]+=J;else D.push(J),z=0;if(Vu.has(J))E=!0,B=C.slice(X+1,X+1+Tu.length).join("")===Tu;if(E){if(B){if(J===yu)E=!1,B=!1}else if(J===eF)E=!1;continue}if(z+=f,z===F&&X<C.length-1)D.push(""),z=0}if(!z&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},_8=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(TD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},K8=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",E,B,z=L8(D),X=[""];for(let[O,Y]of D.split(" ").entries()){if(F.trim!==!1)X[X.length-1]=X.at(-1).trimStart();let q=TD(X.at(-1));if(O!==0){if(q>=u&&(F.wordWrap===!1||F.trim===!1))X.push(""),q=0;if(q>0||F.trim===!1)X[X.length-1]+=" ",q++}if(F.hard&&z[O]>u){let H=u-q,M=1+Math.floor((z[O]-H-1)/u);if(Math.floor((z[O]-1)/u)<M)X.push("");ku(X,Y,u);continue}if(q+z[O]>u&&q>0&&z[O]>0){if(F.wordWrap===!1&&q<u){ku(X,Y,u);continue}X.push("")}if(q+z[O]>u&&F.wordWrap===!1){ku(X,Y,u);continue}X[X.length-1]+=Y}if(F.trim!==!1)X=X.map((O)=>_8(O));let J=X.join(`
8
- `),f=[...J],W=0;for(let[O,Y]of f.entries()){if(C+=Y,Vu.has(Y)){let{groups:H}=new RegExp(`(?:\\${aF}(?<code>\\d+)m|\\${Tu}(?<uri>.*)${yu})`).exec(J.slice(W))||{groups:{}};if(H.code!==void 0){let M=Number.parseFloat(H.code);E=M===V8?void 0:M}else if(H.uri!==void 0)B=H.uri.length===0?void 0:H.uri}let q=lF.codes.get(Number(E));if(f[O+1]===`
9
- `){if(B)C+=rF("");if(E&&q)C+=sF(q)}else if(Y===`
10
- `){if(E&&q)C+=sF(E);if(B)C+=rF(B)}W+=Y.length}return C};function nu(D,u,F){return String(D).normalize().replaceAll(`\r
7
+ `);if(E.border)C.unshift("."+"-".repeat(this.negatePadding(E)+2)+"."),C.push("'"+"-".repeat(this.negatePadding(E)+2)+"'");if(E.padding)C.unshift(...Array(E.padding[0]||0).fill("")),C.push(...Array(E.padding[2]||0).fill(""));C.forEach(($,Z)=>{if(!u[Z])u.push([]);let M=u[Z];for(let O=0;O<B;O++)if(M[O]===void 0)M.push("");M.push($)})}),u}negatePadding(D){let u=D.width||0;if(D.padding)u-=(D.padding[3]||0)+(D.padding[1]||0);if(D.border)u-=4;return u}columnWidths(D){if(!this.wrap)return D.map((B)=>{return B.width||JD.stringWidth(B.text)});let u=D.length,F=this.width,C=D.map((B)=>{if(B.width)return u--,F-=B.width,B.width;return}),E=u?Math.floor(F/u):0;return C.map((B,$)=>{if(B===void 0)return Math.max(E,R8(D[$]));return B})}}function bF(D,u,F){if(D.border){if(/[.']-+[.']/.test(u))return"";if(u.trim().length!==0)return F;return" "}return""}function R8(D){let u=D.padding||[],F=1+(u[3]||0)+(u[1]||0);if(D.border)return F+4;return F}function N8(){if(typeof process==="object"&&process.stdout&&process.stdout.columns)return process.stdout.columns;return 80}function A8(D,u){D=D.trim();let F=JD.stringWidth(D);if(F<u)return" ".repeat(u-F)+D;return D}function S8(D,u){D=D.trim();let F=JD.stringWidth(D);if(F>=u)return D;return" ".repeat(u-F>>1)+D}var JD;function wF(D,u){return JD=u,new hF({width:(D===null||D===void 0?void 0:D.width)||N8(),wrap:D===null||D===void 0?void 0:D.wrap})}function su({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var P8=su();function dD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);if(!D.includes("\x1B")&&!D.includes("\x9B"))return D;return D.replace(P8,"")}var mF=161,vF=1114109,cF=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],dF=12288,pF=65510,tF=[12288,12288,65281,65376,65504,65510];var kF=4352,yF=262141,ru=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Lu=(D,u)=>{let F=0,C=Math.floor(D.length/2)-1;while(F<=C){let E=Math.floor((F+C)/2),B=E*2;if(u<D[B])C=E-1;else if(u>D[B+1])F=E+1;else return!0}return!1};var iF=19968,[x8,b8]=h8(ru);function h8(D){let u=D[0],F=D[1];for(let C=0;C<D.length;C+=2){let E=D[C],B=D[C+1];if(iF>=E&&iF<=B)return[E,B];if(B-E>F-u)u=E,F=B}return[u,F]}var gF=(D)=>{if(D<mF||D>vF)return!1;return Lu(cF,D)},lF=(D)=>{if(D<dF||D>pF)return!1;return Lu(tF,D)};var nF=(D)=>{if(D>=x8&&D<=b8)return!0;if(D<kF||D>yF)return!1;return Lu(ru,D)};function w8(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function oF(D,{ambiguousAsWide:u=!1}={}){if(w8(D),lF(D)||nF(D)||u&&gF(D))return 2;return 1}var sF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var m8=new Intl.Segmenter,v8=/^\p{Default_Ignorable_Code_Point}$/u;function TD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:C=!1}=u;if(!C)D=dD(D);if(D.length===0)return 0;let E=0,B={ambiguousAsWide:!F};for(let{segment:$}of m8.segment(D)){let Z=$.codePointAt(0);if(Z<=31||Z>=127&&Z<=159)continue;if(Z>=8203&&Z<=8207||Z===65279)continue;if(Z>=768&&Z<=879||Z>=6832&&Z<=6911||Z>=7616&&Z<=7679||Z>=8400&&Z<=8447||Z>=65056&&Z<=65071)continue;if(Z>=55296&&Z<=57343)continue;if(Z>=65024&&Z<=65039)continue;if(v8.test($))continue;if(sF().test($)){E+=2;continue}E+=oF(Z,B)}return E}var rF=(D=0)=>(u)=>`\x1B[${u+D}m`,aF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,eF=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,n={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},T7=Object.keys(n.modifier),c8=Object.keys(n.color),d8=Object.keys(n.bgColor),f7=[...c8,...d8];function p8(){let D=new Map;for(let[u,F]of Object.entries(n)){for(let[C,E]of Object.entries(F))n[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},F[C]=n[C],D.set(E[0],E[1]);Object.defineProperty(n,u,{value:F,enumerable:!1})}return Object.defineProperty(n,"codes",{value:D,enumerable:!1}),n.color.close="\x1B[39m",n.bgColor.close="\x1B[49m",n.color.ansi=rF(),n.color.ansi256=aF(),n.color.ansi16m=eF(),n.bgColor.ansi=rF(10),n.bgColor.ansi256=aF(10),n.bgColor.ansi16m=eF(10),Object.defineProperties(n,{rgbToAnsi256:{value(u,F,C){if(u===F&&F===C){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[C]=F;if(C.length===3)C=[...C].map((B)=>B+B).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(u)=>n.rgbToAnsi256(...n.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,E;if(u>=232)F=((u-232)*10+8)/255,C=F,E=F;else{u-=16;let Z=u%36;F=Math.floor(u/36)/5,C=Math.floor(Z/6)/5,E=Z%6/5}let B=Math.max(F,C,E)*2;if(B===0)return 30;let $=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>n.ansi256ToAnsi(n.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>n.ansi256ToAnsi(n.hexToAnsi256(u)),enumerable:!1}}),n}var t8=p8(),D0=t8;var ju=new Set(["\x1B","\x9B"]),k8=39,eu="\x07",C0="[",y8="]",E0="m",Ku=`${y8}8;;`,u0=(D)=>`${ju.values().next().value}${C0}${D}${E0}`,F0=(D)=>`${ju.values().next().value}${Ku}${D}${eu}`,i8=(D)=>D.split(" ").map((u)=>TD(u)),au=(D,u,F)=>{let C=[...u],E=!1,B=!1,$=TD(dD(D.at(-1)));for(let[Z,M]of C.entries()){let O=TD(M);if($+O<=F)D[D.length-1]+=M;else D.push(M),$=0;if(ju.has(M))E=!0,B=C.slice(Z+1,Z+1+Ku.length).join("")===Ku;if(E){if(B){if(M===eu)E=!1,B=!1}else if(M===E0)E=!1;continue}if($+=O,$===F&&Z<C.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},g8=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(TD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},l8=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",E,B,$=i8(D),Z=[""];for(let[Y,q]of D.split(" ").entries()){if(F.trim!==!1)Z[Z.length-1]=Z.at(-1).trimStart();let H=TD(Z.at(-1));if(Y!==0){if(H>=u&&(F.wordWrap===!1||F.trim===!1))Z.push(""),H=0;if(H>0||F.trim===!1)Z[Z.length-1]+=" ",H++}if(F.hard&&$[Y]>u){let W=u-H,J=1+Math.floor(($[Y]-W-1)/u);if(Math.floor(($[Y]-1)/u)<J)Z.push("");au(Z,q,u);continue}if(H+$[Y]>u&&H>0&&$[Y]>0){if(F.wordWrap===!1&&H<u){au(Z,q,u);continue}Z.push("")}if(H+$[Y]>u&&F.wordWrap===!1){au(Z,q,u);continue}Z[Z.length-1]+=q}if(F.trim!==!1)Z=Z.map((Y)=>g8(Y));let M=Z.join(`
8
+ `),O=[...M],V=0;for(let[Y,q]of O.entries()){if(C+=q,ju.has(q)){let{groups:W}=new RegExp(`(?:\\${C0}(?<code>\\d+)m|\\${Ku}(?<uri>.*)${eu})`).exec(M.slice(V))||{groups:{}};if(W.code!==void 0){let J=Number.parseFloat(W.code);E=J===k8?void 0:J}else if(W.uri!==void 0)B=W.uri.length===0?void 0:W.uri}let H=D0.codes.get(Number(E));if(O[Y+1]===`
9
+ `){if(B)C+=F0("");if(E&&H)C+=u0(H)}else if(q===`
10
+ `){if(E&&H)C+=u0(E);if(B)C+=F0(B)}V+=q.length}return C};function DF(D,u,F){return String(D).normalize().replaceAll(`\r
11
11
  `,`
12
12
  `).split(`
13
- `).map((C)=>K8(C,u,F)).join(`
14
- `)}function iu(D){return SF(D,{stringWidth:TD,stripAnsi:vD,wrap:nu})}import{dirname as D0,resolve as u0}from"path";import{readdirSync as j8,statSync as N8}from"fs";function ou(D,u){let F=u0(".",D),C;if(!N8(F).isDirectory())F=D0(F);while(!0){if(C=u(F,j8(F)),C)return u0(F,C);if(F=D0(C=F),C===F)break}}import{inspect as o8}from"util";import{fileURLToPath as q0}from"url";import{format as S8}from"util";import{normalize as x8,resolve as P8}from"path";function pD(D){if(!(D!==D.toLowerCase()&&D!==D.toUpperCase()))D=D.toLowerCase();if(D.indexOf("-")===-1&&D.indexOf("_")===-1)return D;else{let F="",C=!1,E=D.match(/^-+/);for(let B=E?E[0].length:0;B<D.length;B++){let z=D.charAt(B);if(C)C=!1,z=z.toUpperCase();if(B!==0&&(z==="-"||z==="_"))C=!0;else if(z!=="-"&&z!=="_")F+=z}return F}}function Iu(D,u){let F=D.toLowerCase();u=u||"-";let C="";for(let E=0;E<D.length;E++){let B=F.charAt(E),z=D.charAt(E);if(B!==z&&E>0)C+=`${u}${F.charAt(E)}`;else C+=z}return C}function Lu(D){if(D===null||D===void 0)return!1;if(typeof D==="number")return!0;if(/^0x[0-9a-f]+$/i.test(D))return!0;if(/^0[^.]/.test(D))return!1;return/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(D)}function F0(D){if(Array.isArray(D))return D.map((z)=>typeof z!=="string"?z+"":z);D=D.trim();let u=0,F=null,C=null,E=null,B=[];for(let z=0;z<D.length;z++){if(F=C,C=D.charAt(z),C===" "&&!E){if(F!==" ")u++;continue}if(C===E)E=null;else if((C==="'"||C==='"')&&!E)E=C;if(!B[u])B[u]="";B[u]+=C}return B}var UD;(function(D){D.BOOLEAN="boolean",D.STRING="string",D.NUMBER="number",D.ARRAY="array"})(UD||(UD={}));var ND;class lu{constructor(D){ND=D}parse(D,u){let F=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},u),C=F0(D),E=typeof D==="string",B=R8(Object.assign(Object.create(null),F.alias)),z=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},F.configuration),X=Object.assign(Object.create(null),F.default),J=F.configObjects||[],f=F.envPrefix,W=z["populate--"],O=W?"--":"_",Y=Object.create(null),q=Object.create(null),H=F.__||ND.format,M={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},S=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,p=new RegExp("^--"+z["negation-prefix"]+"(.+)");if([].concat(F.array||[]).filter(Boolean).forEach(function(Z){let Q=typeof Z==="object"?Z.key:Z,T=Object.keys(Z).map(function(U){return{boolean:"bools",string:"strings",number:"numbers"}[U]}).filter(Boolean).pop();if(T)M[T][Q]=!0;M.arrays[Q]=!0,M.keys.push(Q)}),[].concat(F.boolean||[]).filter(Boolean).forEach(function(Z){M.bools[Z]=!0,M.keys.push(Z)}),[].concat(F.string||[]).filter(Boolean).forEach(function(Z){M.strings[Z]=!0,M.keys.push(Z)}),[].concat(F.number||[]).filter(Boolean).forEach(function(Z){M.numbers[Z]=!0,M.keys.push(Z)}),[].concat(F.count||[]).filter(Boolean).forEach(function(Z){M.counts[Z]=!0,M.keys.push(Z)}),[].concat(F.normalize||[]).filter(Boolean).forEach(function(Z){M.normalize[Z]=!0,M.keys.push(Z)}),typeof F.narg==="object")Object.entries(F.narg).forEach(([Z,Q])=>{if(typeof Q==="number")M.nargs[Z]=Q,M.keys.push(Z)});if(typeof F.coerce==="object")Object.entries(F.coerce).forEach(([Z,Q])=>{if(typeof Q==="function")M.coercions[Z]=Q,M.keys.push(Z)});if(typeof F.config<"u"){if(Array.isArray(F.config)||typeof F.config==="string")[].concat(F.config).filter(Boolean).forEach(function(Z){M.configs[Z]=!0});else if(typeof F.config==="object")Object.entries(F.config).forEach(([Z,Q])=>{if(typeof Q==="boolean"||typeof Q==="function")M.configs[Z]=Q})}Xu(F.key,B,F.default,M.arrays),Object.keys(X).forEach(function(Z){(M.aliases[Z]||[]).forEach(function(Q){X[Q]=X[Z]})});let m=null;pu();let BD=[],c=Object.assign(Object.create(null),{_:[]}),i={};for(let Z=0;Z<C.length;Z++){let Q=C[Z],T=Q.replace(/^-{3,}/,"---"),U,G,K,I,A,$D;if(Q!=="--"&&/^-/.test(Q)&&y(Q))uD(Q);else if(T.match(/^---+(=|$)/)){uD(Q);continue}else if(Q.match(/^--.+=/)||!z["short-option-groups"]&&Q.match(/^-.+=/)){if(I=Q.match(/^--?([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3)if(x(I[1],M.arrays))Z=LD(Z,I[1],C,I[2]);else if(x(I[1],M.nargs)!==!1)Z=s(Z,I[1],C,I[2]);else k(I[1],I[2],!0)}else if(Q.match(p)&&z["boolean-negation"]){if(I=Q.match(p),I!==null&&Array.isArray(I)&&I.length>=2)G=I[1],k(G,x(G,M.arrays)?[!1]:!1)}else if(Q.match(/^--.+/)||!z["short-option-groups"]&&Q.match(/^-[^-]+/)){if(I=Q.match(/^--?(.+)/),I!==null&&Array.isArray(I)&&I.length>=2)if(G=I[1],x(G,M.arrays))Z=LD(Z,G,C);else if(x(G,M.nargs)!==!1)Z=s(Z,G,C);else if(A=C[Z+1],A!==void 0&&(!A.match(/^-/)||A.match(S))&&!x(G,M.bools)&&!x(G,M.counts))k(G,A),Z++;else if(/^(true|false)$/.test(A))k(G,A),Z++;else k(G,v(G))}else if(Q.match(/^-.\..+=/)){if(I=Q.match(/^-([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3)k(I[1],I[2])}else if(Q.match(/^-.\..+/)&&!Q.match(S)){if(A=C[Z+1],I=Q.match(/^-(.\..+)/),I!==null&&Array.isArray(I)&&I.length>=2)if(G=I[1],A!==void 0&&!A.match(/^-/)&&!x(G,M.bools)&&!x(G,M.counts))k(G,A),Z++;else k(G,v(G))}else if(Q.match(/^-[^-]+/)&&!Q.match(S)){K=Q.slice(1,-1).split(""),U=!1;for(let XD=0;XD<K.length;XD++){if(A=Q.slice(XD+2),K[XD+1]&&K[XD+1]==="="){if($D=Q.slice(XD+3),G=K[XD],x(G,M.arrays))Z=LD(Z,G,C,$D);else if(x(G,M.nargs)!==!1)Z=s(Z,G,C,$D);else k(G,$D);U=!0;break}if(A==="-"){k(K[XD],A);continue}if(/[A-Za-z]/.test(K[XD])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(A)&&x(A,M.bools)===!1){k(K[XD],A),U=!0;break}if(K[XD+1]&&K[XD+1].match(/\W/)){k(K[XD],A),U=!0;break}else k(K[XD],v(K[XD]))}if(G=Q.slice(-1)[0],!U&&G!=="-")if(x(G,M.arrays))Z=LD(Z,G,C);else if(x(G,M.nargs)!==!1)Z=s(Z,G,C);else if(A=C[Z+1],A!==void 0&&(!/^(-|--)[^-]/.test(A)||A.match(S))&&!x(G,M.bools)&&!x(G,M.counts))k(G,A),Z++;else if(/^(true|false)$/.test(A))k(G,A),Z++;else k(G,v(G))}else if(Q.match(/^-[0-9]$/)&&Q.match(S)&&x(Q.slice(1),M.bools))G=Q.slice(1),k(G,v(G));else if(Q==="--"){BD=C.slice(Z+1);break}else if(z["halt-at-non-option"]){BD=C.slice(Z);break}else uD(Q)}if(DD(c,!0),DD(c,!1),N(c),d(),SD(c,M.aliases,X,!0),t(c),z["set-placeholder-key"])FD(c);if(Object.keys(M.counts).forEach(function(Z){if(!n(c,Z.split(".")))k(Z,0)}),W&&BD.length)c[O]=[];if(BD.forEach(function(Z){c[O].push(Z)}),z["camel-case-expansion"]&&z["strip-dashed"])Object.keys(c).filter((Z)=>Z!=="--"&&Z.includes("-")).forEach((Z)=>{delete c[Z]});if(z["strip-aliased"])[].concat(...Object.keys(B).map((Z)=>B[Z])).forEach((Z)=>{if(z["camel-case-expansion"]&&Z.includes("-"))delete c[Z.split(".").map((Q)=>pD(Q)).join(".")];delete c[Z]});function uD(Z){let Q=V("_",Z);if(typeof Q==="string"||typeof Q==="number")c._.push(Q)}function s(Z,Q,T,U){let G,K=x(Q,M.nargs);if(K=typeof K!=="number"||isNaN(K)?1:K,K===0){if(!ED(U))m=Error(H("Argument unexpected for: %s",Q));return k(Q,v(Q)),Z}let I=ED(U)?0:1;if(z["nargs-eats-options"]){if(T.length-(Z+1)+I<K)m=Error(H("Not enough arguments following: %s",Q));I=K}else{for(G=Z+1;G<T.length;G++)if(!T[G].match(/^-[^0-9]/)||T[G].match(S)||y(T[G]))I++;else break;if(I<K)m=Error(H("Not enough arguments following: %s",Q))}let A=Math.min(I,K);if(!ED(U)&&A>0)k(Q,U),A--;for(G=Z+1;G<A+Z+1;G++)k(Q,T[G]);return Z+A}function LD(Z,Q,T,U){let G=[],K=U||T[Z+1],I=x(Q,M.nargs);if(x(Q,M.bools)&&!/^(true|false)$/.test(K))G.push(!0);else if(ED(K)||ED(U)&&/^-/.test(K)&&!S.test(K)&&!y(K)){if(X[Q]!==void 0){let A=X[Q];G=Array.isArray(A)?A:[A]}}else{if(!ED(U))G.push(j(Q,U,!0));for(let A=Z+1;A<T.length;A++){if(!z["greedy-arrays"]&&G.length>0||I&&typeof I==="number"&&G.length>=I)break;if(K=T[A],/^-/.test(K)&&!S.test(K)&&!y(K))break;Z=A,G.push(j(Q,K,E))}}if(typeof I==="number"&&(I&&G.length<I||isNaN(I)&&G.length===0))m=Error(H("Not enough arguments following: %s",Q));return k(Q,G),Z}function k(Z,Q,T=E){if(/-/.test(Z)&&z["camel-case-expansion"]){let K=Z.split(".").map(function(I){return pD(I)}).join(".");Zu(Z,K)}let U=j(Z,Q,T),G=Z.split(".");if(jD(c,G,U),M.aliases[Z])M.aliases[Z].forEach(function(K){let I=K.split(".");jD(c,I,U)});if(G.length>1&&z["dot-notation"])(M.aliases[G[0]]||[]).forEach(function(K){let I=K.split("."),A=[].concat(G);if(A.shift(),I=I.concat(A),!(M.aliases[Z]||[]).includes(I.join(".")))jD(c,I,U)});if(x(Z,M.normalize)&&!x(Z,M.arrays))[Z].concat(M.aliases[Z]||[]).forEach(function(I){Object.defineProperty(i,I,{enumerable:!0,get(){return Q},set(A){Q=typeof A==="string"?ND.normalize(A):A}})})}function Zu(Z,Q){if(!(M.aliases[Z]&&M.aliases[Z].length))M.aliases[Z]=[Q],Y[Q]=!0;if(!(M.aliases[Q]&&M.aliases[Q].length))Zu(Q,Z)}function j(Z,Q,T){if(T)Q=A8(Q);if(x(Z,M.bools)||x(Z,M.counts)){if(typeof Q==="string")Q=Q==="true"}let U=Array.isArray(Q)?Q.map(function(G){return V(Z,G)}):V(Z,Q);if(x(Z,M.counts)&&(ED(U)||typeof U==="boolean"))U=gu();if(x(Z,M.normalize)&&x(Z,M.arrays))if(Array.isArray(Q))U=Q.map((G)=>{return ND.normalize(G)});else U=ND.normalize(Q);return U}function V(Z,Q){if(!z["parse-positional-numbers"]&&Z==="_")return Q;if(!x(Z,M.strings)&&!x(Z,M.bools)&&!Array.isArray(Q)){if(Lu(Q)&&z["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${Q}`)))||!ED(Q)&&x(Z,M.numbers))Q=Number(Q)}return Q}function N(Z){let Q=Object.create(null);SD(Q,M.aliases,X),Object.keys(M.configs).forEach(function(T){let U=Z[T]||Q[T];if(U)try{let G=null,K=ND.resolve(ND.cwd(),U),I=M.configs[T];if(typeof I==="function"){try{G=I(K)}catch(A){G=A}if(G instanceof Error){m=G;return}}else G=ND.require(K);h(G)}catch(G){if(G.name==="PermissionDenied")m=G;else if(Z[T])m=Error(H("Invalid JSON config file: %s",U))}})}function h(Z,Q){Object.keys(Z).forEach(function(T){let U=Z[T],G=Q?Q+"."+T:T;if(typeof U==="object"&&U!==null&&!Array.isArray(U)&&z["dot-notation"])h(U,G);else if(!n(c,G.split("."))||x(G,M.arrays)&&z["combine-arrays"])k(G,U)})}function d(){if(typeof J<"u")J.forEach(function(Z){h(Z)})}function DD(Z,Q){if(typeof f>"u")return;let T=typeof f==="string"?f:"",U=ND.env();Object.keys(U).forEach(function(G){if(T===""||G.lastIndexOf(T,0)===0){let K=G.split("__").map(function(I,A){if(A===0)I=I.substring(T.length);return pD(I)});if((Q&&M.configs[K.join(".")]||!Q)&&!n(Z,K))k(K.join("."),U[G])}})}function t(Z){let Q,T=new Set;Object.keys(Z).forEach(function(U){if(!T.has(U)){if(Q=x(U,M.coercions),typeof Q==="function")try{let G=V(U,Q(Z[U]));[].concat(M.aliases[U]||[],U).forEach((K)=>{T.add(K),Z[K]=G})}catch(G){m=G}}})}function FD(Z){return M.keys.forEach((Q)=>{if(~Q.indexOf("."))return;if(typeof Z[Q]>"u")Z[Q]=void 0}),Z}function SD(Z,Q,T,U=!1){Object.keys(T).forEach(function(G){if(!n(Z,G.split("."))){if(jD(Z,G.split("."),T[G]),U)q[G]=!0;(Q[G]||[]).forEach(function(K){if(n(Z,K.split(".")))return;jD(Z,K.split("."),T[G])})}})}function n(Z,Q){let T=Z;if(!z["dot-notation"])Q=[Q.join(".")];Q.slice(0,-1).forEach(function(G){T=T[G]||{}});let U=Q[Q.length-1];if(typeof T!=="object")return!1;else return U in T}function jD(Z,Q,T){let U=Z;if(!z["dot-notation"])Q=[Q.join(".")];Q.slice(0,-1).forEach(function($D){if($D=C0($D),typeof U==="object"&&U[$D]===void 0)U[$D]={};if(typeof U[$D]!=="object"||Array.isArray(U[$D])){if(Array.isArray(U[$D]))U[$D].push({});else U[$D]=[U[$D],{}];U=U[$D][U[$D].length-1]}else U=U[$D]});let G=C0(Q[Q.length-1]),K=x(Q.join("."),M.arrays),I=Array.isArray(T),A=z["duplicate-arguments-array"];if(!A&&x(G,M.nargs)){if(A=!0,!ED(U[G])&&M.nargs[G]===1||Array.isArray(U[G])&&U[G].length===M.nargs[G])U[G]=void 0}if(T===gu())U[G]=gu(U[G]);else if(Array.isArray(U[G]))if(A&&K&&I)U[G]=z["flatten-duplicate-arrays"]?U[G].concat(T):(Array.isArray(U[G][0])?U[G]:[U[G]]).concat([T]);else if(!A&&Boolean(K)===Boolean(I))U[G]=T;else U[G]=U[G].concat([T]);else if(U[G]===void 0&&K)U[G]=I?T:[T];else if(A&&!(U[G]===void 0||x(G,M.counts)||x(G,M.bools)))U[G]=[U[G],T];else U[G]=T}function Xu(...Z){Z.forEach(function(Q){Object.keys(Q||{}).forEach(function(T){if(M.aliases[T])return;M.aliases[T]=[].concat(B[T]||[]),M.aliases[T].concat(T).forEach(function(U){if(/-/.test(U)&&z["camel-case-expansion"]){let G=pD(U);if(G!==T&&M.aliases[T].indexOf(G)===-1)M.aliases[T].push(G),Y[G]=!0}}),M.aliases[T].concat(T).forEach(function(U){if(U.length>1&&/[A-Z]/.test(U)&&z["camel-case-expansion"]){let G=Iu(U,"-");if(G!==T&&M.aliases[T].indexOf(G)===-1)M.aliases[T].push(G),Y[G]=!0}}),M.aliases[T].forEach(function(U){M.aliases[U]=[T].concat(M.aliases[T].filter(function(G){return U!==G}))})})})}function x(Z,Q){let T=[].concat(M.aliases[Z]||[],Z),U=Object.keys(Q),G=T.find((K)=>U.includes(K));return G?Q[G]:!1}function Fu(Z){let Q=Object.keys(M);return[].concat(Q.map((U)=>M[U])).some(function(U){return Array.isArray(U)?U.includes(Z):U[Z]})}function jF(Z,...Q){return[].concat(...Q).some(function(U){let G=Z.match(U);return G&&Fu(G[1])})}function P(Z){if(Z.match(S)||!Z.match(/^-[^-]+/))return!1;let Q=!0,T,U=Z.slice(1).split("");for(let G=0;G<U.length;G++){if(T=Z.slice(G+2),!Fu(U[G])){Q=!1;break}if(U[G+1]&&U[G+1]==="="||T==="-"||/[A-Za-z]/.test(U[G])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(T)||U[G+1]&&U[G+1].match(/\W/))break}return Q}function y(Z){return z["unknown-options-as-args"]&&CD(Z)}function CD(Z){if(Z=Z.replace(/^-{3,}/,"--"),Z.match(S))return!1;if(P(Z))return!1;return!jF(Z,/^-+([^=]+?)=[\s\S]*$/,p,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function v(Z){if(!x(Z,M.bools)&&!x(Z,M.counts)&&`${Z}`in X)return X[Z];else return ZD(r(Z))}function ZD(Z){return{[UD.BOOLEAN]:!0,[UD.STRING]:"",[UD.NUMBER]:void 0,[UD.ARRAY]:[]}[Z]}function r(Z){let Q=UD.BOOLEAN;if(x(Z,M.strings))Q=UD.STRING;else if(x(Z,M.numbers))Q=UD.NUMBER;else if(x(Z,M.bools))Q=UD.BOOLEAN;else if(x(Z,M.arrays))Q=UD.ARRAY;return Q}function ED(Z){return Z===void 0}function pu(){Object.keys(M.counts).find((Z)=>{if(x(Z,M.arrays))return m=Error(H("Invalid configuration: %s, opts.count excludes opts.array.",Z)),!0;else if(x(Z,M.nargs))return m=Error(H("Invalid configuration: %s, opts.count excludes opts.narg.",Z)),!0;return!1})}return{aliases:Object.assign({},M.aliases),argv:Object.assign(i,c),configuration:z,defaulted:Object.assign({},q),error:m,newAliases:Object.assign({},Y)}}}function R8(D){let u=[],F=Object.create(null),C=!0;Object.keys(D).forEach(function(E){u.push([].concat(D[E],E))});while(C){C=!1;for(let E=0;E<u.length;E++)for(let B=E+1;B<u.length;B++)if(u[E].filter(function(X){return u[B].indexOf(X)!==-1}).length){u[E]=u[E].concat(u[B]),u.splice(B,1),C=!0;break}}return u.forEach(function(E){E=E.filter(function(z,X,J){return J.indexOf(z)===X});let B=E.pop();if(B!==void 0&&typeof B==="string")F[B]=E}),F}function gu(D){return D!==void 0?D+1:1}function C0(D){if(D==="__proto__")return"___proto___";return D}function A8(D){return typeof D==="string"&&(D[0]==="'"||D[0]==='"')&&D[D.length-1]===D[0]?D.substring(1,D.length-1):D}import{readFileSync as b8}from"fs";import{createRequire as E0}from"module";var su,ru,au,B0=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20,$0=(ru=(su=process===null||process===void 0?void 0:process.versions)===null||su===void 0?void 0:su.node)!==null&&ru!==void 0?ru:(au=process===null||process===void 0?void 0:process.version)===null||au===void 0?void 0:au.slice(1);if($0){if(Number($0.match(/^([^.]+)/)[1])<B0)throw Error(`yargs parser supports a minimum Node.js version of ${B0}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}var h8=process?process.env:{},z0=E0?E0(import.meta.url):void 0,Z0=new lu({cwd:process.cwd,env:()=>{return h8},format:S8,normalize:x8,resolve:P8,require:(D)=>{if(typeof z0<"u")return z0(D);else if(D.match(/\.json$/))return JSON.parse(b8(D,"utf8"));else throw Error("only .json config files are supported in ESM")}}),Gu=function(u,F){return Z0.parse(u.slice(),F).argv};Gu.detailed=function(D,u){return Z0.parse(D.slice(),u)};Gu.camelCase=pD;Gu.decamelize=Iu;Gu.looksLikeNumber=Lu;var X0=Gu;import{basename as g8,dirname as l8,extname as s8,relative as r8,resolve as U0,join as a8}from"path";function w8(){if(m8())return 0;return 1}function m8(){return c8()&&!process.defaultApp}function c8(){return!!process.versions.electron}function G0(){return process.argv[w8()]}import{readFileSync as v8,statSync as p8,writeFile as t8}from"fs";import{format as d8}from"util";import{resolve as k8}from"path";var Q0={fs:{readFileSync:v8,writeFile:t8},format:d8,resolve:k8,exists:(D)=>{try{return p8(D).isFile()}catch(u){return!1}}};var VD;class J0{constructor(D){D=D||{},this.directory=D.directory||"./locales",this.updateFiles=typeof D.updateFiles==="boolean"?D.updateFiles:!0,this.locale=D.locale||"en",this.fallbackToLanguage=typeof D.fallbackToLanguage==="boolean"?D.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...D){if(typeof arguments[0]!=="string")return this._taggedLiteral(arguments[0],...arguments);let u=D.shift(),F=function(){};if(typeof D[D.length-1]==="function")F=D.pop();if(F=F||function(){},!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][u]&&this.updateFiles)this.cache[this.locale][u]=u,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:F});else F();return VD.format.apply(VD.format,[this.cache[this.locale][u]||u].concat(D))}__n(){let D=Array.prototype.slice.call(arguments),u=D.shift(),F=D.shift(),C=D.shift(),E=function(){};if(typeof D[D.length-1]==="function")E=D.pop();if(!this.cache[this.locale])this._readLocaleFile();let B=C===1?u:F;if(this.cache[this.locale][u])B=this.cache[this.locale][u][C===1?"one":"other"];if(!this.cache[this.locale][u]&&this.updateFiles)this.cache[this.locale][u]={one:u,other:F},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:E});else E();let z=[B];if(~B.indexOf("%d"))z.push(C);return VD.format.apply(VD.format,z.concat(D))}setLocale(D){this.locale=D}getLocale(){return this.locale}updateLocale(D){if(!this.cache[this.locale])this._readLocaleFile();for(let u in D)if(Object.prototype.hasOwnProperty.call(D,u))this.cache[this.locale][u]=D[u]}_taggedLiteral(D,...u){let F="";return D.forEach(function(C,E){let B=u[E+1];if(F+=C,typeof B<"u")F+="%s"}),this.__.apply(this,[F].concat([].slice.call(u,1)))}_enqueueWrite(D){if(this.writeQueue.push(D),this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){let D=this,u=this.writeQueue[0],F=u.directory,C=u.locale,E=u.cb,B=this._resolveLocaleFile(F,C),z=JSON.stringify(this.cache[C],null,2);VD.fs.writeFile(B,z,"utf-8",function(X){if(D.writeQueue.shift(),D.writeQueue.length>0)D._processWriteQueue();E(X)})}_readLocaleFile(){let D={},u=this._resolveLocaleFile(this.directory,this.locale);try{if(VD.fs.readFileSync)D=JSON.parse(VD.fs.readFileSync(u,"utf-8"))}catch(F){if(F instanceof SyntaxError)F.message="syntax error in "+u;if(F.code==="ENOENT")D={};else throw F}this.cache[this.locale]=D}_resolveLocaleFile(D,u){let F=VD.resolve(D,"./",u+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(F)&&~u.lastIndexOf("_")){let C=VD.resolve(D,"./",u.split("_")[0]+".json");if(this._fileExistsSync(C))F=C}return F}_fileExistsSync(D){return VD.exists(D)}}function M0(D,u){VD=u;let F=new J0(D);return{__:F.__.bind(F),__n:F.__n.bind(F),setLocale:F.setLocale.bind(F),getLocale:F.getLocale.bind(F),updateLocale:F.updateLocale.bind(F),locale:F.locale}}var y8=(D)=>{return M0(D,Q0)},O0=y8;var H0=E8(f0(),1);import{createRequire as e8}from"module";import{readFileSync as D3,readdirSync as u3}from"fs";var eu=q0(import.meta.url),F3=eu.substring(0,eu.lastIndexOf("node_modules")),C3=e8(import.meta.url),W0={assert:{notStrictEqual:n8,strictEqual:i8},cliui:iu,findUp:ou,getEnv:(D)=>{return process.env[D]},inspect:o8,getProcessArgvBin:G0,mainFilename:F3||process.cwd(),Parser:X0,path:{basename:g8,dirname:l8,extname:s8,relative:r8,resolve:U0,join:a8},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(D,u)=>process.emitWarning(D,u),execPath:()=>process.execPath,exit:(D)=>{process.exit(D)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:D3,readdirSync:u3,require:C3,getCallerFile:()=>{let D=H0.default(3);return D.match(/^file:\/\//)?q0(D):D},stringWidth:TD,y18n:O0({directory:U0(eu,"../../../locales"),updateFiles:!1})};function GD(D,u,F,C){F.assert.notStrictEqual(D,u,C)}function DF(D,u){u.assert.strictEqual(typeof D,"string")}function Cu(D){return Object.keys(D)}function o(D){return!!D&&!!D.then&&typeof D.then==="function"}class a extends Error{constructor(D){super(D||"yargs error");if(this.name="YError",Error.captureStackTrace)Error.captureStackTrace(this,a)}}function xD(D){let F=D.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),C=/\.*[\][<>]/g,E=F.shift();if(!E)throw Error(`No command found in: ${D}`);let B={cmd:E.replace(C,""),demanded:[],optional:[]};return F.forEach((z,X)=>{let J=!1;if(z=z.replace(/\s/g,""),/\.+[\]>]/.test(z)&&X===F.length-1)J=!0;if(/^\[/.test(z))B.optional.push({cmd:z.replace(C,"").split("|"),variadic:J});else B.demanded.push({cmd:z.replace(C,"").split("|"),variadic:J})}),B}var E3=["first","second","third","fourth","fifth","sixth"];function L(D,u,F){function C(){return typeof D==="object"?[{demanded:[],optional:[]},D,u]:[xD(`cmd ${D}`),u,F]}try{let E=0,[B,z,X]=C(),J=[].slice.call(z);while(J.length&&J[J.length-1]===void 0)J.pop();let f=X||J.length;if(f<B.demanded.length)throw new a(`Not enough arguments provided. Expected ${B.demanded.length} but received ${J.length}.`);let W=B.demanded.length+B.optional.length;if(f>W)throw new a(`Too many arguments provided. Expected max ${W} but received ${f}.`);B.demanded.forEach((O)=>{let Y=J.shift(),q=T0(Y);if(O.cmd.filter((M)=>M===q||M==="*").length===0)V0(q,O.cmd,E);E+=1}),B.optional.forEach((O)=>{if(J.length===0)return;let Y=J.shift(),q=T0(Y);if(O.cmd.filter((M)=>M===q||M==="*").length===0)V0(q,O.cmd,E);E+=1})}catch(E){console.warn(E.stack)}}function T0(D){if(Array.isArray(D))return"array";else if(D===null)return"null";return typeof D}function V0(D,u,F){throw new a(`Invalid ${E3[F]||"manyith"} argument. Expected ${u.join(" or ")} but received ${D}.`)}class uF{constructor(D){this.globalMiddleware=[],this.frozens=[],this.yargs=D}addMiddleware(D,u,F=!0,C=!1){if(L("<array|function> [boolean] [boolean] [boolean]",[D,u,F],arguments.length),Array.isArray(D)){for(let E=0;E<D.length;E++){if(typeof D[E]!=="function")throw Error("middleware must be a function");let B=D[E];B.applyBeforeValidation=u,B.global=F}Array.prototype.push.apply(this.globalMiddleware,D)}else if(typeof D==="function"){let E=D;E.applyBeforeValidation=u,E.global=F,E.mutates=C,this.globalMiddleware.push(D)}return this.yargs}addCoerceMiddleware(D,u){let F=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((C)=>{let E=[...F[u]||[],u];if(!C.option)return!0;else return!E.includes(C.option)}),D.option=u,this.addMiddleware(D,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let D=this.frozens.pop();if(D!==void 0)this.globalMiddleware=D}reset(){this.globalMiddleware=this.globalMiddleware.filter((D)=>D.global)}}function I0(D){if(!D)return[];return D.map((u)=>{return u.applyBeforeValidation=!1,u})}function tD(D,u,F,C){return F.reduce((E,B)=>{if(B.applyBeforeValidation!==C)return E;if(B.mutates){if(B.applied)return E;B.applied=!0}if(o(E))return E.then((z)=>Promise.all([z,B(z,u)])).then(([z,X])=>Object.assign(z,X));else{let z=B(E,u);return o(z)?z.then((X)=>Object.assign(E,X)):Object.assign(E,z)}},D)}function dD(D,u,F=(C)=>{throw C}){try{let C=B3(D)?D():D;return o(C)?C.then((E)=>u(E)):u(C)}catch(C){return F(C)}}function B3(D){return typeof D==="function"}var Eu=/(^\*)|(^\$0)/;class _0{constructor(D,u,F,C){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=C,this.usage=D,this.globalMiddleware=F,this.validation=u}addDirectory(D,u,F,C){C=C||{},this.requireCache.add(F);let E=this.shim.path.resolve(this.shim.path.dirname(F),D),B=this.shim.readdirSync(E,{recursive:C.recurse?!0:!1});if(!Array.isArray(C.extensions))C.extensions=["js"];let z=typeof C.visit==="function"?C.visit:(X)=>X;for(let X of B){let J=X.toString();if(C.exclude){let W=!1;if(typeof C.exclude==="function")W=C.exclude(J);else W=C.exclude.test(J);if(W)continue}if(C.include){let W=!1;if(typeof C.include==="function")W=C.include(J);else W=C.include.test(J);if(!W)continue}let f=!1;for(let W of C.extensions)if(J.endsWith(W))f=!0;if(f){let W=this.shim.path.join(E,J),O=u(W),Y=Object.create(null,Object.getOwnPropertyDescriptors({...O}));if(z(Y,W,J)){if(this.requireCache.has(W))continue;else this.requireCache.add(W);if(!Y.command)Y.command=this.shim.path.basename(W,this.shim.path.extname(W));this.addHandler(Y)}}}}addHandler(D,u,F,C,E,B){let z=[],X=I0(E);if(C=C||(()=>{}),Array.isArray(D))if($3(D))[D,...z]=D;else for(let J of D)this.addHandler(J);else if(Z3(D)){let J=Array.isArray(D.command)||typeof D.command==="string"?D.command:null;if(J===null)throw Error(`No command name given for module: ${this.shim.inspect(D)}`);if(D.aliases)J=[].concat(J).concat(D.aliases);this.addHandler(J,this.extractDesc(D),D.builder,D.handler,D.middlewares,D.deprecated);return}else if(L0(F)){this.addHandler([D].concat(z),u,F.builder,F.handler,F.middlewares,F.deprecated);return}if(typeof D==="string"){let J=xD(D);z=z.map((O)=>xD(O).cmd);let f=!1,W=[J.cmd].concat(z).filter((O)=>{if(Eu.test(O))return f=!0,!1;return!0});if(W.length===0&&f)W.push("$0");if(f)J.cmd=W[0],z=W.slice(1),D=D.replace(Eu,J.cmd);if(z.forEach((O)=>{this.aliasMap[O]=J.cmd}),u!==!1)this.usage.command(D,u,f,z,B);if(this.handlers[J.cmd]={original:D,description:u,handler:C,builder:F||{},middlewares:X,deprecated:B,demanded:J.demanded,optional:J.optional},f)this.defaultCommand=this.handlers[J.cmd]}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(D,u,F,C,E,B){let z=this.handlers[D]||this.handlers[this.aliasMap[D]]||this.defaultCommand,X=u.getInternalMethods().getContext(),J=X.commands.slice(),f=!D;if(D)X.commands.push(D),X.fullCommands.push(z.original);let W=this.applyBuilderUpdateUsageAndParse(f,z,u,F.aliases,J,C,E,B);return o(W)?W.then((O)=>this.applyMiddlewareAndGetResult(f,z,O.innerArgv,X,E,O.aliases,u)):this.applyMiddlewareAndGetResult(f,z,W.innerArgv,X,E,W.aliases,u)}applyBuilderUpdateUsageAndParse(D,u,F,C,E,B,z,X){let J=u.builder,f=F;if(_u(J)){F.getInternalMethods().getUsageInstance().freeze();let W=J(F.getInternalMethods().reset(C),X);if(o(W))return W.then((O)=>{return f=j0(O)?O:F,this.parseAndUpdateUsage(D,u,f,E,B,z)})}else if(z3(J))F.getInternalMethods().getUsageInstance().freeze(),f=F.getInternalMethods().reset(C),Object.keys(u.builder).forEach((W)=>{f.option(W,J[W])});return this.parseAndUpdateUsage(D,u,f,E,B,z)}parseAndUpdateUsage(D,u,F,C,E,B){if(D)F.getInternalMethods().getUsageInstance().unfreeze(!0);if(this.shouldUpdateUsage(F))F.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(C,u),u.description);let z=F.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,E,B);return o(z)?z.then((X)=>({aliases:F.parsed.aliases,innerArgv:X})):{aliases:F.parsed.aliases,innerArgv:z}}shouldUpdateUsage(D){return!D.getInternalMethods().getUsageInstance().getUsageDisabled()&&D.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(D,u){let F=Eu.test(u.original)?u.original.replace(Eu,"").trim():u.original,C=D.filter((E)=>{return!Eu.test(E)});return C.push(F),`$0 ${C.join(" ")}`}handleValidationAndGetResult(D,u,F,C,E,B,z,X){if(!B.getInternalMethods().getHasOutput()){let J=B.getInternalMethods().runValidation(E,X,B.parsed.error,D);F=dD(F,(f)=>{return J(f),f})}if(u.handler&&!B.getInternalMethods().getHasOutput()){B.getInternalMethods().setHasOutput();let J=!!B.getOptions().configuration["populate--"];if(B.getInternalMethods().postProcess(F,J,!1,!1),F=tD(F,B,z,!1),F=dD(F,(f)=>{let W=u.handler(f);return o(W)?W.then(()=>f):f}),!D)B.getInternalMethods().getUsageInstance().cacheHelpMessage();if(o(F)&&!B.getInternalMethods().hasParseCallback())F.catch((f)=>{try{B.getInternalMethods().getUsageInstance().fail(null,f)}catch(W){}})}if(!D)C.commands.pop(),C.fullCommands.pop();return F}applyMiddlewareAndGetResult(D,u,F,C,E,B,z){let X={};if(E)return F;if(!z.getInternalMethods().getHasOutput())X=this.populatePositionals(u,F,C,z);let J=this.globalMiddleware.getMiddleware().slice(0).concat(u.middlewares),f=tD(F,z,J,!0);return o(f)?f.then((W)=>this.handleValidationAndGetResult(D,u,W,C,B,z,J,X)):this.handleValidationAndGetResult(D,u,f,C,B,z,J,X)}populatePositionals(D,u,F,C){u._=u._.slice(F.commands.length);let E=D.demanded.slice(0),B=D.optional.slice(0),z={};this.validation.positionalCount(E.length,u._.length);while(E.length){let X=E.shift();this.populatePositional(X,u,z)}while(B.length){let X=B.shift();this.populatePositional(X,u,z)}return u._=F.commands.concat(u._.map((X)=>""+X)),this.postProcessPositionals(u,z,this.cmdToParseOptions(D.original),C),z}populatePositional(D,u,F){let C=D.cmd[0];if(D.variadic)F[C]=u._.splice(0).map(String);else if(u._.length)F[C]=[String(u._.shift())]}cmdToParseOptions(D){let u={array:[],default:{},alias:{},demand:{}},F=xD(D);return F.demanded.forEach((C)=>{let[E,...B]=C.cmd;if(C.variadic)u.array.push(E),u.default[E]=[];u.alias[E]=B,u.demand[E]=!0}),F.optional.forEach((C)=>{let[E,...B]=C.cmd;if(C.variadic)u.array.push(E),u.default[E]=[];u.alias[E]=B}),u}postProcessPositionals(D,u,F,C){let E=Object.assign({},C.getOptions());E.default=Object.assign(F.default,E.default);for(let J of Object.keys(F.alias))E.alias[J]=(E.alias[J]||[]).concat(F.alias[J]);E.array=E.array.concat(F.array),E.config={};let B=[];if(Object.keys(u).forEach((J)=>{u[J].map((f)=>{if(E.configuration["unknown-options-as-args"])E.key[J]=!0;B.push(`--${J}`),B.push(f)})}),!B.length)return;let z=Object.assign({},E.configuration,{"populate--":!1}),X=this.shim.Parser.detailed(B,Object.assign({},E,{configuration:z}));if(X.error)C.getInternalMethods().getUsageInstance().fail(X.error.message,X.error);else{let J=Object.keys(u);Object.keys(u).forEach((f)=>{J.push(...X.aliases[f])}),Object.keys(X.argv).forEach((f)=>{if(J.includes(f)){if(!u[f])u[f]=X.argv[f];if(!this.isInConfigs(C,f)&&!this.isDefaulted(C,f)&&Object.prototype.hasOwnProperty.call(D,f)&&Object.prototype.hasOwnProperty.call(X.argv,f)&&(Array.isArray(D[f])||Array.isArray(X.argv[f])))D[f]=[].concat(D[f],X.argv[f]);else D[f]=X.argv[f]}})}}isDefaulted(D,u){let{default:F}=D.getOptions();return Object.prototype.hasOwnProperty.call(F,u)||Object.prototype.hasOwnProperty.call(F,this.shim.Parser.camelCase(u))}isInConfigs(D,u){let{configObjects:F}=D.getOptions();return F.some((C)=>Object.prototype.hasOwnProperty.call(C,u))||F.some((C)=>Object.prototype.hasOwnProperty.call(C,this.shim.Parser.camelCase(u)))}runDefaultBuilderOn(D){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(D)){let F=Eu.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");D.getInternalMethods().getUsageInstance().usage(F,this.defaultCommand.description)}let u=this.defaultCommand.builder;if(_u(u))return u(D,!0);else if(!L0(u))Object.keys(u).forEach((F)=>{D.option(F,u[F])});return}extractDesc({describe:D,description:u,desc:F}){for(let C of[D,u,F]){if(typeof C==="string"||C===!1)return C;GD(C,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let D=this.frozens.pop();GD(D,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=D}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function K0(D,u,F,C){return new _0(D,u,F,C)}function L0(D){return typeof D==="object"&&!!D.builder&&typeof D.handler==="function"}function $3(D){return D.every((u)=>typeof u==="string")}function _u(D){return typeof D==="function"}function z3(D){return typeof D==="object"}function Z3(D){return typeof D==="object"&&!Array.isArray(D)}function PD(D={},u=()=>!0){let F={};return Cu(D).forEach((C)=>{if(u(C,D[C]))F[C]=D[C]}),F}function bD(D){if(typeof process>"u")return;[process.stdout,process.stderr].forEach((u)=>{let F=u;if(F._handle&&F.isTTY&&typeof F._handle.setBlocking==="function")F._handle.setBlocking(D)})}function X3(D){return typeof D==="boolean"}function R0(D,u){let F=u.y18n.__,C={},E=[];C.failFn=function(V){E.push(V)};let B=null,z=null,X=!0;C.showHelpOnFail=function(V=!0,N){let[h,d]=typeof V==="string"?[!0,V]:[V,N];if(D.getInternalMethods().isGlobalContext())z=d;return B=d,X=h,C};let J=!1;C.fail=function(V,N){let h=D.getInternalMethods().getLoggerInstance();if(E.length)for(let d=E.length-1;d>=0;--d){let DD=E[d];if(X3(DD)){if(N)throw N;else if(V)throw Error(V)}else DD(V,N,C)}else{if(D.getExitProcess())bD(!0);if(!J){if(J=!0,X)D.showHelp("error"),h.error();if(V||N)h.error(V||N);let d=B||z;if(d){if(V||N)h.error("");h.error(d)}}if(N=N||new a(V),D.getExitProcess())return D.exit(1);else if(D.getInternalMethods().hasParseCallback())return D.exit(1,N);else throw N}};let f=[],W=!1;C.usage=(j,V)=>{if(j===null)return W=!0,f=[],C;return W=!1,f.push([j,V||""]),C},C.getUsage=()=>{return f},C.getUsageDisabled=()=>{return W},C.getPositionalGroupName=()=>{return F("Positionals:")};let O=[];C.example=(j,V)=>{O.push([j,V||""])};let Y=[];C.command=function(V,N,h,d,DD=!1){if(h)Y=Y.map((t)=>{return t[2]=!1,t});Y.push([V,N||"",h,d,DD])},C.getCommands=()=>Y;let q={};C.describe=function(V,N){if(Array.isArray(V))V.forEach((h)=>{C.describe(h,N)});else if(typeof V==="object")Object.keys(V).forEach((h)=>{C.describe(h,V[h])});else q[V]=N},C.getDescriptions=()=>q;let H=[];C.epilog=(j)=>{H.push(j)};let M=!1,S;C.wrap=(j)=>{M=!0,S=j},C.getWrap=()=>{if(u.getEnv("YARGS_DISABLE_WRAP"))return null;if(!M)S=LD(),M=!0;return S};let p="__yargsString__:";C.deferY18nLookup=(j)=>p+j,C.help=function(){if(c)return c;BD();let V=D.customScriptName?D.$0:u.path.basename(D.$0),N=D.getDemandedOptions(),h=D.getDemandedCommands(),d=D.getDeprecatedOptions(),DD=D.getGroups(),t=D.getOptions(),FD=[];FD=FD.concat(Object.keys(q)),FD=FD.concat(Object.keys(N)),FD=FD.concat(Object.keys(h)),FD=FD.concat(Object.keys(t.default)),FD=FD.filter(uD),FD=Object.keys(FD.reduce((P,y)=>{if(y!=="_")P[y]=!0;return P},{}));let SD=C.getWrap(),n=u.cliui({width:SD,wrap:!!SD});if(!W){if(f.length)f.forEach((P)=>{if(n.div({text:`${P[0].replace(/\$0/g,V)}`}),P[1])n.div({text:`${P[1]}`,padding:[1,0,0,0]})}),n.div();else if(Y.length){let P=null;if(h._)P=`${V} <${F("command")}>
15
- `;else P=`${V} [${F("command")}]
16
- `;n.div(`${P}`)}}if(Y.length>1||Y.length===1&&!Y[0][2]){n.div(F("Commands:"));let P=D.getInternalMethods().getContext(),y=P.commands.length?`${P.commands.join(" ")} `:"";if(D.getInternalMethods().getParserConfiguration()["sort-commands"]===!0)Y=Y.sort((v,ZD)=>v[0].localeCompare(ZD[0]));let CD=V?`${V} `:"";Y.forEach((v)=>{let ZD=`${CD}${y}${v[0].replace(/^\$0 ?/,"")}`;n.span({text:ZD,padding:[0,2,0,2],width:m(Y,SD,`${V}${y}`)+4},{text:v[1]});let r=[];if(v[2])r.push(`[${F("default")}]`);if(v[3]&&v[3].length)r.push(`[${F("aliases:")} ${v[3].join(", ")}]`);if(v[4])if(typeof v[4]==="string")r.push(`[${F("deprecated: %s",v[4])}]`);else r.push(`[${F("deprecated")}]`);if(r.length)n.div({text:r.join(" "),padding:[0,0,0,2],align:"right"});else n.div()}),n.div()}let jD=(Object.keys(t.alias)||[]).concat(Object.keys(D.parsed.newAliases)||[]);FD=FD.filter((P)=>!D.parsed.newAliases[P]&&jD.every((y)=>(t.alias[y]||[]).indexOf(P)===-1));let Xu=F("Options:");if(!DD[Xu])DD[Xu]=[];i(FD,t.alias,DD,Xu);let x=(P)=>/^--/.test(Ku(P)),Fu=Object.keys(DD).filter((P)=>DD[P].length>0).map((P)=>{let y=DD[P].filter(uD).map((CD)=>{if(jD.includes(CD))return CD;for(let v=0,ZD;(ZD=jD[v])!==void 0;v++)if((t.alias[ZD]||[]).includes(CD))return ZD;return CD});return{groupName:P,normalizedKeys:y}}).filter(({normalizedKeys:P})=>P.length>0).map(({groupName:P,normalizedKeys:y})=>{let CD=y.reduce((v,ZD)=>{return v[ZD]=[ZD].concat(t.alias[ZD]||[]).map((r)=>{if(P===C.getPositionalGroupName())return r;else return(/^[0-9]$/.test(r)?t.boolean.includes(ZD)?"-":"--":r.length>1?"--":"-")+r}).sort((r,ED)=>x(r)===x(ED)?0:x(r)?1:-1).join(", "),v},{});return{groupName:P,normalizedKeys:y,switches:CD}});if(Fu.filter(({groupName:P})=>P!==C.getPositionalGroupName()).some(({normalizedKeys:P,switches:y})=>!P.every((CD)=>x(y[CD]))))Fu.filter(({groupName:P})=>P!==C.getPositionalGroupName()).forEach(({normalizedKeys:P,switches:y})=>{P.forEach((CD)=>{if(x(y[CD]))y[CD]=G3(y[CD],4)})});if(Fu.forEach(({groupName:P,normalizedKeys:y,switches:CD})=>{n.div(P),y.forEach((v)=>{let ZD=CD[v],r=q[v]||"",ED=null;if(r.includes(p))r=F(r.substring(p.length));if(t.boolean.includes(v))ED=`[${F("boolean")}]`;if(t.count.includes(v))ED=`[${F("count")}]`;if(t.string.includes(v))ED=`[${F("string")}]`;if(t.normalize.includes(v))ED=`[${F("string")}]`;if(t.array.includes(v))ED=`[${F("array")}]`;if(t.number.includes(v))ED=`[${F("number")}]`;let pu=(T)=>typeof T==="string"?`[${F("deprecated: %s",T)}]`:`[${F("deprecated")}]`,Z=[v in d?pu(d[v]):null,ED,v in N?`[${F("required")}]`:null,t.choices&&t.choices[v]?`[${F("choices:")} ${C.stringifiedValues(t.choices[v])}]`:null,s(t.default[v],t.defaultDescription[v])].filter(Boolean).join(" ");n.span({text:Ku(ZD),padding:[0,2,0,2+N0(ZD)],width:m(CD,SD)+4},r);let Q=D.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;if(Z&&!Q)n.div({text:Z,padding:[0,0,0,2],align:"right"});else n.div()}),n.div()}),O.length)n.div(F("Examples:")),O.forEach((P)=>{P[0]=P[0].replace(/\$0/g,V)}),O.forEach((P)=>{if(P[1]==="")n.div({text:P[0],padding:[0,2,0,2]});else n.div({text:P[0],padding:[0,2,0,2],width:m(O,SD)+4},{text:P[1]})}),n.div();if(H.length>0){let P=H.map((y)=>y.replace(/\$0/g,V)).join(`
17
- `);n.div(`${P}
18
- `)}return n.toString().replace(/\s*$/,"")};function m(j,V,N){let h=0;if(!Array.isArray(j))j=Object.values(j).map((d)=>[d]);if(j.forEach((d)=>{h=Math.max(u.stringWidth(N?`${N} ${Ku(d[0])}`:Ku(d[0]))+N0(d[0]),h)}),V)h=Math.min(h,parseInt((V*0.5).toString(),10));return h}function BD(){let j=D.getDemandedOptions(),V=D.getOptions();(Object.keys(V.alias)||[]).forEach((N)=>{V.alias[N].forEach((h)=>{if(q[h])C.describe(N,q[h]);if(h in j)D.demandOption(N,j[h]);if(V.boolean.includes(h))D.boolean(N);if(V.count.includes(h))D.count(N);if(V.string.includes(h))D.string(N);if(V.normalize.includes(h))D.normalize(N);if(V.array.includes(h))D.array(N);if(V.number.includes(h))D.number(N)})})}let c;C.cacheHelpMessage=function(){c=this.help()},C.clearCachedHelpMessage=function(){c=void 0},C.hasCachedHelpMessage=function(){return!!c};function i(j,V,N,h){let d=[],DD=null;return Object.keys(N).forEach((t)=>{d=d.concat(N[t])}),j.forEach((t)=>{if(DD=[t].concat(V[t]),!DD.some((FD)=>d.indexOf(FD)!==-1))N[h].push(t)}),d}function uD(j){return D.getOptions().hiddenOptions.indexOf(j)<0||D.parsed.argv[D.getOptions().showHiddenOpt]}C.showHelp=(j)=>{let V=D.getInternalMethods().getLoggerInstance();if(!j)j="error";(typeof j==="function"?j:V[j])(C.help())},C.functionDescription=(j)=>{return["(",j.name?u.Parser.decamelize(j.name,"-"):F("generated-value"),")"].join("")},C.stringifiedValues=function(V,N){let h="",d=N||", ",DD=[].concat(V);if(!V||!DD.length)return h;return DD.forEach((t)=>{if(h.length)h+=d;h+=JSON.stringify(t)}),h};function s(j,V){let N=`[${F("default:")} `;if(j===void 0&&!V)return null;if(V)N+=V;else switch(typeof j){case"string":N+=`"${j}"`;break;case"object":N+=JSON.stringify(j);break;default:N+=j}return`${N}]`}function LD(){if(u.process.stdColumns)return Math.min(80,u.process.stdColumns);else return 80}let k=null;C.version=(j)=>{k=j},C.showVersion=(j)=>{let V=D.getInternalMethods().getLoggerInstance();if(!j)j="error";(typeof j==="function"?j:V[j])(k)},C.reset=function(V){return B=null,J=!1,f=[],W=!1,H=[],O=[],Y=[],q=PD(q,(N)=>!V[N]),C};let Zu=[];return C.freeze=function(){Zu.push({failMessage:B,failureOutput:J,usages:f,usageDisabled:W,epilogs:H,examples:O,commands:Y,descriptions:q})},C.unfreeze=function(V=!1){let N=Zu.pop();if(!N)return;if(V)q={...N.descriptions,...q},Y=[...N.commands,...Y],f=[...N.usages,...f],O=[...N.examples,...O],H=[...N.epilogs,...H];else({failMessage:B,failureOutput:J,usages:f,usageDisabled:W,epilogs:H,examples:O,commands:Y,descriptions:q}=N)},C}function FF(D){return typeof D==="object"}function G3(D,u){return FF(D)?{text:D.text,indentation:D.indentation+u}:{text:D,indentation:u}}function N0(D){return FF(D)?D.indentation:0}function Ku(D){return FF(D)?D.text:D}var A0=`###-begin-{{app_name}}-completions-###
13
+ `).map((C)=>l8(C,u,F)).join(`
14
+ `)}function uF(D){return wF(D,{stringWidth:TD,stripAnsi:dD,wrap:DF})}import{dirname as B0,resolve as $0}from"path";import{readdirSync as n8,statSync as o8}from"fs";function FF(D,u){let F=$0(".",D),C;if(!o8(F).isDirectory())F=B0(F);while(!0){if(C=u(F,n8(F)),C)return $0(F,C);if(F=B0(C=F),C===F)break}}import{inspect as Y3}from"util";import{fileURLToPath as I0}from"url";import{format as a8}from"util";import{normalize as e8,resolve as D3}from"path";function pD(D){if(!(D!==D.toLowerCase()&&D!==D.toUpperCase()))D=D.toLowerCase();if(D.indexOf("-")===-1&&D.indexOf("_")===-1)return D;else{let F="",C=!1,E=D.match(/^-+/);for(let B=E?E[0].length:0;B<D.length;B++){let $=D.charAt(B);if(C)C=!1,$=$.toUpperCase();if(B!==0&&($==="-"||$==="_"))C=!0;else if($!=="-"&&$!=="_")F+=$}return F}}function _u(D,u){let F=D.toLowerCase();u=u||"-";let C="";for(let E=0;E<D.length;E++){let B=F.charAt(E),$=D.charAt(E);if(B!==$&&E>0)C+=`${u}${F.charAt(E)}`;else C+=$}return C}function Ru(D){if(D===null||D===void 0)return!1;if(typeof D==="number")return!0;if(/^0x[0-9a-f]+$/i.test(D))return!0;if(/^0[^.]/.test(D))return!1;return/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(D)}function z0(D){if(Array.isArray(D))return D.map(($)=>typeof $!=="string"?$+"":$);D=D.trim();let u=0,F=null,C=null,E=null,B=[];for(let $=0;$<D.length;$++){if(F=C,C=D.charAt($),C===" "&&!E){if(F!==" ")u++;continue}if(C===E)E=null;else if((C==="'"||C==='"')&&!E)E=C;if(!B[u])B[u]="";B[u]+=C}return B}var HD;(function(D){D.BOOLEAN="boolean",D.STRING="string",D.NUMBER="number",D.ARRAY="array"})(HD||(HD={}));var AD;class EF{constructor(D){AD=D}parse(D,u){let F=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},u),C=z0(D),E=typeof D==="string",B=s8(Object.assign(Object.create(null),F.alias)),$=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},F.configuration),Z=Object.assign(Object.create(null),F.default),M=F.configObjects||[],O=F.envPrefix,V=$["populate--"],Y=V?"--":"_",q=Object.create(null),H=Object.create(null),W=F.__||AD.format,J={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},S=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,d=new RegExp("^--"+$["negation-prefix"]+"(.+)");if([].concat(F.array||[]).filter(Boolean).forEach(function(Q){let G=typeof Q==="object"?Q.key:Q,T=Object.keys(Q).map(function(U){return{boolean:"bools",string:"strings",number:"numbers"}[U]}).filter(Boolean).pop();if(T)J[T][G]=!0;J.arrays[G]=!0,J.keys.push(G)}),[].concat(F.boolean||[]).filter(Boolean).forEach(function(Q){J.bools[Q]=!0,J.keys.push(Q)}),[].concat(F.string||[]).filter(Boolean).forEach(function(Q){J.strings[Q]=!0,J.keys.push(Q)}),[].concat(F.number||[]).filter(Boolean).forEach(function(Q){J.numbers[Q]=!0,J.keys.push(Q)}),[].concat(F.count||[]).filter(Boolean).forEach(function(Q){J.counts[Q]=!0,J.keys.push(Q)}),[].concat(F.normalize||[]).filter(Boolean).forEach(function(Q){J.normalize[Q]=!0,J.keys.push(Q)}),typeof F.narg==="object")Object.entries(F.narg).forEach(([Q,G])=>{if(typeof G==="number")J.nargs[Q]=G,J.keys.push(Q)});if(typeof F.coerce==="object")Object.entries(F.coerce).forEach(([Q,G])=>{if(typeof G==="function")J.coercions[Q]=G,J.keys.push(Q)});if(typeof F.config<"u"){if(Array.isArray(F.config)||typeof F.config==="string")[].concat(F.config).filter(Boolean).forEach(function(Q){J.configs[Q]=!0});else if(typeof F.config==="object")Object.entries(F.config).forEach(([Q,G])=>{if(typeof G==="boolean"||typeof G==="function")J.configs[Q]=G})}Gu(F.key,B,F.default,J.arrays),Object.keys(Z).forEach(function(Q){(J.aliases[Q]||[]).forEach(function(G){Z[G]=Z[Q]})});let v=null;ou();let ZD=[],m=Object.assign(Object.create(null),{_:[]}),g={};for(let Q=0;Q<C.length;Q++){let G=C[Q],T=G.replace(/^-{3,}/,"---"),U,X,j,I,A,BD;if(G!=="--"&&/^-/.test(G)&&y(G))uD(G);else if(T.match(/^---+(=|$)/)){uD(G);continue}else if(G.match(/^--.+=/)||!$["short-option-groups"]&&G.match(/^-.+=/)){if(I=G.match(/^--?([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3)if(P(I[1],J.arrays))Q=KD(Q,I[1],C,I[2]);else if(P(I[1],J.nargs)!==!1)Q=s(Q,I[1],C,I[2]);else k(I[1],I[2],!0)}else if(G.match(d)&&$["boolean-negation"]){if(I=G.match(d),I!==null&&Array.isArray(I)&&I.length>=2)X=I[1],k(X,P(X,J.arrays)?[!1]:!1)}else if(G.match(/^--.+/)||!$["short-option-groups"]&&G.match(/^-[^-]+/)){if(I=G.match(/^--?(.+)/),I!==null&&Array.isArray(I)&&I.length>=2)if(X=I[1],P(X,J.arrays))Q=KD(Q,X,C);else if(P(X,J.nargs)!==!1)Q=s(Q,X,C);else if(A=C[Q+1],A!==void 0&&(!A.match(/^-/)||A.match(S))&&!P(X,J.bools)&&!P(X,J.counts))k(X,A),Q++;else if(/^(true|false)$/.test(A))k(X,A),Q++;else k(X,c(X))}else if(G.match(/^-.\..+=/)){if(I=G.match(/^-([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3)k(I[1],I[2])}else if(G.match(/^-.\..+/)&&!G.match(S)){if(A=C[Q+1],I=G.match(/^-(.\..+)/),I!==null&&Array.isArray(I)&&I.length>=2)if(X=I[1],A!==void 0&&!A.match(/^-/)&&!P(X,J.bools)&&!P(X,J.counts))k(X,A),Q++;else k(X,c(X))}else if(G.match(/^-[^-]+/)&&!G.match(S)){j=G.slice(1,-1).split(""),U=!1;for(let XD=0;XD<j.length;XD++){if(A=G.slice(XD+2),j[XD+1]&&j[XD+1]==="="){if(BD=G.slice(XD+3),X=j[XD],P(X,J.arrays))Q=KD(Q,X,C,BD);else if(P(X,J.nargs)!==!1)Q=s(Q,X,C,BD);else k(X,BD);U=!0;break}if(A==="-"){k(j[XD],A);continue}if(/[A-Za-z]/.test(j[XD])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(A)&&P(A,J.bools)===!1){k(j[XD],A),U=!0;break}if(j[XD+1]&&j[XD+1].match(/\W/)){k(j[XD],A),U=!0;break}else k(j[XD],c(j[XD]))}if(X=G.slice(-1)[0],!U&&X!=="-")if(P(X,J.arrays))Q=KD(Q,X,C);else if(P(X,J.nargs)!==!1)Q=s(Q,X,C);else if(A=C[Q+1],A!==void 0&&(!/^(-|--)[^-]/.test(A)||A.match(S))&&!P(X,J.bools)&&!P(X,J.counts))k(X,A),Q++;else if(/^(true|false)$/.test(A))k(X,A),Q++;else k(X,c(X))}else if(G.match(/^-[0-9]$/)&&G.match(S)&&P(G.slice(1),J.bools))X=G.slice(1),k(X,c(X));else if(G==="--"){ZD=C.slice(Q+1);break}else if($["halt-at-non-option"]){ZD=C.slice(Q);break}else uD(G)}if(DD(m,!0),DD(m,!1),R(m),t(),PD(m,J.aliases,Z,!0),p(m),$["set-placeholder-key"])FD(m);if(Object.keys(J.counts).forEach(function(Q){if(!i(m,Q.split(".")))k(Q,0)}),V&&ZD.length)m[Y]=[];if(ZD.forEach(function(Q){m[Y].push(Q)}),$["camel-case-expansion"]&&$["strip-dashed"])Object.keys(m).filter((Q)=>Q!=="--"&&Q.includes("-")).forEach((Q)=>{delete m[Q]});if($["strip-aliased"])[].concat(...Object.keys(B).map((Q)=>B[Q])).forEach((Q)=>{if($["camel-case-expansion"]&&Q.includes("-"))delete m[Q.split(".").map((G)=>pD(G)).join(".")];delete m[Q]});function uD(Q){let G=f("_",Q);if(typeof G==="string"||typeof G==="number")m._.push(G)}function s(Q,G,T,U){let X,j=P(G,J.nargs);if(j=typeof j!=="number"||isNaN(j)?1:j,j===0){if(!ED(U))v=Error(W("Argument unexpected for: %s",G));return k(G,c(G)),Q}let I=ED(U)?0:1;if($["nargs-eats-options"]){if(T.length-(Q+1)+I<j)v=Error(W("Not enough arguments following: %s",G));I=j}else{for(X=Q+1;X<T.length;X++)if(!T[X].match(/^-[^0-9]/)||T[X].match(S)||y(T[X]))I++;else break;if(I<j)v=Error(W("Not enough arguments following: %s",G))}let A=Math.min(I,j);if(!ED(U)&&A>0)k(G,U),A--;for(X=Q+1;X<A+Q+1;X++)k(G,T[X]);return Q+A}function KD(Q,G,T,U){let X=[],j=U||T[Q+1],I=P(G,J.nargs);if(P(G,J.bools)&&!/^(true|false)$/.test(j))X.push(!0);else if(ED(j)||ED(U)&&/^-/.test(j)&&!S.test(j)&&!y(j)){if(Z[G]!==void 0){let A=Z[G];X=Array.isArray(A)?A:[A]}}else{if(!ED(U))X.push(_(G,U,!0));for(let A=Q+1;A<T.length;A++){if(!$["greedy-arrays"]&&X.length>0||I&&typeof I==="number"&&X.length>=I)break;if(j=T[A],/^-/.test(j)&&!S.test(j)&&!y(j))break;Q=A,X.push(_(G,j,E))}}if(typeof I==="number"&&(I&&X.length<I||isNaN(I)&&X.length===0))v=Error(W("Not enough arguments following: %s",G));return k(G,X),Q}function k(Q,G,T=E){if(/-/.test(Q)&&$["camel-case-expansion"]){let j=Q.split(".").map(function(I){return pD(I)}).join(".");Mu(Q,j)}let U=_(Q,G,T),X=Q.split(".");if(ND(m,X,U),J.aliases[Q])J.aliases[Q].forEach(function(j){let I=j.split(".");ND(m,I,U)});if(X.length>1&&$["dot-notation"])(J.aliases[X[0]]||[]).forEach(function(j){let I=j.split("."),A=[].concat(X);if(A.shift(),I=I.concat(A),!(J.aliases[Q]||[]).includes(I.join(".")))ND(m,I,U)});if(P(Q,J.normalize)&&!P(Q,J.arrays))[Q].concat(J.aliases[Q]||[]).forEach(function(I){Object.defineProperty(g,I,{enumerable:!0,get(){return G},set(A){G=typeof A==="string"?AD.normalize(A):A}})})}function Mu(Q,G){if(!(J.aliases[Q]&&J.aliases[Q].length))J.aliases[Q]=[G],q[G]=!0;if(!(J.aliases[G]&&J.aliases[G].length))Mu(G,Q)}function _(Q,G,T){if(T)G=r8(G);if(P(Q,J.bools)||P(Q,J.counts)){if(typeof G==="string")G=G==="true"}let U=Array.isArray(G)?G.map(function(X){return f(Q,X)}):f(Q,G);if(P(Q,J.counts)&&(ED(U)||typeof U==="boolean"))U=CF();if(P(Q,J.normalize)&&P(Q,J.arrays))if(Array.isArray(G))U=G.map((X)=>{return AD.normalize(X)});else U=AD.normalize(G);return U}function f(Q,G){if(!$["parse-positional-numbers"]&&Q==="_")return G;if(!P(Q,J.strings)&&!P(Q,J.bools)&&!Array.isArray(G)){if(Ru(G)&&$["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${G}`)))||!ED(G)&&P(Q,J.numbers))G=Number(G)}return G}function R(Q){let G=Object.create(null);PD(G,J.aliases,Z),Object.keys(J.configs).forEach(function(T){let U=Q[T]||G[T];if(U)try{let X=null,j=AD.resolve(AD.cwd(),U),I=J.configs[T];if(typeof I==="function"){try{X=I(j)}catch(A){X=A}if(X instanceof Error){v=X;return}}else X=AD.require(j);h(X)}catch(X){if(X.name==="PermissionDenied")v=X;else if(Q[T])v=Error(W("Invalid JSON config file: %s",U))}})}function h(Q,G){Object.keys(Q).forEach(function(T){let U=Q[T],X=G?G+"."+T:T;if(typeof U==="object"&&U!==null&&!Array.isArray(U)&&$["dot-notation"])h(U,X);else if(!i(m,X.split("."))||P(X,J.arrays)&&$["combine-arrays"])k(X,U)})}function t(){if(typeof M<"u")M.forEach(function(Q){h(Q)})}function DD(Q,G){if(typeof O>"u")return;let T=typeof O==="string"?O:"",U=AD.env();Object.keys(U).forEach(function(X){if(T===""||X.lastIndexOf(T,0)===0){let j=X.split("__").map(function(I,A){if(A===0)I=I.substring(T.length);return pD(I)});if((G&&J.configs[j.join(".")]||!G)&&!i(Q,j))k(j.join("."),U[X])}})}function p(Q){let G,T=new Set;Object.keys(Q).forEach(function(U){if(!T.has(U)){if(G=P(U,J.coercions),typeof G==="function")try{let X=f(U,G(Q[U]));[].concat(J.aliases[U]||[],U).forEach((j)=>{T.add(j),Q[j]=X})}catch(X){v=X}}})}function FD(Q){return J.keys.forEach((G)=>{if(~G.indexOf("."))return;if(typeof Q[G]>"u")Q[G]=void 0}),Q}function PD(Q,G,T,U=!1){Object.keys(T).forEach(function(X){if(!i(Q,X.split("."))){if(ND(Q,X.split("."),T[X]),U)H[X]=!0;(G[X]||[]).forEach(function(j){if(i(Q,j.split(".")))return;ND(Q,j.split("."),T[X])})}})}function i(Q,G){let T=Q;if(!$["dot-notation"])G=[G.join(".")];G.slice(0,-1).forEach(function(X){T=T[X]||{}});let U=G[G.length-1];if(typeof T!=="object")return!1;else return U in T}function ND(Q,G,T){let U=Q;if(!$["dot-notation"])G=[G.join(".")];G.slice(0,-1).forEach(function(BD){if(BD=Z0(BD),typeof U==="object"&&U[BD]===void 0)U[BD]={};if(typeof U[BD]!=="object"||Array.isArray(U[BD])){if(Array.isArray(U[BD]))U[BD].push({});else U[BD]=[U[BD],{}];U=U[BD][U[BD].length-1]}else U=U[BD]});let X=Z0(G[G.length-1]),j=P(G.join("."),J.arrays),I=Array.isArray(T),A=$["duplicate-arguments-array"];if(!A&&P(X,J.nargs)){if(A=!0,!ED(U[X])&&J.nargs[X]===1||Array.isArray(U[X])&&U[X].length===J.nargs[X])U[X]=void 0}if(T===CF())U[X]=CF(U[X]);else if(Array.isArray(U[X]))if(A&&j&&I)U[X]=$["flatten-duplicate-arrays"]?U[X].concat(T):(Array.isArray(U[X][0])?U[X]:[U[X]]).concat([T]);else if(!A&&Boolean(j)===Boolean(I))U[X]=T;else U[X]=U[X].concat([T]);else if(U[X]===void 0&&j)U[X]=I?T:[T];else if(A&&!(U[X]===void 0||P(X,J.counts)||P(X,J.bools)))U[X]=[U[X],T];else U[X]=T}function Gu(...Q){Q.forEach(function(G){Object.keys(G||{}).forEach(function(T){if(J.aliases[T])return;J.aliases[T]=[].concat(B[T]||[]),J.aliases[T].concat(T).forEach(function(U){if(/-/.test(U)&&$["camel-case-expansion"]){let X=pD(U);if(X!==T&&J.aliases[T].indexOf(X)===-1)J.aliases[T].push(X),q[X]=!0}}),J.aliases[T].concat(T).forEach(function(U){if(U.length>1&&/[A-Z]/.test(U)&&$["camel-case-expansion"]){let X=_u(U,"-");if(X!==T&&J.aliases[T].indexOf(X)===-1)J.aliases[T].push(X),q[X]=!0}}),J.aliases[T].forEach(function(U){J.aliases[U]=[T].concat(J.aliases[T].filter(function(X){return U!==X}))})})})}function P(Q,G){let T=[].concat(J.aliases[Q]||[],Q),U=Object.keys(G),X=T.find((j)=>U.includes(j));return X?G[X]:!1}function Cu(Q){let G=Object.keys(J);return[].concat(G.map((U)=>J[U])).some(function(U){return Array.isArray(U)?U.includes(Q):U[Q]})}function PF(Q,...G){return[].concat(...G).some(function(U){let X=Q.match(U);return X&&Cu(X[1])})}function x(Q){if(Q.match(S)||!Q.match(/^-[^-]+/))return!1;let G=!0,T,U=Q.slice(1).split("");for(let X=0;X<U.length;X++){if(T=Q.slice(X+2),!Cu(U[X])){G=!1;break}if(U[X+1]&&U[X+1]==="="||T==="-"||/[A-Za-z]/.test(U[X])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(T)||U[X+1]&&U[X+1].match(/\W/))break}return G}function y(Q){return $["unknown-options-as-args"]&&CD(Q)}function CD(Q){if(Q=Q.replace(/^-{3,}/,"--"),Q.match(S))return!1;if(x(Q))return!1;return!PF(Q,/^-+([^=]+?)=[\s\S]*$/,d,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function c(Q){if(!P(Q,J.bools)&&!P(Q,J.counts)&&`${Q}`in Z)return Z[Q];else return zD(r(Q))}function zD(Q){return{[HD.BOOLEAN]:!0,[HD.STRING]:"",[HD.NUMBER]:void 0,[HD.ARRAY]:[]}[Q]}function r(Q){let G=HD.BOOLEAN;if(P(Q,J.strings))G=HD.STRING;else if(P(Q,J.numbers))G=HD.NUMBER;else if(P(Q,J.bools))G=HD.BOOLEAN;else if(P(Q,J.arrays))G=HD.ARRAY;return G}function ED(Q){return Q===void 0}function ou(){Object.keys(J.counts).find((Q)=>{if(P(Q,J.arrays))return v=Error(W("Invalid configuration: %s, opts.count excludes opts.array.",Q)),!0;else if(P(Q,J.nargs))return v=Error(W("Invalid configuration: %s, opts.count excludes opts.narg.",Q)),!0;return!1})}return{aliases:Object.assign({},J.aliases),argv:Object.assign(g,m),configuration:$,defaulted:Object.assign({},H),error:v,newAliases:Object.assign({},q)}}}function s8(D){let u=[],F=Object.create(null),C=!0;Object.keys(D).forEach(function(E){u.push([].concat(D[E],E))});while(C){C=!1;for(let E=0;E<u.length;E++)for(let B=E+1;B<u.length;B++)if(u[E].filter(function(Z){return u[B].indexOf(Z)!==-1}).length){u[E]=u[E].concat(u[B]),u.splice(B,1),C=!0;break}}return u.forEach(function(E){E=E.filter(function($,Z,M){return M.indexOf($)===Z});let B=E.pop();if(B!==void 0&&typeof B==="string")F[B]=E}),F}function CF(D){return D!==void 0?D+1:1}function Z0(D){if(D==="__proto__")return"___proto___";return D}function r8(D){return typeof D==="string"&&(D[0]==="'"||D[0]==='"')&&D[D.length-1]===D[0]?D.substring(1,D.length-1):D}import{readFileSync as u3}from"fs";import{createRequire as Q0}from"module";var BF,$F,zF,X0=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20,M0=($F=(BF=process===null||process===void 0?void 0:process.versions)===null||BF===void 0?void 0:BF.node)!==null&&$F!==void 0?$F:(zF=process===null||process===void 0?void 0:process.version)===null||zF===void 0?void 0:zF.slice(1);if(M0){if(Number(M0.match(/^([^.]+)/)[1])<X0)throw Error(`yargs parser supports a minimum Node.js version of ${X0}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}var F3=process?process.env:{},G0=Q0?Q0(import.meta.url):void 0,J0=new EF({cwd:process.cwd,env:()=>{return F3},format:a8,normalize:e8,resolve:D3,require:(D)=>{if(typeof G0<"u")return G0(D);else if(D.match(/\.json$/))return JSON.parse(u3(D,"utf8"));else throw Error("only .json config files are supported in ESM")}}),Ju=function(u,F){return J0.parse(u.slice(),F).argv};Ju.detailed=function(D,u){return J0.parse(D.slice(),u)};Ju.camelCase=pD;Ju.decamelize=_u;Ju.looksLikeNumber=Ru;var Y0=Ju;import{basename as q3,dirname as O3,extname as H3,relative as U3,resolve as f0,join as W3}from"path";function C3(){if(E3())return 0;return 1}function E3(){return B3()&&!process.defaultApp}function B3(){return!!process.versions.electron}function q0(){return process.argv[C3()]}import{readFileSync as $3,statSync as z3,writeFile as Z3}from"fs";import{format as Q3}from"util";import{resolve as X3}from"path";var O0={fs:{readFileSync:$3,writeFile:Z3},format:Q3,resolve:X3,exists:(D)=>{try{return z3(D).isFile()}catch(u){return!1}}};var fD;class H0{constructor(D){D=D||{},this.directory=D.directory||"./locales",this.updateFiles=typeof D.updateFiles==="boolean"?D.updateFiles:!0,this.locale=D.locale||"en",this.fallbackToLanguage=typeof D.fallbackToLanguage==="boolean"?D.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...D){if(typeof arguments[0]!=="string")return this._taggedLiteral(arguments[0],...arguments);let u=D.shift(),F=function(){};if(typeof D[D.length-1]==="function")F=D.pop();if(F=F||function(){},!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][u]&&this.updateFiles)this.cache[this.locale][u]=u,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:F});else F();return fD.format.apply(fD.format,[this.cache[this.locale][u]||u].concat(D))}__n(){let D=Array.prototype.slice.call(arguments),u=D.shift(),F=D.shift(),C=D.shift(),E=function(){};if(typeof D[D.length-1]==="function")E=D.pop();if(!this.cache[this.locale])this._readLocaleFile();let B=C===1?u:F;if(this.cache[this.locale][u])B=this.cache[this.locale][u][C===1?"one":"other"];if(!this.cache[this.locale][u]&&this.updateFiles)this.cache[this.locale][u]={one:u,other:F},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:E});else E();let $=[B];if(~B.indexOf("%d"))$.push(C);return fD.format.apply(fD.format,$.concat(D))}setLocale(D){this.locale=D}getLocale(){return this.locale}updateLocale(D){if(!this.cache[this.locale])this._readLocaleFile();for(let u in D)if(Object.prototype.hasOwnProperty.call(D,u))this.cache[this.locale][u]=D[u]}_taggedLiteral(D,...u){let F="";return D.forEach(function(C,E){let B=u[E+1];if(F+=C,typeof B<"u")F+="%s"}),this.__.apply(this,[F].concat([].slice.call(u,1)))}_enqueueWrite(D){if(this.writeQueue.push(D),this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){let D=this,u=this.writeQueue[0],F=u.directory,C=u.locale,E=u.cb,B=this._resolveLocaleFile(F,C),$=JSON.stringify(this.cache[C],null,2);fD.fs.writeFile(B,$,"utf-8",function(Z){if(D.writeQueue.shift(),D.writeQueue.length>0)D._processWriteQueue();E(Z)})}_readLocaleFile(){let D={},u=this._resolveLocaleFile(this.directory,this.locale);try{if(fD.fs.readFileSync)D=JSON.parse(fD.fs.readFileSync(u,"utf-8"))}catch(F){if(F instanceof SyntaxError)F.message="syntax error in "+u;if(F.code==="ENOENT")D={};else throw F}this.cache[this.locale]=D}_resolveLocaleFile(D,u){let F=fD.resolve(D,"./",u+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(F)&&~u.lastIndexOf("_")){let C=fD.resolve(D,"./",u.split("_")[0]+".json");if(this._fileExistsSync(C))F=C}return F}_fileExistsSync(D){return fD.exists(D)}}function U0(D,u){fD=u;let F=new H0(D);return{__:F.__.bind(F),__n:F.__n.bind(F),setLocale:F.setLocale.bind(F),getLocale:F.getLocale.bind(F),updateLocale:F.updateLocale.bind(F),locale:F.locale}}var M3=(D)=>{return U0(D,O0)},W0=M3;var L0=K8(T0(),1);import{createRequire as V3}from"module";import{readFileSync as T3,readdirSync as f3}from"fs";var ZF=I0(import.meta.url),I3=ZF.substring(0,ZF.lastIndexOf("node_modules")),L3=V3(import.meta.url),K0={assert:{notStrictEqual:G3,strictEqual:J3},cliui:uF,findUp:FF,getEnv:(D)=>{return process.env[D]},inspect:Y3,getProcessArgvBin:q0,mainFilename:I3||process.cwd(),Parser:Y0,path:{basename:q3,dirname:O3,extname:H3,relative:U3,resolve:f0,join:W3},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(D,u)=>process.emitWarning(D,u),execPath:()=>process.execPath,exit:(D)=>{process.exit(D)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:T3,readdirSync:f3,require:L3,getCallerFile:()=>{let D=L0.default(3);return D.match(/^file:\/\//)?I0(D):D},stringWidth:TD,y18n:W0({directory:f0(ZF,"../../../locales"),updateFiles:!1})};function MD(D,u,F,C){F.assert.notStrictEqual(D,u,C)}function QF(D,u){u.assert.strictEqual(typeof D,"string")}function Eu(D){return Object.keys(D)}function l(D){return!!D&&!!D.then&&typeof D.then==="function"}class a extends Error{constructor(D){super(D||"yargs error");if(this.name="YError",Error.captureStackTrace)Error.captureStackTrace(this,a)}}function xD(D){let F=D.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),C=/\.*[\][<>]/g,E=F.shift();if(!E)throw Error(`No command found in: ${D}`);let B={cmd:E.replace(C,""),demanded:[],optional:[]};return F.forEach(($,Z)=>{let M=!1;if($=$.replace(/\s/g,""),/\.+[\]>]/.test($)&&Z===F.length-1)M=!0;if(/^\[/.test($))B.optional.push({cmd:$.replace(C,"").split("|"),variadic:M});else B.demanded.push({cmd:$.replace(C,"").split("|"),variadic:M})}),B}var K3=["first","second","third","fourth","fifth","sixth"];function L(D,u,F){function C(){return typeof D==="object"?[{demanded:[],optional:[]},D,u]:[xD(`cmd ${D}`),u,F]}try{let E=0,[B,$,Z]=C(),M=[].slice.call($);while(M.length&&M[M.length-1]===void 0)M.pop();let O=Z||M.length;if(O<B.demanded.length)throw new a(`Not enough arguments provided. Expected ${B.demanded.length} but received ${M.length}.`);let V=B.demanded.length+B.optional.length;if(O>V)throw new a(`Too many arguments provided. Expected max ${V} but received ${O}.`);B.demanded.forEach((Y)=>{let q=M.shift(),H=j0(q);if(Y.cmd.filter((J)=>J===H||J==="*").length===0)_0(H,Y.cmd,E);E+=1}),B.optional.forEach((Y)=>{if(M.length===0)return;let q=M.shift(),H=j0(q);if(Y.cmd.filter((J)=>J===H||J==="*").length===0)_0(H,Y.cmd,E);E+=1})}catch(E){console.warn(E.stack)}}function j0(D){if(Array.isArray(D))return"array";else if(D===null)return"null";return typeof D}function _0(D,u,F){throw new a(`Invalid ${K3[F]||"manyith"} argument. Expected ${u.join(" or ")} but received ${D}.`)}class XF{constructor(D){this.globalMiddleware=[],this.frozens=[],this.yargs=D}addMiddleware(D,u,F=!0,C=!1){if(L("<array|function> [boolean] [boolean] [boolean]",[D,u,F],arguments.length),Array.isArray(D)){for(let E=0;E<D.length;E++){if(typeof D[E]!=="function")throw Error("middleware must be a function");let B=D[E];B.applyBeforeValidation=u,B.global=F}Array.prototype.push.apply(this.globalMiddleware,D)}else if(typeof D==="function"){let E=D;E.applyBeforeValidation=u,E.global=F,E.mutates=C,this.globalMiddleware.push(D)}return this.yargs}addCoerceMiddleware(D,u){let F=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((C)=>{let E=[...F[u]||[],u];if(!C.option)return!0;else return!E.includes(C.option)}),D.option=u,this.addMiddleware(D,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let D=this.frozens.pop();if(D!==void 0)this.globalMiddleware=D}reset(){this.globalMiddleware=this.globalMiddleware.filter((D)=>D.global)}}function R0(D){if(!D)return[];return D.map((u)=>{return u.applyBeforeValidation=!1,u})}function tD(D,u,F,C){return F.reduce((E,B)=>{if(B.applyBeforeValidation!==C)return E;if(B.mutates){if(B.applied)return E;B.applied=!0}if(l(E))return E.then(($)=>Promise.all([$,B($,u)])).then(([$,Z])=>Object.assign($,Z));else{let $=B(E,u);return l($)?$.then((Z)=>Object.assign(E,Z)):Object.assign(E,$)}},D)}function kD(D,u,F=(C)=>{throw C}){try{let C=j3(D)?D():D;return l(C)?C.then((E)=>u(E)):u(C)}catch(C){return F(C)}}function j3(D){return typeof D==="function"}var Bu=/(^\*)|(^\$0)/;class A0{constructor(D,u,F,C){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=C,this.usage=D,this.globalMiddleware=F,this.validation=u}addDirectory(D,u,F,C){C=C||{},this.requireCache.add(F);let E=this.shim.path.resolve(this.shim.path.dirname(F),D),B=this.shim.readdirSync(E,{recursive:C.recurse?!0:!1});if(!Array.isArray(C.extensions))C.extensions=["js"];let $=typeof C.visit==="function"?C.visit:(Z)=>Z;for(let Z of B){let M=Z.toString();if(C.exclude){let V=!1;if(typeof C.exclude==="function")V=C.exclude(M);else V=C.exclude.test(M);if(V)continue}if(C.include){let V=!1;if(typeof C.include==="function")V=C.include(M);else V=C.include.test(M);if(!V)continue}let O=!1;for(let V of C.extensions)if(M.endsWith(V))O=!0;if(O){let V=this.shim.path.join(E,M),Y=u(V),q=Object.create(null,Object.getOwnPropertyDescriptors({...Y}));if($(q,V,M)){if(this.requireCache.has(V))continue;else this.requireCache.add(V);if(!q.command)q.command=this.shim.path.basename(V,this.shim.path.extname(V));this.addHandler(q)}}}}addHandler(D,u,F,C,E,B){let $=[],Z=R0(E);if(C=C||(()=>{}),Array.isArray(D))if(_3(D))[D,...$]=D;else for(let M of D)this.addHandler(M);else if(N3(D)){let M=Array.isArray(D.command)||typeof D.command==="string"?D.command:null;if(M===null)throw Error(`No command name given for module: ${this.shim.inspect(D)}`);if(D.aliases)M=[].concat(M).concat(D.aliases);this.addHandler(M,this.extractDesc(D),D.builder,D.handler,D.middlewares,D.deprecated);return}else if(N0(F)){this.addHandler([D].concat($),u,F.builder,F.handler,F.middlewares,F.deprecated);return}if(typeof D==="string"){let M=xD(D);$=$.map((Y)=>xD(Y).cmd);let O=!1,V=[M.cmd].concat($).filter((Y)=>{if(Bu.test(Y))return O=!0,!1;return!0});if(V.length===0&&O)V.push("$0");if(O)M.cmd=V[0],$=V.slice(1),D=D.replace(Bu,M.cmd);if($.forEach((Y)=>{this.aliasMap[Y]=M.cmd}),u!==!1)this.usage.command(D,u,O,$,B);if(this.handlers[M.cmd]={original:D,description:u,handler:C,builder:F||{},middlewares:Z,deprecated:B,demanded:M.demanded,optional:M.optional},O)this.defaultCommand=this.handlers[M.cmd]}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(D,u,F,C,E,B){let $=this.handlers[D]||this.handlers[this.aliasMap[D]]||this.defaultCommand,Z=u.getInternalMethods().getContext(),M=Z.commands.slice(),O=!D;if(D)Z.commands.push(D),Z.fullCommands.push($.original);let V=this.applyBuilderUpdateUsageAndParse(O,$,u,F.aliases,M,C,E,B);return l(V)?V.then((Y)=>this.applyMiddlewareAndGetResult(O,$,Y.innerArgv,Z,E,Y.aliases,u)):this.applyMiddlewareAndGetResult(O,$,V.innerArgv,Z,E,V.aliases,u)}applyBuilderUpdateUsageAndParse(D,u,F,C,E,B,$,Z){let M=u.builder,O=F;if(Nu(M)){F.getInternalMethods().getUsageInstance().freeze();let V=M(F.getInternalMethods().reset(C),Z);if(l(V))return V.then((Y)=>{return O=P0(Y)?Y:F,this.parseAndUpdateUsage(D,u,O,E,B,$)})}else if(R3(M))F.getInternalMethods().getUsageInstance().freeze(),O=F.getInternalMethods().reset(C),Object.keys(u.builder).forEach((V)=>{O.option(V,M[V])});return this.parseAndUpdateUsage(D,u,O,E,B,$)}parseAndUpdateUsage(D,u,F,C,E,B){if(D)F.getInternalMethods().getUsageInstance().unfreeze(!0);if(this.shouldUpdateUsage(F))F.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(C,u),u.description);let $=F.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,E,B);return l($)?$.then((Z)=>({aliases:F.parsed.aliases,innerArgv:Z})):{aliases:F.parsed.aliases,innerArgv:$}}shouldUpdateUsage(D){return!D.getInternalMethods().getUsageInstance().getUsageDisabled()&&D.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(D,u){let F=Bu.test(u.original)?u.original.replace(Bu,"").trim():u.original,C=D.filter((E)=>{return!Bu.test(E)});return C.push(F),`$0 ${C.join(" ")}`}handleValidationAndGetResult(D,u,F,C,E,B,$,Z){if(!B.getInternalMethods().getHasOutput()){let M=B.getInternalMethods().runValidation(E,Z,B.parsed.error,D);F=kD(F,(O)=>{return M(O),O})}if(u.handler&&!B.getInternalMethods().getHasOutput()){B.getInternalMethods().setHasOutput();let M=!!B.getOptions().configuration["populate--"];if(B.getInternalMethods().postProcess(F,M,!1,!1),F=tD(F,B,$,!1),F=kD(F,(O)=>{let V=u.handler(O);return l(V)?V.then(()=>O):O}),!D)B.getInternalMethods().getUsageInstance().cacheHelpMessage();if(l(F)&&!B.getInternalMethods().hasParseCallback())F.catch((O)=>{try{B.getInternalMethods().getUsageInstance().fail(null,O)}catch(V){}})}if(!D)C.commands.pop(),C.fullCommands.pop();return F}applyMiddlewareAndGetResult(D,u,F,C,E,B,$){let Z={};if(E)return F;if(!$.getInternalMethods().getHasOutput())Z=this.populatePositionals(u,F,C,$);let M=this.globalMiddleware.getMiddleware().slice(0).concat(u.middlewares),O=tD(F,$,M,!0);return l(O)?O.then((V)=>this.handleValidationAndGetResult(D,u,V,C,B,$,M,Z)):this.handleValidationAndGetResult(D,u,O,C,B,$,M,Z)}populatePositionals(D,u,F,C){u._=u._.slice(F.commands.length);let E=D.demanded.slice(0),B=D.optional.slice(0),$={};this.validation.positionalCount(E.length,u._.length);while(E.length){let Z=E.shift();this.populatePositional(Z,u,$)}while(B.length){let Z=B.shift();this.populatePositional(Z,u,$)}return u._=F.commands.concat(u._.map((Z)=>""+Z)),this.postProcessPositionals(u,$,this.cmdToParseOptions(D.original),C),$}populatePositional(D,u,F){let C=D.cmd[0];if(D.variadic)F[C]=u._.splice(0).map(String);else if(u._.length)F[C]=[String(u._.shift())]}cmdToParseOptions(D){let u={array:[],default:{},alias:{},demand:{}},F=xD(D);return F.demanded.forEach((C)=>{let[E,...B]=C.cmd;if(C.variadic)u.array.push(E),u.default[E]=[];u.alias[E]=B,u.demand[E]=!0}),F.optional.forEach((C)=>{let[E,...B]=C.cmd;if(C.variadic)u.array.push(E),u.default[E]=[];u.alias[E]=B}),u}postProcessPositionals(D,u,F,C){let E=Object.assign({},C.getOptions());E.default=Object.assign(F.default,E.default);for(let M of Object.keys(F.alias))E.alias[M]=(E.alias[M]||[]).concat(F.alias[M]);E.array=E.array.concat(F.array),E.config={};let B=[];if(Object.keys(u).forEach((M)=>{u[M].map((O)=>{if(E.configuration["unknown-options-as-args"])E.key[M]=!0;B.push(`--${M}`),B.push(O)})}),!B.length)return;let $=Object.assign({},E.configuration,{"populate--":!1}),Z=this.shim.Parser.detailed(B,Object.assign({},E,{configuration:$}));if(Z.error)C.getInternalMethods().getUsageInstance().fail(Z.error.message,Z.error);else{let M=Object.keys(u);Object.keys(u).forEach((O)=>{M.push(...Z.aliases[O])}),Object.keys(Z.argv).forEach((O)=>{if(M.includes(O)){if(!u[O])u[O]=Z.argv[O];if(!this.isInConfigs(C,O)&&!this.isDefaulted(C,O)&&Object.prototype.hasOwnProperty.call(D,O)&&Object.prototype.hasOwnProperty.call(Z.argv,O)&&(Array.isArray(D[O])||Array.isArray(Z.argv[O])))D[O]=[].concat(D[O],Z.argv[O]);else D[O]=Z.argv[O]}})}}isDefaulted(D,u){let{default:F}=D.getOptions();return Object.prototype.hasOwnProperty.call(F,u)||Object.prototype.hasOwnProperty.call(F,this.shim.Parser.camelCase(u))}isInConfigs(D,u){let{configObjects:F}=D.getOptions();return F.some((C)=>Object.prototype.hasOwnProperty.call(C,u))||F.some((C)=>Object.prototype.hasOwnProperty.call(C,this.shim.Parser.camelCase(u)))}runDefaultBuilderOn(D){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(D)){let F=Bu.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");D.getInternalMethods().getUsageInstance().usage(F,this.defaultCommand.description)}let u=this.defaultCommand.builder;if(Nu(u))return u(D,!0);else if(!N0(u))Object.keys(u).forEach((F)=>{D.option(F,u[F])});return}extractDesc({describe:D,description:u,desc:F}){for(let C of[D,u,F]){if(typeof C==="string"||C===!1)return C;MD(C,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let D=this.frozens.pop();MD(D,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=D}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function S0(D,u,F,C){return new A0(D,u,F,C)}function N0(D){return typeof D==="object"&&!!D.builder&&typeof D.handler==="function"}function _3(D){return D.every((u)=>typeof u==="string")}function Nu(D){return typeof D==="function"}function R3(D){return typeof D==="object"}function N3(D){return typeof D==="object"&&!Array.isArray(D)}function bD(D={},u=()=>!0){let F={};return Eu(D).forEach((C)=>{if(u(C,D[C]))F[C]=D[C]}),F}function hD(D){if(typeof process>"u")return;[process.stdout,process.stderr].forEach((u)=>{let F=u;if(F._handle&&F.isTTY&&typeof F._handle.setBlocking==="function")F._handle.setBlocking(D)})}function A3(D){return typeof D==="boolean"}function b0(D,u){let F=u.y18n.__,C={},E=[];C.failFn=function(f){E.push(f)};let B=null,$=null,Z=!0;C.showHelpOnFail=function(f=!0,R){let[h,t]=typeof f==="string"?[!0,f]:[f,R];if(D.getInternalMethods().isGlobalContext())$=t;return B=t,Z=h,C};let M=!1;C.fail=function(f,R){let h=D.getInternalMethods().getLoggerInstance();if(E.length)for(let t=E.length-1;t>=0;--t){let DD=E[t];if(A3(DD)){if(R)throw R;else if(f)throw Error(f)}else DD(f,R,C)}else{if(D.getExitProcess())hD(!0);if(!M){if(M=!0,Z)D.showHelp("error"),h.error();if(f||R)h.error(f||R);let t=B||$;if(t){if(f||R)h.error("");h.error(t)}}if(R=R||new a(f),D.getExitProcess())return D.exit(1);else if(D.getInternalMethods().hasParseCallback())return D.exit(1,R);else throw R}};let O=[],V=!1;C.usage=(_,f)=>{if(_===null)return V=!0,O=[],C;return V=!1,O.push([_,f||""]),C},C.getUsage=()=>{return O},C.getUsageDisabled=()=>{return V},C.getPositionalGroupName=()=>{return F("Positionals:")};let Y=[];C.example=(_,f)=>{Y.push([_,f||""])};let q=[];C.command=function(f,R,h,t,DD=!1){if(h)q=q.map((p)=>{return p[2]=!1,p});q.push([f,R||"",h,t,DD])},C.getCommands=()=>q;let H={};C.describe=function(f,R){if(Array.isArray(f))f.forEach((h)=>{C.describe(h,R)});else if(typeof f==="object")Object.keys(f).forEach((h)=>{C.describe(h,f[h])});else H[f]=R},C.getDescriptions=()=>H;let W=[];C.epilog=(_)=>{W.push(_)};let J=!1,S;C.wrap=(_)=>{J=!0,S=_},C.getWrap=()=>{if(u.getEnv("YARGS_DISABLE_WRAP"))return null;if(!J)S=KD(),J=!0;return S};let d="__yargsString__:";C.deferY18nLookup=(_)=>d+_,C.help=function(){if(m)return m;ZD();let f=D.customScriptName?D.$0:u.path.basename(D.$0),R=D.getDemandedOptions(),h=D.getDemandedCommands(),t=D.getDeprecatedOptions(),DD=D.getGroups(),p=D.getOptions(),FD=[];FD=FD.concat(Object.keys(H)),FD=FD.concat(Object.keys(R)),FD=FD.concat(Object.keys(h)),FD=FD.concat(Object.keys(p.default)),FD=FD.filter(uD),FD=Object.keys(FD.reduce((x,y)=>{if(y!=="_")x[y]=!0;return x},{}));let PD=C.getWrap(),i=u.cliui({width:PD,wrap:!!PD});if(!V){if(O.length)O.forEach((x)=>{if(i.div({text:`${x[0].replace(/\$0/g,f)}`}),x[1])i.div({text:`${x[1]}`,padding:[1,0,0,0]})}),i.div();else if(q.length){let x=null;if(h._)x=`${f} <${F("command")}>
15
+ `;else x=`${f} [${F("command")}]
16
+ `;i.div(`${x}`)}}if(q.length>1||q.length===1&&!q[0][2]){i.div(F("Commands:"));let x=D.getInternalMethods().getContext(),y=x.commands.length?`${x.commands.join(" ")} `:"";if(D.getInternalMethods().getParserConfiguration()["sort-commands"]===!0)q=q.sort((c,zD)=>c[0].localeCompare(zD[0]));let CD=f?`${f} `:"";q.forEach((c)=>{let zD=`${CD}${y}${c[0].replace(/^\$0 ?/,"")}`;i.span({text:zD,padding:[0,2,0,2],width:v(q,PD,`${f}${y}`)+4},{text:c[1]});let r=[];if(c[2])r.push(`[${F("default")}]`);if(c[3]&&c[3].length)r.push(`[${F("aliases:")} ${c[3].join(", ")}]`);if(c[4])if(typeof c[4]==="string")r.push(`[${F("deprecated: %s",c[4])}]`);else r.push(`[${F("deprecated")}]`);if(r.length)i.div({text:r.join(" "),padding:[0,0,0,2],align:"right"});else i.div()}),i.div()}let ND=(Object.keys(p.alias)||[]).concat(Object.keys(D.parsed.newAliases)||[]);FD=FD.filter((x)=>!D.parsed.newAliases[x]&&ND.every((y)=>(p.alias[y]||[]).indexOf(x)===-1));let Gu=F("Options:");if(!DD[Gu])DD[Gu]=[];g(FD,p.alias,DD,Gu);let P=(x)=>/^--/.test(Au(x)),Cu=Object.keys(DD).filter((x)=>DD[x].length>0).map((x)=>{let y=DD[x].filter(uD).map((CD)=>{if(ND.includes(CD))return CD;for(let c=0,zD;(zD=ND[c])!==void 0;c++)if((p.alias[zD]||[]).includes(CD))return zD;return CD});return{groupName:x,normalizedKeys:y}}).filter(({normalizedKeys:x})=>x.length>0).map(({groupName:x,normalizedKeys:y})=>{let CD=y.reduce((c,zD)=>{return c[zD]=[zD].concat(p.alias[zD]||[]).map((r)=>{if(x===C.getPositionalGroupName())return r;else return(/^[0-9]$/.test(r)?p.boolean.includes(zD)?"-":"--":r.length>1?"--":"-")+r}).sort((r,ED)=>P(r)===P(ED)?0:P(r)?1:-1).join(", "),c},{});return{groupName:x,normalizedKeys:y,switches:CD}});if(Cu.filter(({groupName:x})=>x!==C.getPositionalGroupName()).some(({normalizedKeys:x,switches:y})=>!x.every((CD)=>P(y[CD]))))Cu.filter(({groupName:x})=>x!==C.getPositionalGroupName()).forEach(({normalizedKeys:x,switches:y})=>{x.forEach((CD)=>{if(P(y[CD]))y[CD]=S3(y[CD],4)})});if(Cu.forEach(({groupName:x,normalizedKeys:y,switches:CD})=>{i.div(x),y.forEach((c)=>{let zD=CD[c],r=H[c]||"",ED=null;if(r.includes(d))r=F(r.substring(d.length));if(p.boolean.includes(c))ED=`[${F("boolean")}]`;if(p.count.includes(c))ED=`[${F("count")}]`;if(p.string.includes(c))ED=`[${F("string")}]`;if(p.normalize.includes(c))ED=`[${F("string")}]`;if(p.array.includes(c))ED=`[${F("array")}]`;if(p.number.includes(c))ED=`[${F("number")}]`;let ou=(T)=>typeof T==="string"?`[${F("deprecated: %s",T)}]`:`[${F("deprecated")}]`,Q=[c in t?ou(t[c]):null,ED,c in R?`[${F("required")}]`:null,p.choices&&p.choices[c]?`[${F("choices:")} ${C.stringifiedValues(p.choices[c])}]`:null,s(p.default[c],p.defaultDescription[c])].filter(Boolean).join(" ");i.span({text:Au(zD),padding:[0,2,0,2+x0(zD)],width:v(CD,PD)+4},r);let G=D.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;if(Q&&!G)i.div({text:Q,padding:[0,0,0,2],align:"right"});else i.div()}),i.div()}),Y.length)i.div(F("Examples:")),Y.forEach((x)=>{x[0]=x[0].replace(/\$0/g,f)}),Y.forEach((x)=>{if(x[1]==="")i.div({text:x[0],padding:[0,2,0,2]});else i.div({text:x[0],padding:[0,2,0,2],width:v(Y,PD)+4},{text:x[1]})}),i.div();if(W.length>0){let x=W.map((y)=>y.replace(/\$0/g,f)).join(`
17
+ `);i.div(`${x}
18
+ `)}return i.toString().replace(/\s*$/,"")};function v(_,f,R){let h=0;if(!Array.isArray(_))_=Object.values(_).map((t)=>[t]);if(_.forEach((t)=>{h=Math.max(u.stringWidth(R?`${R} ${Au(t[0])}`:Au(t[0]))+x0(t[0]),h)}),f)h=Math.min(h,parseInt((f*0.5).toString(),10));return h}function ZD(){let _=D.getDemandedOptions(),f=D.getOptions();(Object.keys(f.alias)||[]).forEach((R)=>{f.alias[R].forEach((h)=>{if(H[h])C.describe(R,H[h]);if(h in _)D.demandOption(R,_[h]);if(f.boolean.includes(h))D.boolean(R);if(f.count.includes(h))D.count(R);if(f.string.includes(h))D.string(R);if(f.normalize.includes(h))D.normalize(R);if(f.array.includes(h))D.array(R);if(f.number.includes(h))D.number(R)})})}let m;C.cacheHelpMessage=function(){m=this.help()},C.clearCachedHelpMessage=function(){m=void 0},C.hasCachedHelpMessage=function(){return!!m};function g(_,f,R,h){let t=[],DD=null;return Object.keys(R).forEach((p)=>{t=t.concat(R[p])}),_.forEach((p)=>{if(DD=[p].concat(f[p]),!DD.some((FD)=>t.indexOf(FD)!==-1))R[h].push(p)}),t}function uD(_){return D.getOptions().hiddenOptions.indexOf(_)<0||D.parsed.argv[D.getOptions().showHiddenOpt]}C.showHelp=(_)=>{let f=D.getInternalMethods().getLoggerInstance();if(!_)_="error";(typeof _==="function"?_:f[_])(C.help())},C.functionDescription=(_)=>{return["(",_.name?u.Parser.decamelize(_.name,"-"):F("generated-value"),")"].join("")},C.stringifiedValues=function(f,R){let h="",t=R||", ",DD=[].concat(f);if(!f||!DD.length)return h;return DD.forEach((p)=>{if(h.length)h+=t;h+=JSON.stringify(p)}),h};function s(_,f){let R=`[${F("default:")} `;if(_===void 0&&!f)return null;if(f)R+=f;else switch(typeof _){case"string":R+=`"${_}"`;break;case"object":R+=JSON.stringify(_);break;default:R+=_}return`${R}]`}function KD(){if(u.process.stdColumns)return Math.min(80,u.process.stdColumns);else return 80}let k=null;C.version=(_)=>{k=_},C.showVersion=(_)=>{let f=D.getInternalMethods().getLoggerInstance();if(!_)_="error";(typeof _==="function"?_:f[_])(k)},C.reset=function(f){return B=null,M=!1,O=[],V=!1,W=[],Y=[],q=[],H=bD(H,(R)=>!f[R]),C};let Mu=[];return C.freeze=function(){Mu.push({failMessage:B,failureOutput:M,usages:O,usageDisabled:V,epilogs:W,examples:Y,commands:q,descriptions:H})},C.unfreeze=function(f=!1){let R=Mu.pop();if(!R)return;if(f)H={...R.descriptions,...H},q=[...R.commands,...q],O=[...R.usages,...O],Y=[...R.examples,...Y],W=[...R.epilogs,...W];else({failMessage:B,failureOutput:M,usages:O,usageDisabled:V,epilogs:W,examples:Y,commands:q,descriptions:H}=R)},C}function MF(D){return typeof D==="object"}function S3(D,u){return MF(D)?{text:D.text,indentation:D.indentation+u}:{text:D,indentation:u}}function x0(D){return MF(D)?D.indentation:0}function Au(D){return MF(D)?D.text:D}var h0=`###-begin-{{app_name}}-completions-###
19
19
  #
20
20
  # yargs command completion script
21
21
  #
@@ -44,7 +44,7 @@ _{{app_name}}_yargs_completions()
44
44
  }
45
45
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
46
46
  ###-end-{{app_name}}-completions-###
47
- `,S0=`#compdef {{app_name}}
47
+ `,w0=`#compdef {{app_name}}
48
48
  ###-begin-{{app_name}}-completions-###
49
49
  #
50
50
  # yargs command completion script
@@ -71,25 +71,42 @@ else
71
71
  compdef _{{app_name}}_yargs_completions {{app_name}}
72
72
  fi
73
73
  ###-end-{{app_name}}-completions-###
74
- `;class x0{constructor(D,u,F,C){var E,B,z;this.yargs=D,this.usage=u,this.command=F,this.shim=C,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(z=((E=this.shim.getEnv("SHELL"))===null||E===void 0?void 0:E.includes("zsh"))||((B=this.shim.getEnv("ZSH_NAME"))===null||B===void 0?void 0:B.includes("zsh")))!==null&&z!==void 0?z:!1}defaultCompletion(D,u,F,C){let E=this.command.getCommandHandlers();for(let z=0,X=D.length;z<X;++z)if(E[D[z]]&&E[D[z]].builder){let J=E[D[z]].builder;if(_u(J)){this.indexAfterLastReset=z+1;let f=this.yargs.getInternalMethods().reset();return J(f,!0),f.argv}}let B=[];this.commandCompletions(B,D,F),this.optionCompletions(B,D,u,F),this.choicesFromOptionsCompletions(B,D,u,F),this.choicesFromPositionalsCompletions(B,D,u,F),C(null,B)}commandCompletions(D,u,F){let C=this.yargs.getInternalMethods().getContext().commands;if(!F.match(/^-/)&&C[C.length-1]!==F&&!this.previousArgHasChoices(u))this.usage.getCommands().forEach((E)=>{let B=xD(E[0]).cmd;if(u.indexOf(B)===-1)if(!this.zshShell)D.push(B);else{let z=E[1]||"";D.push(B.replace(/:/g,"\\:")+":"+z)}})}optionCompletions(D,u,F,C){if((C.match(/^-/)||C===""&&D.length===0)&&!this.previousArgHasChoices(u)){let E=this.yargs.getOptions(),B=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(E.key).forEach((z)=>{let X=!!E.configuration["boolean-negation"]&&E.boolean.includes(z);if(!B.includes(z)&&!E.hiddenOptions.includes(z)&&!this.argsContainKey(u,z,X))this.completeOptionKey(z,D,C,X&&!!E.default[z])})}}choicesFromOptionsCompletions(D,u,F,C){if(this.previousArgHasChoices(u)){let E=this.getPreviousArgChoices(u);if(E&&E.length>0)D.push(...E.map((B)=>B.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(D,u,F,C){if(C===""&&D.length>0&&this.previousArgHasChoices(u))return;let E=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],B=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),z=E[F._.length-B-1];if(!z)return;let X=this.yargs.getOptions().choices[z]||[];for(let J of X)if(J.startsWith(C))D.push(J.replace(/:/g,"\\:"))}getPreviousArgChoices(D){if(D.length<1)return;let u=D[D.length-1],F="";if(!u.startsWith("-")&&D.length>1)F=u,u=D[D.length-2];if(!u.startsWith("-"))return;let C=u.replace(/^-+/,""),E=this.yargs.getOptions(),B=[C,...this.yargs.getAliases()[C]||[]],z;for(let X of B)if(Object.prototype.hasOwnProperty.call(E.key,X)&&Array.isArray(E.choices[X])){z=E.choices[X];break}if(z)return z.filter((X)=>!F||X.startsWith(F))}previousArgHasChoices(D){let u=this.getPreviousArgChoices(D);return u!==void 0&&u.length>0}argsContainKey(D,u,F){let C=(E)=>D.indexOf((/^[^0-9]$/.test(E)?"-":"--")+E)!==-1;if(C(u))return!0;if(F&&C(`no-${u}`))return!0;if(this.aliases){for(let E of this.aliases[u])if(C(E))return!0}return!1}completeOptionKey(D,u,F,C){var E,B,z,X;let J=D;if(this.zshShell){let Y=this.usage.getDescriptions(),q=(B=(E=this===null||this===void 0?void 0:this.aliases)===null||E===void 0?void 0:E[D])===null||B===void 0?void 0:B.find((S)=>{let p=Y[S];return typeof p==="string"&&p.length>0}),H=q?Y[q]:void 0,M=(X=(z=Y[D])!==null&&z!==void 0?z:H)!==null&&X!==void 0?X:"";J=`${D.replace(/:/g,"\\:")}:${M.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let f=(Y)=>/^--/.test(Y),W=(Y)=>/^[^0-9]$/.test(Y),O=!f(F)&&W(D)?"-":"--";if(u.push(O+J),C)u.push(O+"no-"+J)}customCompletion(D,u,F,C){if(GD(this.customCompletionFunction,null,this.shim),J3(this.customCompletionFunction)){let E=this.customCompletionFunction(F,u);if(o(E))return E.then((B)=>{this.shim.process.nextTick(()=>{C(null,B)})}).catch((B)=>{this.shim.process.nextTick(()=>{C(B,void 0)})});return C(null,E)}else if(M3(this.customCompletionFunction))return this.customCompletionFunction(F,u,(E=C)=>this.defaultCompletion(D,u,F,E),(E)=>{C(null,E)});else return this.customCompletionFunction(F,u,(E)=>{C(null,E)})}getCompletion(D,u){let F=D.length?D[D.length-1]:"",C=this.yargs.parse(D,!0),E=this.customCompletionFunction?(B)=>this.customCompletion(D,B,F,u):(B)=>this.defaultCompletion(D,B,F,u);return o(C)?C.then(E):E(C)}generateCompletionScript(D,u){let F=this.zshShell?S0:A0,C=this.shim.path.basename(D);if(D.match(/\.js$/))D=`./${D}`;return F=F.replace(/{{app_name}}/g,C),F=F.replace(/{{completion_command}}/g,u),F.replace(/{{app_path}}/g,D)}registerFunction(D){this.customCompletionFunction=D}setParsed(D){this.aliases=D.aliases}}function P0(D,u,F,C){return new x0(D,u,F,C)}function J3(D){return D.length<3}function M3(D){return D.length>3}function b0(D,u){if(D.length===0)return u.length;if(u.length===0)return D.length;let F=[],C;for(C=0;C<=u.length;C++)F[C]=[C];let E;for(E=0;E<=D.length;E++)F[0][E]=E;for(C=1;C<=u.length;C++)for(E=1;E<=D.length;E++)if(u.charAt(C-1)===D.charAt(E-1))F[C][E]=F[C-1][E-1];else if(C>1&&E>1&&u.charAt(C-2)===D.charAt(E-1)&&u.charAt(C-1)===D.charAt(E-2))F[C][E]=F[C-2][E-2]+1;else F[C][E]=Math.min(F[C-1][E-1]+1,Math.min(F[C][E-1]+1,F[C-1][E]+1));return F[u.length][D.length]}var h0=["$0","--","_"];function w0(D,u,F){let C=F.y18n.__,E=F.y18n.__n,B={};B.nonOptionCount=function(O){let Y=D.getDemandedCommands(),H=O._.length+(O["--"]?O["--"].length:0)-D.getInternalMethods().getContext().commands.length;if(Y._&&(H<Y._.min||H>Y._.max)){if(H<Y._.min)if(Y._.minMsg!==void 0)u.fail(Y._.minMsg?Y._.minMsg.replace(/\$0/g,H.toString()).replace(/\$1/,Y._.min.toString()):null);else u.fail(E("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",H,H.toString(),Y._.min.toString()));else if(H>Y._.max)if(Y._.maxMsg!==void 0)u.fail(Y._.maxMsg?Y._.maxMsg.replace(/\$0/g,H.toString()).replace(/\$1/,Y._.max.toString()):null);else u.fail(E("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",H,H.toString(),Y._.max.toString()))}},B.positionalCount=function(O,Y){if(Y<O)u.fail(E("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",Y,Y+"",O+""))},B.requiredArguments=function(O,Y){let q=null;for(let H of Object.keys(Y))if(!Object.prototype.hasOwnProperty.call(O,H)||typeof O[H]>"u")q=q||{},q[H]=Y[H];if(q){let H=[];for(let S of Object.keys(q)){let p=q[S];if(p&&H.indexOf(p)<0)H.push(p)}let M=H.length?`
75
- ${H.join(`
76
- `)}`:"";u.fail(E("Missing required argument: %s","Missing required arguments: %s",Object.keys(q).length,Object.keys(q).join(", ")+M))}},B.unknownArguments=function(O,Y,q,H,M=!0){var S;let p=D.getInternalMethods().getCommandInstance().getCommands(),m=[],BD=D.getInternalMethods().getContext();if(Object.keys(O).forEach((c)=>{if(!h0.includes(c)&&!Object.prototype.hasOwnProperty.call(q,c)&&!Object.prototype.hasOwnProperty.call(D.getInternalMethods().getParseContext(),c)&&!B.isValidAndSomeAliasIsNotNew(c,Y))m.push(c)}),M&&(BD.commands.length>0||p.length>0||H))O._.slice(BD.commands.length).forEach((c)=>{if(!p.includes(""+c))m.push(""+c)});if(M){let i=((S=D.getDemandedCommands()._)===null||S===void 0?void 0:S.max)||0,uD=BD.commands.length+i;if(uD<O._.length)O._.slice(uD).forEach((s)=>{if(s=String(s),!BD.commands.includes(s)&&!m.includes(s))m.push(s)})}if(m.length)u.fail(E("Unknown argument: %s","Unknown arguments: %s",m.length,m.map((c)=>c.trim()?c:`"${c}"`).join(", ")))},B.unknownCommands=function(O){let Y=D.getInternalMethods().getCommandInstance().getCommands(),q=[],H=D.getInternalMethods().getContext();if(H.commands.length>0||Y.length>0)O._.slice(H.commands.length).forEach((M)=>{if(!Y.includes(""+M))q.push(""+M)});if(q.length>0)return u.fail(E("Unknown command: %s","Unknown commands: %s",q.length,q.join(", "))),!0;else return!1},B.isValidAndSomeAliasIsNotNew=function(O,Y){if(!Object.prototype.hasOwnProperty.call(Y,O))return!1;let q=D.parsed.newAliases;return[O,...Y[O]].some((H)=>!Object.prototype.hasOwnProperty.call(q,H)||!q[O])},B.limitedChoices=function(O){let Y=D.getOptions(),q={};if(!Object.keys(Y.choices).length)return;Object.keys(O).forEach((S)=>{if(h0.indexOf(S)===-1&&Object.prototype.hasOwnProperty.call(Y.choices,S))[].concat(O[S]).forEach((p)=>{if(Y.choices[S].indexOf(p)===-1&&p!==void 0)q[S]=(q[S]||[]).concat(p)})});let H=Object.keys(q);if(!H.length)return;let M=C("Invalid values:");H.forEach((S)=>{M+=`
77
- ${C("Argument: %s, Given: %s, Choices: %s",S,u.stringifiedValues(q[S]),u.stringifiedValues(Y.choices[S]))}`}),u.fail(M)};let z={};B.implies=function(O,Y){if(L("<string|object> [array|number|string]",[O,Y],arguments.length),typeof O==="object")Object.keys(O).forEach((q)=>{B.implies(q,O[q])});else{if(D.global(O),!z[O])z[O]=[];if(Array.isArray(Y))Y.forEach((q)=>B.implies(O,q));else GD(Y,void 0,F),z[O].push(Y)}},B.getImplied=function(){return z};function X(W,O){let Y=Number(O);if(O=isNaN(Y)?O:Y,typeof O==="number")O=W._.length>=O;else if(O.match(/^--no-.+/))O=O.match(/^--no-(.+)/)[1],O=!Object.prototype.hasOwnProperty.call(W,O);else O=Object.prototype.hasOwnProperty.call(W,O);return O}B.implications=function(O){let Y=[];if(Object.keys(z).forEach((q)=>{let H=q;(z[q]||[]).forEach((M)=>{let S=H,p=M;if(S=X(O,S),M=X(O,M),S&&!M)Y.push(` ${H} -> ${p}`)})}),Y.length){let q=`${C("Implications failed:")}
78
- `;Y.forEach((H)=>{q+=H}),u.fail(q)}};let J={};B.conflicts=function(O,Y){if(L("<string|object> [array|string]",[O,Y],arguments.length),typeof O==="object")Object.keys(O).forEach((q)=>{B.conflicts(q,O[q])});else{if(D.global(O),!J[O])J[O]=[];if(Array.isArray(Y))Y.forEach((q)=>B.conflicts(O,q));else J[O].push(Y)}},B.getConflicting=()=>J,B.conflicting=function(O){if(Object.keys(O).forEach((Y)=>{if(J[Y])J[Y].forEach((q)=>{if(q&&O[Y]!==void 0&&O[q]!==void 0)u.fail(C("Arguments %s and %s are mutually exclusive",Y,q))})}),D.getInternalMethods().getParserConfiguration()["strip-dashed"])Object.keys(J).forEach((Y)=>{J[Y].forEach((q)=>{if(q&&O[F.Parser.camelCase(Y)]!==void 0&&O[F.Parser.camelCase(q)]!==void 0)u.fail(C("Arguments %s and %s are mutually exclusive",Y,q))})})},B.recommendCommands=function(O,Y){Y=Y.sort((S,p)=>p.length-S.length);let H=null,M=1/0;for(let S=0,p;(p=Y[S])!==void 0;S++){let m=b0(O,p);if(m<=3&&m<M)M=m,H=p}if(H)u.fail(C("Did you mean %s?",H))},B.reset=function(O){return z=PD(z,(Y)=>!O[Y]),J=PD(J,(Y)=>!O[Y]),B};let f=[];return B.freeze=function(){f.push({implied:z,conflicting:J})},B.unfreeze=function(){let O=f.pop();GD(O,void 0,F),{implied:z,conflicting:J}=O},B}var CF=[],Qu;function ju(D,u,F,C){Qu=C;let E={};if(Object.prototype.hasOwnProperty.call(D,"extends")){if(typeof D.extends!=="string")return E;let B=/\.json|\..*rc$/.test(D.extends),z=null;if(!B)try{z=import.meta.resolve(D.extends)}catch(X){return D}else z=Y3(u,D.extends);O3(z),CF.push(z),E=B?JSON.parse(Qu.readFileSync(z,"utf8")):C.require(D.extends),delete D.extends,E=ju(E,Qu.path.dirname(z),F,Qu)}return CF=[],F?m0(E,D):Object.assign({},E,D)}function O3(D){if(CF.indexOf(D)>-1)throw new a(`Circular extended configurations: '${D}'.`)}function Y3(D,u){return Qu.path.resolve(D,u)}function m0(D,u){let F={};function C(E){return E&&typeof E==="object"&&!Array.isArray(E)}Object.assign(F,D);for(let E of Object.keys(u))if(C(u[E])&&C(F[E]))F[E]=m0(D[E],u[E]);else F[E]=u[E];return F}var _=function(D,u,F,C,E){if(C==="m")throw TypeError("Private method is not writable");if(C==="a"&&!E)throw TypeError("Private accessor was defined without a setter");if(typeof u==="function"?D!==u||!E:!u.has(D))throw TypeError("Cannot write private member to an object whose class did not declare it");return C==="a"?E.call(D,F):E?E.value=F:u.set(D,F),F},$=function(D,u,F,C){if(F==="a"&&!C)throw TypeError("Private accessor was defined without a getter");if(typeof u==="function"?D!==u||!C:!u.has(D))throw TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?C:F==="a"?C.call(D):C?C.value:u.get(D)},e,kD,Ju,QD,OD,Nu,hD,yD,Ru,qD,Au,HD,_D,YD,WD,Su,nD,zD,R,xu,Pu,fD,iD,Bu,oD,wD,bu,b,gD,lD,sD,w,hu,KD,l;function C2(D){return(u=[],F=D.process.cwd(),C)=>{let E=new E2(u,F,C,D);return Object.defineProperty(E,"argv",{get:()=>{return E.parse()},enumerable:!0}),E.help(),E.version(),E}}var c0=Symbol("copyDoubleDash"),v0=Symbol("copyDoubleDash"),EF=Symbol("deleteFromParserHintObject"),p0=Symbol("emitWarning"),t0=Symbol("freeze"),d0=Symbol("getDollarZero"),rD=Symbol("getParserConfiguration"),k0=Symbol("getUsageConfiguration"),BF=Symbol("guessLocale"),y0=Symbol("guessVersion"),n0=Symbol("parsePositionalNumbers"),$F=Symbol("pkgUp"),mD=Symbol("populateParserHintArray"),$u=Symbol("populateParserHintSingleValueDictionary"),zF=Symbol("populateParserHintArrayDictionary"),ZF=Symbol("populateParserHintDictionary"),XF=Symbol("sanitizeKey"),GF=Symbol("setKey"),QF=Symbol("unfreeze"),i0=Symbol("validateAsync"),o0=Symbol("getCommandInstance"),g0=Symbol("getContext"),l0=Symbol("getHasOutput"),s0=Symbol("getLoggerInstance"),r0=Symbol("getParseContext"),a0=Symbol("getUsageInstance"),e0=Symbol("getValidationInstance"),wu=Symbol("hasParseCallback"),D2=Symbol("isGlobalContext"),aD=Symbol("postProcess"),u2=Symbol("rebase"),JF=Symbol("reset"),Mu=Symbol("runYargsParserAndExecuteCommands"),MF=Symbol("runValidation"),F2=Symbol("setHasOutput"),eD=Symbol("kTrackManuallySetKeys"),f3="en_US";class E2{constructor(D=[],u,F,C){this.customScriptName=!1,this.parsed=!1,e.set(this,void 0),kD.set(this,void 0),Ju.set(this,{commands:[],fullCommands:[]}),QD.set(this,null),OD.set(this,null),Nu.set(this,"show-hidden"),hD.set(this,null),yD.set(this,!0),Ru.set(this,{}),qD.set(this,!0),Au.set(this,[]),HD.set(this,void 0),_D.set(this,{}),YD.set(this,!1),WD.set(this,null),Su.set(this,!0),nD.set(this,void 0),zD.set(this,""),R.set(this,void 0),xu.set(this,void 0),Pu.set(this,{}),fD.set(this,null),iD.set(this,null),Bu.set(this,{}),oD.set(this,{}),wD.set(this,void 0),bu.set(this,!1),b.set(this,void 0),gD.set(this,!1),lD.set(this,!1),sD.set(this,!1),w.set(this,void 0),hu.set(this,{}),KD.set(this,null),l.set(this,void 0),_(this,b,C,"f"),_(this,wD,D,"f"),_(this,kD,u,"f"),_(this,xu,F,"f"),_(this,HD,new uF(this),"f"),this.$0=this[d0](),this[JF](),_(this,e,$(this,e,"f"),"f"),_(this,w,$(this,w,"f"),"f"),_(this,l,$(this,l,"f"),"f"),_(this,R,$(this,R,"f"),"f"),$(this,R,"f").showHiddenOpt=$(this,Nu,"f"),_(this,nD,this[v0](),"f"),$(this,b,"f").y18n.setLocale(f3)}addHelpOpt(D,u){if(L("[string|boolean] [string]",[D,u],arguments.length),$(this,WD,"f"))this[EF]($(this,WD,"f")),_(this,WD,null,"f");if(D===!1&&u===void 0)return this;return _(this,WD,typeof D==="string"?D:"help","f"),this.boolean($(this,WD,"f")),this.describe($(this,WD,"f"),u||$(this,w,"f").deferY18nLookup("Show help")),this}help(D,u){return this.addHelpOpt(D,u)}addShowHiddenOpt(D,u){if(L("[string|boolean] [string]",[D,u],arguments.length),D===!1&&u===void 0)return this;let F=typeof D==="string"?D:$(this,Nu,"f");return this.boolean(F),this.describe(F,u||$(this,w,"f").deferY18nLookup("Show hidden options")),$(this,R,"f").showHiddenOpt=F,this}showHidden(D,u){return this.addShowHiddenOpt(D,u)}alias(D,u){return L("<object|string|array> [string|array]",[D,u],arguments.length),this[zF](this.alias.bind(this),"alias",D,u),this}array(D){return L("<array|string>",[D],arguments.length),this[mD]("array",D),this[eD](D),this}boolean(D){return L("<array|string>",[D],arguments.length),this[mD]("boolean",D),this[eD](D),this}check(D,u){return L("<function> [boolean]",[D,u],arguments.length),this.middleware((F,C)=>{return dD(()=>{return D(F,C.getOptions())},(E)=>{if(!E)$(this,w,"f").fail($(this,b,"f").y18n.__("Argument check failed: %s",D.toString()));else if(typeof E==="string"||E instanceof Error)$(this,w,"f").fail(E.toString(),E);return F},(E)=>{return $(this,w,"f").fail(E.message?E.message:E.toString(),E),F})},!1,u),this}choices(D,u){return L("<object|string|array> [string|array]",[D,u],arguments.length),this[zF](this.choices.bind(this),"choices",D,u),this}coerce(D,u){if(L("<object|string|array> [function]",[D,u],arguments.length),Array.isArray(D)){if(!u)throw new a("coerce callback must be provided");for(let C of D)this.coerce(C,u);return this}else if(typeof D==="object"){for(let C of Object.keys(D))this.coerce(C,D[C]);return this}if(!u)throw new a("coerce callback must be provided");let F=D;return $(this,R,"f").key[F]=!0,$(this,HD,"f").addCoerceMiddleware((C,E)=>{var B;let z=(B=E.getAliases()[F])!==null&&B!==void 0?B:[],X=[F,...z].filter((J)=>Object.prototype.hasOwnProperty.call(C,J));if(X.length===0)return C;return dD(()=>{return u(C[X[0]])},(J)=>{return X.forEach((f)=>{C[f]=J}),C},(J)=>{throw new a(J.message)})},F),this}conflicts(D,u){return L("<string|object> [string|array]",[D,u],arguments.length),$(this,l,"f").conflicts(D,u),this}config(D="config",u,F){if(L("[object|string] [string|function] [function]",[D,u,F],arguments.length),typeof D==="object"&&!Array.isArray(D))return D=ju(D,$(this,kD,"f"),this[rD]()["deep-merge-config"]||!1,$(this,b,"f")),$(this,R,"f").configObjects=($(this,R,"f").configObjects||[]).concat(D),this;if(typeof u==="function")F=u,u=void 0;return this.describe(D,u||$(this,w,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(D)?D:[D]).forEach((C)=>{$(this,R,"f").config[C]=F||!0}),this}completion(D,u,F){if(L("[string] [string|boolean|function] [function]",[D,u,F],arguments.length),typeof u==="function")F=u,u=void 0;if(_(this,OD,D||$(this,OD,"f")||"completion","f"),!u&&u!==!1)u="generate completion script";if(this.command($(this,OD,"f"),u),F)$(this,QD,"f").registerFunction(F);return this}command(D,u,F,C,E,B){return L("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[D,u,F,C,E,B],arguments.length),$(this,e,"f").addHandler(D,u,F,C,E,B),this}commands(D,u,F,C,E,B){return this.command(D,u,F,C,E,B)}commandDir(D,u){L("<string> [object]",[D,u],arguments.length);let F=$(this,xu,"f")||$(this,b,"f").require;return $(this,e,"f").addDirectory(D,F,$(this,b,"f").getCallerFile(),u),this}count(D){return L("<array|string>",[D],arguments.length),this[mD]("count",D),this[eD](D),this}default(D,u,F){if(L("<object|string|array> [*] [string]",[D,u,F],arguments.length),F)DF(D,$(this,b,"f")),$(this,R,"f").defaultDescription[D]=F;if(typeof u==="function"){if(DF(D,$(this,b,"f")),!$(this,R,"f").defaultDescription[D])$(this,R,"f").defaultDescription[D]=$(this,w,"f").functionDescription(u);u=u.call()}return this[$u](this.default.bind(this),"default",D,u),this}defaults(D,u,F){return this.default(D,u,F)}demandCommand(D=1,u,F,C){if(L("[number] [number|string] [string|null|undefined] [string|null|undefined]",[D,u,F,C],arguments.length),typeof u!=="number")F=u,u=1/0;return this.global("_",!1),$(this,R,"f").demandedCommands._={min:D,max:u,minMsg:F,maxMsg:C},this}demand(D,u,F){if(Array.isArray(u))u.forEach((C)=>{GD(F,!0,$(this,b,"f")),this.demandOption(C,F)}),u=1/0;else if(typeof u!=="number")F=u,u=1/0;if(typeof D==="number")GD(F,!0,$(this,b,"f")),this.demandCommand(D,u,F,F);else if(Array.isArray(D))D.forEach((C)=>{GD(F,!0,$(this,b,"f")),this.demandOption(C,F)});else if(typeof F==="string")this.demandOption(D,F);else if(F===!0||typeof F>"u")this.demandOption(D);return this}demandOption(D,u){return L("<object|string|array> [string]",[D,u],arguments.length),this[$u](this.demandOption.bind(this),"demandedOptions",D,u),this}deprecateOption(D,u){return L("<string> [string|boolean]",[D,u],arguments.length),$(this,R,"f").deprecatedOptions[D]=u,this}describe(D,u){return L("<object|string|array> [string]",[D,u],arguments.length),this[GF](D,!0),$(this,w,"f").describe(D,u),this}detectLocale(D){return L("<boolean>",[D],arguments.length),_(this,yD,D,"f"),this}env(D){if(L("[string|boolean]",[D],arguments.length),D===!1)delete $(this,R,"f").envPrefix;else $(this,R,"f").envPrefix=D||"";return this}epilogue(D){return L("<string>",[D],arguments.length),$(this,w,"f").epilog(D),this}epilog(D){return this.epilogue(D)}example(D,u){if(L("<string|array> [string]",[D,u],arguments.length),Array.isArray(D))D.forEach((F)=>this.example(...F));else $(this,w,"f").example(D,u);return this}exit(D,u){if(_(this,YD,!0,"f"),_(this,hD,u,"f"),$(this,qD,"f"))$(this,b,"f").process.exit(D)}exitProcess(D=!0){return L("[boolean]",[D],arguments.length),_(this,qD,D,"f"),this}fail(D){if(L("<function|boolean>",[D],arguments.length),typeof D==="boolean"&&D!==!1)throw new a("Invalid first argument. Expected function or boolean 'false'");return $(this,w,"f").failFn(D),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(D,u){if(L("<array> [function]",[D,u],arguments.length),!u)return new Promise((F,C)=>{$(this,QD,"f").getCompletion(D,(E,B)=>{if(E)C(E);else F(B)})});else return $(this,QD,"f").getCompletion(D,u)}getDemandedOptions(){return L([],0),$(this,R,"f").demandedOptions}getDemandedCommands(){return L([],0),$(this,R,"f").demandedCommands}getDeprecatedOptions(){return L([],0),$(this,R,"f").deprecatedOptions}getDetectLocale(){return $(this,yD,"f")}getExitProcess(){return $(this,qD,"f")}getGroups(){return Object.assign({},$(this,_D,"f"),$(this,oD,"f"))}getHelp(){if(_(this,YD,!0,"f"),!$(this,w,"f").hasCachedHelpMessage()){if(!this.parsed){let u=this[Mu]($(this,wD,"f"),void 0,void 0,0,!0);if(o(u))return u.then(()=>{return $(this,w,"f").help()})}let D=$(this,e,"f").runDefaultBuilderOn(this);if(o(D))return D.then(()=>{return $(this,w,"f").help()})}return Promise.resolve($(this,w,"f").help())}getOptions(){return $(this,R,"f")}getStrict(){return $(this,gD,"f")}getStrictCommands(){return $(this,lD,"f")}getStrictOptions(){return $(this,sD,"f")}global(D,u){if(L("<string|array> [boolean]",[D,u],arguments.length),D=[].concat(D),u!==!1)$(this,R,"f").local=$(this,R,"f").local.filter((F)=>D.indexOf(F)===-1);else D.forEach((F)=>{if(!$(this,R,"f").local.includes(F))$(this,R,"f").local.push(F)});return this}group(D,u){L("<string|array> <string>",[D,u],arguments.length);let F=$(this,oD,"f")[u]||$(this,_D,"f")[u];if($(this,oD,"f")[u])delete $(this,oD,"f")[u];let C={};return $(this,_D,"f")[u]=(F||[]).concat(D).filter((E)=>{if(C[E])return!1;return C[E]=!0}),this}hide(D){return L("<string>",[D],arguments.length),$(this,R,"f").hiddenOptions.push(D),this}implies(D,u){return L("<string|object> [number|string|array]",[D,u],arguments.length),$(this,l,"f").implies(D,u),this}locale(D){if(L("[string]",[D],arguments.length),D===void 0)return this[BF](),$(this,b,"f").y18n.getLocale();return _(this,yD,!1,"f"),$(this,b,"f").y18n.setLocale(D),this}middleware(D,u,F){return $(this,HD,"f").addMiddleware(D,!!u,F)}nargs(D,u){return L("<string|object|array> [number]",[D,u],arguments.length),this[$u](this.nargs.bind(this),"narg",D,u),this}normalize(D){return L("<array|string>",[D],arguments.length),this[mD]("normalize",D),this}number(D){return L("<array|string>",[D],arguments.length),this[mD]("number",D),this[eD](D),this}option(D,u){if(L("<string|object> [object]",[D,u],arguments.length),typeof D==="object")Object.keys(D).forEach((F)=>{this.options(F,D[F])});else{if(typeof u!=="object")u={};if(this[eD](D),$(this,KD,"f")&&(D==="version"||(u===null||u===void 0?void 0:u.alias)==="version"))this[p0](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
79
- `),void 0,"versionWarning");if($(this,R,"f").key[D]=!0,u.alias)this.alias(D,u.alias);let F=u.deprecate||u.deprecated;if(F)this.deprecateOption(D,F);let C=u.demand||u.required||u.require;if(C)this.demand(D,C);if(u.demandOption)this.demandOption(D,typeof u.demandOption==="string"?u.demandOption:void 0);if(u.conflicts)this.conflicts(D,u.conflicts);if("default"in u)this.default(D,u.default);if(u.implies!==void 0)this.implies(D,u.implies);if(u.nargs!==void 0)this.nargs(D,u.nargs);if(u.config)this.config(D,u.configParser);if(u.normalize)this.normalize(D);if(u.choices)this.choices(D,u.choices);if(u.coerce)this.coerce(D,u.coerce);if(u.group)this.group(D,u.group);if(u.boolean||u.type==="boolean"){if(this.boolean(D),u.alias)this.boolean(u.alias)}if(u.array||u.type==="array"){if(this.array(D),u.alias)this.array(u.alias)}if(u.number||u.type==="number"){if(this.number(D),u.alias)this.number(u.alias)}if(u.string||u.type==="string"){if(this.string(D),u.alias)this.string(u.alias)}if(u.count||u.type==="count")this.count(D);if(typeof u.global==="boolean")this.global(D,u.global);if(u.defaultDescription)$(this,R,"f").defaultDescription[D]=u.defaultDescription;if(u.skipValidation)this.skipValidation(D);let E=u.describe||u.description||u.desc,B=$(this,w,"f").getDescriptions();if(!Object.prototype.hasOwnProperty.call(B,D)||typeof E==="string")this.describe(D,E);if(u.hidden)this.hide(D);if(u.requiresArg)this.requiresArg(D)}return this}options(D,u){return this.option(D,u)}parse(D,u,F){if(L("[string|array] [function|boolean|object] [function]",[D,u,F],arguments.length),this[t0](),typeof D>"u")D=$(this,wD,"f");if(typeof u==="object")_(this,iD,u,"f"),u=F;if(typeof u==="function")_(this,fD,u,"f"),u=!1;if(!u)_(this,wD,D,"f");if($(this,fD,"f"))_(this,qD,!1,"f");let C=this[Mu](D,!!u),E=this.parsed;if($(this,QD,"f").setParsed(this.parsed),o(C))return C.then((B)=>{if($(this,fD,"f"))$(this,fD,"f").call(this,$(this,hD,"f"),B,$(this,zD,"f"));return B}).catch((B)=>{if($(this,fD,"f"))$(this,fD,"f")(B,this.parsed.argv,$(this,zD,"f"));throw B}).finally(()=>{this[QF](),this.parsed=E});else{if($(this,fD,"f"))$(this,fD,"f").call(this,$(this,hD,"f"),C,$(this,zD,"f"));this[QF](),this.parsed=E}return C}parseAsync(D,u,F){let C=this.parse(D,u,F);return!o(C)?Promise.resolve(C):C}parseSync(D,u,F){let C=this.parse(D,u,F);if(o(C))throw new a(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return C}parserConfiguration(D){return L("<object>",[D],arguments.length),_(this,Pu,D,"f"),this}pkgConf(D,u){L("<string> [string]",[D,u],arguments.length);let F=null,C=this[$F](u||$(this,kD,"f"));if(C[D]&&typeof C[D]==="object")F=ju(C[D],u||$(this,kD,"f"),this[rD]()["deep-merge-config"]||!1,$(this,b,"f")),$(this,R,"f").configObjects=($(this,R,"f").configObjects||[]).concat(F);return this}positional(D,u){L("<string> <object>",[D,u],arguments.length);let F=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];u=PD(u,(B,z)=>{if(B==="type"&&!["string","number","boolean"].includes(z))return!1;return F.includes(B)});let C=$(this,Ju,"f").fullCommands[$(this,Ju,"f").fullCommands.length-1],E=C?$(this,e,"f").cmdToParseOptions(C):{array:[],alias:{},default:{},demand:{}};return Cu(E).forEach((B)=>{let z=E[B];if(Array.isArray(z)){if(z.indexOf(D)!==-1)u[B]=!0}else if(z[D]&&!(B in u))u[B]=z[D]}),this.group(D,$(this,w,"f").getPositionalGroupName()),this.option(D,u)}recommendCommands(D=!0){return L("[boolean]",[D],arguments.length),_(this,bu,D,"f"),this}required(D,u,F){return this.demand(D,u,F)}require(D,u,F){return this.demand(D,u,F)}requiresArg(D){if(L("<array|string|object> [number]",[D],arguments.length),typeof D==="string"&&$(this,R,"f").narg[D])return this;else this[$u](this.requiresArg.bind(this),"narg",D,NaN);return this}showCompletionScript(D,u){return L("[string] [string]",[D,u],arguments.length),D=D||this.$0,$(this,nD,"f").log($(this,QD,"f").generateCompletionScript(D,u||$(this,OD,"f")||"completion")),this}showHelp(D){if(L("[string|function]",[D],arguments.length),_(this,YD,!0,"f"),!$(this,w,"f").hasCachedHelpMessage()){if(!this.parsed){let F=this[Mu]($(this,wD,"f"),void 0,void 0,0,!0);if(o(F))return F.then(()=>{$(this,w,"f").showHelp(D)}),this}let u=$(this,e,"f").runDefaultBuilderOn(this);if(o(u))return u.then(()=>{$(this,w,"f").showHelp(D)}),this}return $(this,w,"f").showHelp(D),this}scriptName(D){return this.customScriptName=!0,this.$0=D,this}showHelpOnFail(D,u){return L("[boolean|string] [string]",[D,u],arguments.length),$(this,w,"f").showHelpOnFail(D,u),this}showVersion(D){return L("[string|function]",[D],arguments.length),$(this,w,"f").showVersion(D),this}skipValidation(D){return L("<array|string>",[D],arguments.length),this[mD]("skipValidation",D),this}strict(D){return L("[boolean]",[D],arguments.length),_(this,gD,D!==!1,"f"),this}strictCommands(D){return L("[boolean]",[D],arguments.length),_(this,lD,D!==!1,"f"),this}strictOptions(D){return L("[boolean]",[D],arguments.length),_(this,sD,D!==!1,"f"),this}string(D){return L("<array|string>",[D],arguments.length),this[mD]("string",D),this[eD](D),this}terminalWidth(){return L([],0),$(this,b,"f").process.stdColumns}updateLocale(D){return this.updateStrings(D)}updateStrings(D){return L("<object>",[D],arguments.length),_(this,yD,!1,"f"),$(this,b,"f").y18n.updateLocale(D),this}usage(D,u,F,C){if(L("<string|null|undefined> [string|boolean] [function|object] [function]",[D,u,F,C],arguments.length),u!==void 0)if(GD(D,null,$(this,b,"f")),(D||"").match(/^\$0( |$)/))return this.command(D,u,F,C);else throw new a(".usage() description must start with $0 if being used as alias for .command()");else return $(this,w,"f").usage(D),this}usageConfiguration(D){return L("<object>",[D],arguments.length),_(this,hu,D,"f"),this}version(D,u,F){if(L("[boolean|string] [string] [string]",[D,u,F],arguments.length),$(this,KD,"f"))this[EF]($(this,KD,"f")),$(this,w,"f").version(void 0),_(this,KD,null,"f");if(arguments.length===0)F=this[y0](),D="version";else if(arguments.length===1){if(D===!1)return this;F=D,D="version"}else if(arguments.length===2)F=u,u=void 0;return _(this,KD,typeof D==="string"?D:"version","f"),u=u||$(this,w,"f").deferY18nLookup("Show version number"),$(this,w,"f").version(F||void 0),this.boolean($(this,KD,"f")),this.describe($(this,KD,"f"),u),this}wrap(D){return L("<number|null|undefined>",[D],arguments.length),$(this,w,"f").wrap(D),this}[(e=new WeakMap,kD=new WeakMap,Ju=new WeakMap,QD=new WeakMap,OD=new WeakMap,Nu=new WeakMap,hD=new WeakMap,yD=new WeakMap,Ru=new WeakMap,qD=new WeakMap,Au=new WeakMap,HD=new WeakMap,_D=new WeakMap,YD=new WeakMap,WD=new WeakMap,Su=new WeakMap,nD=new WeakMap,zD=new WeakMap,R=new WeakMap,xu=new WeakMap,Pu=new WeakMap,fD=new WeakMap,iD=new WeakMap,Bu=new WeakMap,oD=new WeakMap,wD=new WeakMap,bu=new WeakMap,b=new WeakMap,gD=new WeakMap,lD=new WeakMap,sD=new WeakMap,w=new WeakMap,hu=new WeakMap,KD=new WeakMap,l=new WeakMap,c0)](D){if(!D._||!D["--"])return D;D._.push.apply(D._,D["--"]);try{delete D["--"]}catch(u){}return D}[v0](){return{log:(...D)=>{if(!this[wu]())console.log(...D);if(_(this,YD,!0,"f"),$(this,zD,"f").length)_(this,zD,$(this,zD,"f")+`
80
- `,"f");_(this,zD,$(this,zD,"f")+D.join(" "),"f")},error:(...D)=>{if(!this[wu]())console.error(...D);if(_(this,YD,!0,"f"),$(this,zD,"f").length)_(this,zD,$(this,zD,"f")+`
81
- `,"f");_(this,zD,$(this,zD,"f")+D.join(" "),"f")}}}[EF](D){Cu($(this,R,"f")).forEach((u)=>{if(((C)=>C==="configObjects")(u))return;let F=$(this,R,"f")[u];if(Array.isArray(F)){if(F.includes(D))F.splice(F.indexOf(D),1)}else if(typeof F==="object")delete F[D]}),delete $(this,w,"f").getDescriptions()[D]}[p0](D,u,F){if(!$(this,Ru,"f")[F])$(this,b,"f").process.emitWarning(D,u),$(this,Ru,"f")[F]=!0}[t0](){$(this,Au,"f").push({options:$(this,R,"f"),configObjects:$(this,R,"f").configObjects.slice(0),exitProcess:$(this,qD,"f"),groups:$(this,_D,"f"),strict:$(this,gD,"f"),strictCommands:$(this,lD,"f"),strictOptions:$(this,sD,"f"),completionCommand:$(this,OD,"f"),output:$(this,zD,"f"),exitError:$(this,hD,"f"),hasOutput:$(this,YD,"f"),parsed:this.parsed,parseFn:$(this,fD,"f"),parseContext:$(this,iD,"f")}),$(this,w,"f").freeze(),$(this,l,"f").freeze(),$(this,e,"f").freeze(),$(this,HD,"f").freeze()}[d0](){let D="",u;if(/\b(node|iojs|electron)(\.exe)?$/.test($(this,b,"f").process.argv()[0]))u=$(this,b,"f").process.argv().slice(1,2);else u=$(this,b,"f").process.argv().slice(0,1);if(D=u.map((F)=>{let C=this[u2]($(this,kD,"f"),F);return F.match(/^(\/|([a-zA-Z]:)?\\)/)&&C.length<F.length?C:F}).join(" ").trim(),$(this,b,"f").getEnv("_")&&$(this,b,"f").getProcessArgvBin()===$(this,b,"f").getEnv("_"))D=$(this,b,"f").getEnv("_").replace(`${$(this,b,"f").path.dirname($(this,b,"f").process.execPath())}/`,"");return D}[rD](){return $(this,Pu,"f")}[k0](){return $(this,hu,"f")}[BF](){if(!$(this,yD,"f"))return;let D=$(this,b,"f").getEnv("LC_ALL")||$(this,b,"f").getEnv("LC_MESSAGES")||$(this,b,"f").getEnv("LANG")||$(this,b,"f").getEnv("LANGUAGE")||"en_US";this.locale(D.replace(/[.:].*/,""))}[y0](){return this[$F]().version||"unknown"}[n0](D){let u=D["--"]?D["--"]:D._;for(let F=0,C;(C=u[F])!==void 0;F++)if($(this,b,"f").Parser.looksLikeNumber(C)&&Number.isSafeInteger(Math.floor(parseFloat(`${C}`))))u[F]=Number(C);return D}[$F](D){let u=D||"*";if($(this,Bu,"f")[u])return $(this,Bu,"f")[u];let F={};try{let C=D||$(this,b,"f").mainFilename;if($(this,b,"f").path.extname(C))C=$(this,b,"f").path.dirname(C);let E=$(this,b,"f").findUp(C,(B,z)=>{if(z.includes("package.json"))return"package.json";else return});GD(E,void 0,$(this,b,"f")),F=JSON.parse($(this,b,"f").readFileSync(E,"utf8"))}catch(C){}return $(this,Bu,"f")[u]=F||{},$(this,Bu,"f")[u]}[mD](D,u){u=[].concat(u),u.forEach((F)=>{F=this[XF](F),$(this,R,"f")[D].push(F)})}[$u](D,u,F,C){this[ZF](D,u,F,C,(E,B,z)=>{$(this,R,"f")[E][B]=z})}[zF](D,u,F,C){this[ZF](D,u,F,C,(E,B,z)=>{$(this,R,"f")[E][B]=($(this,R,"f")[E][B]||[]).concat(z)})}[ZF](D,u,F,C,E){if(Array.isArray(F))F.forEach((B)=>{D(B,C)});else if(((B)=>typeof B==="object")(F))for(let B of Cu(F))D(B,F[B]);else E(u,this[XF](F),C)}[XF](D){if(D==="__proto__")return"___proto___";return D}[GF](D,u){return this[$u](this[GF].bind(this),"key",D,u),this}[QF](){var D,u,F,C,E,B,z,X,J,f,W,O;let Y=$(this,Au,"f").pop();GD(Y,void 0,$(this,b,"f"));let q;D=this,u=this,F=this,C=this,E=this,B=this,z=this,X=this,J=this,f=this,W=this,O=this,{options:{set value(H){_(D,R,H,"f")}}.value,configObjects:q,exitProcess:{set value(H){_(u,qD,H,"f")}}.value,groups:{set value(H){_(F,_D,H,"f")}}.value,output:{set value(H){_(C,zD,H,"f")}}.value,exitError:{set value(H){_(E,hD,H,"f")}}.value,hasOutput:{set value(H){_(B,YD,H,"f")}}.value,parsed:this.parsed,strict:{set value(H){_(z,gD,H,"f")}}.value,strictCommands:{set value(H){_(X,lD,H,"f")}}.value,strictOptions:{set value(H){_(J,sD,H,"f")}}.value,completionCommand:{set value(H){_(f,OD,H,"f")}}.value,parseFn:{set value(H){_(W,fD,H,"f")}}.value,parseContext:{set value(H){_(O,iD,H,"f")}}.value}=Y,$(this,R,"f").configObjects=q,$(this,w,"f").unfreeze(),$(this,l,"f").unfreeze(),$(this,e,"f").unfreeze(),$(this,HD,"f").unfreeze()}[i0](D,u){return dD(u,(F)=>{return D(F),F})}getInternalMethods(){return{getCommandInstance:this[o0].bind(this),getContext:this[g0].bind(this),getHasOutput:this[l0].bind(this),getLoggerInstance:this[s0].bind(this),getParseContext:this[r0].bind(this),getParserConfiguration:this[rD].bind(this),getUsageConfiguration:this[k0].bind(this),getUsageInstance:this[a0].bind(this),getValidationInstance:this[e0].bind(this),hasParseCallback:this[wu].bind(this),isGlobalContext:this[D2].bind(this),postProcess:this[aD].bind(this),reset:this[JF].bind(this),runValidation:this[MF].bind(this),runYargsParserAndExecuteCommands:this[Mu].bind(this),setHasOutput:this[F2].bind(this)}}[o0](){return $(this,e,"f")}[g0](){return $(this,Ju,"f")}[l0](){return $(this,YD,"f")}[s0](){return $(this,nD,"f")}[r0](){return $(this,iD,"f")||{}}[a0](){return $(this,w,"f")}[e0](){return $(this,l,"f")}[wu](){return!!$(this,fD,"f")}[D2](){return $(this,Su,"f")}[aD](D,u,F,C){if(F)return D;if(o(D))return D;if(!u)D=this[c0](D);if(this[rD]()["parse-positional-numbers"]||this[rD]()["parse-positional-numbers"]===void 0)D=this[n0](D);if(C)D=tD(D,this,$(this,HD,"f").getMiddleware(),!1);return D}[JF](D={}){_(this,R,$(this,R,"f")||{},"f");let u={};u.local=$(this,R,"f").local||[],u.configObjects=$(this,R,"f").configObjects||[];let F={};u.local.forEach((B)=>{F[B]=!0,(D[B]||[]).forEach((z)=>{F[z]=!0})}),Object.assign($(this,oD,"f"),Object.keys($(this,_D,"f")).reduce((B,z)=>{let X=$(this,_D,"f")[z].filter((J)=>!(J in F));if(X.length>0)B[z]=X;return B},{})),_(this,_D,{},"f");let C=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],E=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];if(C.forEach((B)=>{u[B]=($(this,R,"f")[B]||[]).filter((z)=>!F[z])}),E.forEach((B)=>{u[B]=PD($(this,R,"f")[B],(z)=>!F[z])}),u.envPrefix=$(this,R,"f").envPrefix,_(this,R,u,"f"),_(this,w,$(this,w,"f")?$(this,w,"f").reset(F):R0(this,$(this,b,"f")),"f"),_(this,l,$(this,l,"f")?$(this,l,"f").reset(F):w0(this,$(this,w,"f"),$(this,b,"f")),"f"),_(this,e,$(this,e,"f")?$(this,e,"f").reset():K0($(this,w,"f"),$(this,l,"f"),$(this,HD,"f"),$(this,b,"f")),"f"),!$(this,QD,"f"))_(this,QD,P0(this,$(this,w,"f"),$(this,e,"f"),$(this,b,"f")),"f");return $(this,HD,"f").reset(),_(this,OD,null,"f"),_(this,zD,"","f"),_(this,hD,null,"f"),_(this,YD,!1,"f"),this.parsed=!1,this}[u2](D,u){return $(this,b,"f").path.relative(D,u)}[Mu](D,u,F,C=0,E=!1){var B,z,X,J;let f=!!F||E;D=D||$(this,wD,"f"),$(this,R,"f").__=$(this,b,"f").y18n.__,$(this,R,"f").configuration=this[rD]();let W=!!$(this,R,"f").configuration["populate--"],O=Object.assign({},$(this,R,"f").configuration,{"populate--":!0}),Y=$(this,b,"f").Parser.detailed(D,Object.assign({},$(this,R,"f"),{configuration:{"parse-positional-numbers":!1,...O}})),q=Object.assign(Y.argv,$(this,iD,"f")),H=void 0,M=Y.aliases,S=!1,p=!1;if(Object.keys(q).forEach((m)=>{if(m===$(this,WD,"f")&&q[m])S=!0;else if(m===$(this,KD,"f")&&q[m])p=!0}),q.$0=this.$0,this.parsed=Y,C===0)$(this,w,"f").clearCachedHelpMessage();try{if(this[BF](),u)return this[aD](q,W,!!F,!1);if($(this,WD,"f")){if([$(this,WD,"f")].concat(M[$(this,WD,"f")]||[]).filter((uD)=>uD.length>1).includes(""+q._[q._.length-1]))q._.pop(),S=!0}_(this,Su,!1,"f");let m=$(this,e,"f").getCommands(),BD=((B=$(this,QD,"f"))===null||B===void 0?void 0:B.completionKey)?[(z=$(this,QD,"f"))===null||z===void 0?void 0:z.completionKey,...(J=this.getAliases()[(X=$(this,QD,"f"))===null||X===void 0?void 0:X.completionKey])!==null&&J!==void 0?J:[]].some((i)=>Object.prototype.hasOwnProperty.call(q,i)):!1,c=S||BD||E;if(q._.length){if(m.length){let i;for(let uD=C||0,s;q._[uD]!==void 0;uD++)if(s=String(q._[uD]),m.includes(s)&&s!==$(this,OD,"f")){let LD=$(this,e,"f").runCommand(s,this,Y,uD+1,E,S||p||E);return this[aD](LD,W,!!F,!1)}else if(!i&&s!==$(this,OD,"f")){i=s;break}if(!$(this,e,"f").hasDefaultCommand()&&$(this,bu,"f")&&i&&!c)$(this,l,"f").recommendCommands(i,m)}if($(this,OD,"f")&&q._.includes($(this,OD,"f"))&&!BD){if($(this,qD,"f"))bD(!0);this.showCompletionScript(),this.exit(0)}}if($(this,e,"f").hasDefaultCommand()&&!c){let i=$(this,e,"f").runCommand(null,this,Y,0,E,S||p||E);return this[aD](i,W,!!F,!1)}if(BD){if($(this,qD,"f"))bD(!0);D=[].concat(D);let i=D.slice(D.indexOf(`--${$(this,QD,"f").completionKey}`)+1);return $(this,QD,"f").getCompletion(i,(uD,s)=>{if(uD)throw new a(uD.message);(s||[]).forEach((LD)=>{$(this,nD,"f").log(LD)}),this.exit(0)}),this[aD](q,!W,!!F,!1)}if(!$(this,YD,"f")){if(S){if($(this,qD,"f"))bD(!0);f=!0,this.showHelp((i)=>{$(this,nD,"f").log(i),this.exit(0)})}else if(p){if($(this,qD,"f"))bD(!0);f=!0,$(this,w,"f").showVersion("log"),this.exit(0)}}if(!f&&$(this,R,"f").skipValidation.length>0)f=Object.keys(q).some((i)=>$(this,R,"f").skipValidation.indexOf(i)>=0&&q[i]===!0);if(!f){if(Y.error)throw new a(Y.error.message);if(!BD){let i=this[MF](M,{},Y.error);if(!F)H=tD(q,this,$(this,HD,"f").getMiddleware(),!0);if(H=this[i0](i,H!==null&&H!==void 0?H:q),o(H)&&!F)H=H.then(()=>{return tD(q,this,$(this,HD,"f").getMiddleware(),!1)})}}}catch(m){if(m instanceof a)$(this,w,"f").fail(m.message,m);else throw m}return this[aD](H!==null&&H!==void 0?H:q,W,!!F,!0)}[MF](D,u,F,C){let E={...this.getDemandedOptions()};return(B)=>{if(F)throw new a(F.message);$(this,l,"f").nonOptionCount(B),$(this,l,"f").requiredArguments(B,E);let z=!1;if($(this,lD,"f"))z=$(this,l,"f").unknownCommands(B);if($(this,gD,"f")&&!z)$(this,l,"f").unknownArguments(B,D,u,!!C);else if($(this,sD,"f"))$(this,l,"f").unknownArguments(B,D,{},!1,!1);$(this,l,"f").limitedChoices(B),$(this,l,"f").implications(B),$(this,l,"f").conflicting(B)}}[F2](){_(this,YD,!0,"f")}[eD](D){if(typeof D==="string")$(this,R,"f").key[D]=!0;else for(let u of D)$(this,R,"f").key[u]=!0}}function j0(D){return!!D&&typeof D.getInternalMethods==="function"}var U3=C2(W0),B2=U3;var $2={name:"@coryrylan/cradle",version:"0.0.0",description:"A runtime for portable agents defined as folders \u2014 launches the pi coding agent configured from an agent folder, sandboxed with nono",main:"./dist/index.js",module:"./dist/index.js",types:"./dist/index.d.ts",type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},bin:{cradle:"dist/index.js"},files:["README.md","CHANGELOG.md","LICENSE","package.json","dist/index.js","dist/**/*.d.ts","!dist/**/*.test.d.ts"],repository:{type:"git",url:"git+https://github.com/coryrylan/cradle.git",directory:"projects/cli"},keywords:["pi","agents","agent-folders","sandbox","nono","cli","bun"],author:"Cory Rylan (https://coryrylan.com)",license:"MIT",bugs:{url:"https://github.com/coryrylan/cradle/issues"},homepage:"https://github.com/coryrylan/cradle/tree/main/projects/cli#readme",engines:{bun:">=1.3.0"},publishConfig:{access:"public"},scripts:{start:"wireit",ci:"wireit","ci:nocache":"bun run clean && bun run ci",clean:"rm -rf dist",test:"wireit","test:coverage":"wireit",lint:"wireit",build:"wireit","install:local":"wireit","uninstall:local":"wireit",release:"wireit"},wireit:{start:{command:"bun src/index.ts",cache:!1},ci:{dependencies:["lint","build","test:coverage"]},test:{command:"bun test",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},"test:coverage":{command:"bun test --coverage",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},lint:{command:"eslint .",files:["src/**/*.ts","eslint.config.js","package.json"],output:[]},build:{dependencies:["build:js","build:tsc","build:darwin-arm64","build:darwin-x64","build:linux-x64","build:linux-arm64","build:windows-x64"]},"build:js":{command:"bun build ./src/index.ts --outdir=./dist --target=bun --format=esm --minify",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/index.js"]},"build:tsc":{command:"tsc --emitDeclarationOnly --project tsconfig.types.json",files:["src/**/*.ts","src/**/*.json","tsconfig.json","tsconfig.types.json"],output:["dist/**/*.d.ts"]},"build:darwin-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-arm64 --outfile dist/cradle-macos-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-arm64"]},"build:darwin-x64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-x64 --outfile dist/cradle-macos-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-x64"]},"build:linux-x64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-x64 --outfile dist/cradle-linux-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-x64"]},"build:linux-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-arm64 --outfile dist/cradle-linux-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-arm64"]},"build:windows-x64":{command:"bun build --compile --minify src/index.ts --target=bun-windows-x64 --outfile dist/cradle-windows-x64.exe",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-windows-x64.exe"]},"install:local":{dependencies:["build"],command:"bash install.sh",cache:!1},"uninstall:local":{command:'rm -f "$HOME/.local/bin/cradle"',cache:!1},release:{command:"HUSKY=0 bun x semantic-release",dependencies:["ci"]}},dependencies:{yargs:"18.0.0"},devDependencies:{"@eslint/js":"catalog:","@types/bun":"catalog:","@types/yargs":"17.0.35",eslint:"catalog:",typescript:"catalog:","typescript-eslint":"catalog:"}};import{join as H3}from"path";function W3(D){let{folder:u}=D,{settings:F}=u,C=[D.piBin,"--append-system-prompt",u.appendSystemFilePath,"--no-extensions","--no-skills","--no-prompt-templates"];if(u.providersJson!==null)C.push("-e",H3(D.extensionsDir,"providers.ts"));for(let E of D.packageEntries??[])C.push("-e",E);for(let E of u.extensionFiles)C.push("-e",E);if(u.skillsDir!==null)C.push("--skill",u.skillsDir);if(F.defaultProvider!==void 0)C.push("--provider",F.defaultProvider);if(F.defaultModel!==void 0)C.push("--model",F.defaultModel);if(F.defaultThinkingLevel!==void 0)C.push("--thinking",F.defaultThinkingLevel);return C.push("--session-dir",D.sessionsDir),C.push(...D.passthrough),C}function OF(D){return D.sandbox?{MISE_CACHE_DIR:D.miseCacheDir}:{}}function Ou(D){let u=W3(D);if(!D.sandbox)return u;return[D.nonoBin,"run",...D.verbose===!0?[]:["--silent"],"--profile",D.profilePath,"--",...u]}import{existsSync as T3}from"fs";import{homedir as V3}from"os";import{join as I3}from"path";function L3(D,u=V3()){let F=I3(u,".local","share","mise","shims",D);return T3(F)?F:null}var z2=(D)=>Bun.which(D)??L3(D);function YF(D,u=z2){return u(D)}function fF(D,u=z2){let F=YF(D,u);if(!F)throw Error(`required executable "${D}" not found on PATH \u2014 install it, then run \`cradle doctor\` to verify`);return F}var _3="recommended: the supported way to install pi/nono \u2014 cradle resolves them from mise shims and the sandbox profile assumes a mise-managed install",K3="required for sandboxed runs (a folder declaring sandbox/nono.json, or --sandbox/--offline/--allow-host); not needed otherwise";async function Z2(D={}){let u=(f)=>YF(f,D.which),F=async(f)=>f!==null&&D.readVersion?D.readVersion(f):null,C=u("pi"),E=u("nono"),B=u("mise"),[z,X,J]=await Promise.all([F(C),F(E),F(B)]);return[{name:"pi",bin:"pi",required:!0,found:C,version:z},{name:"nono",bin:"nono",required:!1,found:E,version:X,...E?{}:{note:K3}},{name:"mise",bin:"mise",required:!1,found:B,version:J,...B?{}:{note:_3}}]}function j3(D){let u=D.found?`\u2713 ${D.name.padEnd(8)} ${D.version??"?"} ${D.found}`:D.required?`\u2717 ${D.name.padEnd(8)} MISSING (required)`:`\u25CB ${D.name.padEnd(8)} not found (recommended)`;return D.note?`${u}
82
- \u26A0 ${D.note}`:u}function X2(D){return D.map(j3).join(`
83
- `)}function G2(D){return D.some((u)=>u.required&&!u.found)?1:0}import{exists as p1,mkdir as KF,rm as t1,writeFile as d2}from"fs/promises";import{homedir as d1}from"os";import{dirname as k1,join as qu}from"path";import{stat as y3}from"fs/promises";import{join as W2,resolve as n3}from"path";import{basename as R3,isAbsolute as A3,join as S3,relative as x3}from"path";var Yu={extends:"default",meta:{name:"cradle-pi"},groups:{include:["node_runtime","git_config","unlink_protection"]},filesystem:{read:["$HOME/.agents","$HOME/.local/share/mise","$HOME/.config/mise","$HOME/.local/state/mise","$HOME/.config/gh","/System/iOSSupport/System/Library/ExtensionKit/Extensions","/System/Library/AssetsV2/com_apple_MobileAsset_TTSAXResourceModelAssets","/System/Library/AssetsV2/com_apple_MobileAsset_UAF_Siri_TextToSpeech"],allow:["$HOME/.pi/agent"]},unsafe_macos_seatbelt_rules:['(allow user-preference-read (preference-domain "kCFPreferencesAnyApplication") (preference-domain "com.apple.speech.voice.prefs") (preference-domain "com.apple.speakselection") (preference-domain "com.apple.assistant.backedup") (preference-domain "com.apple.assistant.support") (preference-domain "com.apple.accessibility"))']};var Q2="nono-profile.json";function mu(D,u){let F=x3(D,u);return F===""||!F.startsWith("..")&&!A3(F)}function J2(D,u){let F=S3(u,".local","state","nono");return mu(D,F)||mu(F,D)?D:void 0}function UF(D,u){if(D==="~"||D==="$HOME")return u;if(D.startsWith("~/"))return`${u}${D.slice(1)}`;if(D.startsWith("$HOME/"))return`${u}${D.slice(5)}`;return D}function M2(D){let u=(B)=>UF(B,D.home),F=Yu.filesystem,C=D.network!==void 0?P3(D.network):void 0,E={...Yu,meta:{...Yu.meta,name:`cradle-${R3(D.stateDir)}`},filesystem:{...F,read:[...F.read??[],D.agentDir,...D.grants.read.map(u)],write:[...F.write??[],...D.grants.write.map(u)],allow:[...F.allow??[],D.cwd,D.stateDir,...D.linkedGitDir!==void 0?[D.linkedGitDir]:[],...D.grants.allow.map(u)]},unsafe_macos_seatbelt_rules:[...Yu.unsafe_macos_seatbelt_rules??[],...D.rules],...C!==void 0?{network:C}:{}};return JSON.stringify(E,null,2)}function P3(D){return{...D.block!==void 0?{block:D.block}:{},...D.networkProfile!==void 0?{network_profile:D.networkProfile}:{},...D.allowDomain!==void 0?{allow_domain:D.allowDomain}:{},...D.openPort!==void 0?{open_port:D.openPort}:{},...D.listenPort!==void 0?{listen_port:D.listenPort}:{}}}import{chmod as O2,lstat as b3,mkdir as h3,readdir as Y2,readFile as w3,rm as m3,writeFile as c3}from"fs/promises";import{dirname as v3,join as vu,relative as p3}from"path";function JD(D){return typeof D==="object"&&D!==null&&!Array.isArray(D)}function zu(D,u){try{return JSON.parse(D)}catch(F){throw Error(`${u} is not valid JSON: ${Du(F)}`,{cause:F})}}function Du(D){return D instanceof Error?D.message:String(D)}function ID(D,u){return typeof D==="object"&&D!==null&&"code"in D&&D.code===u}function qF(D){if(/^[A-Za-z0-9_./:@%+=,-]+$/u.test(D))return D;return`'${D.replaceAll("'","'\\''")}'`}function cD(D){return Array.isArray(D)&&D.every((u)=>typeof u==="string")}function fu(D){return/^(?:\/|~(?:\/|$)|\$HOME(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/.test(D)}function uu(D,u,F,C){let E=Object.keys(D).filter((B)=>!F.includes(B));if(E.length>0)C.push(`${u}: unsupported keys ignored: ${E.join(", ")}`)}function cu(D,u,F,C){D.results.push({name:u,detail:F,status:C})}function t3(D,u,F){D.failures.push(`${u}: ${F}`),cu(D,u,F,"failed")}async function f2(D,u,F,C){try{if(await k3(F,C)){cu(D,u,F,"unchanged");return}if(D.dryRun){cu(D,u,`would replace ${F}`,"changed");return}await q2(F),await m3(F,{force:!0,recursive:!0});for(let E of C)await d3(F,E);cu(D,u,F,"changed")}catch(E){t3(D,u,Du(E))}}async function d3(D,u){let F=vu(D,u.rel);if(await h3(v3(F),{recursive:!0}),await c3(F,u.content,"utf8"),u.mode!==void 0)await O2(F,u.mode)}async function k3(D,u){let F=await U2(D);if(F.length!==u.length)return!1;let C=new Set(F);for(let E of u){if(!C.has(E.rel))return!1;if(await RD(vu(D,E.rel))!==E.content)return!1}return!0}async function U2(D,u=D){let F=await H2(D);if(!F||!F.isDirectory())return[];let C=[];for(let E of await Y2(D,{withFileTypes:!0})){let B=vu(D,E.name);if(E.isDirectory())C.push(...await U2(B,u));else C.push(p3(u,B))}return C}async function q2(D){let u=await H2(D);if(!u||u.isSymbolicLink())return;if(await O2(D,u.isDirectory()?493:420),!u.isDirectory())return;let F=await Y2(D);await Promise.all(F.map((C)=>q2(vu(D,C))))}async function RD(D){try{return await w3(D,"utf8")}catch(u){if(ID(u,"ENOENT"))return;throw u}}async function H2(D){try{return await b3(D)}catch(u){if(ID(u,"ENOENT"))return;throw u}}var i3=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function V2(D,u){if(!o3(D))return{dir:D,warnings:[]};let F=W2(u.home,".cradle","settings.json"),C=[],E=await g3(F,C),B=W2(u.cwd,D),z=E.get(D);if(z!==void 0){let X=n3(UF(z,u.home));if(await T2(B))C.push(r3(D,X));return{dir:X,warnings:C}}if(await T2(B))return{dir:B,warnings:C};throw Error(a3(D,B,F,E))}function o3(D){return i3.test(D)}async function T2(D){try{return(await y3(D)).isDirectory()}catch(u){if(ID(u,"ENOENT")||ID(u,"ENOTDIR"))return!1;throw u}}async function g3(D,u){let F=await RD(D);if(F===void 0)return new Map;let C=zu(F,D);if(!JD(C))return u.push(`${D}: settings must be a JSON object \u2014 ignored`),new Map;return uu(C,D,["agents"],u),l3(C,D,u)}function l3(D,u,F){let C=D.agents;if(C===void 0)return new Map;if(!JD(C))return F.push(`${u}: agents must be an object \u2014 ignored`),new Map;let E=Object.entries(C).map((B)=>{let[z,X]=B,J=s3(X,z,u,F);return J===void 0?void 0:[z,J]}).filter((B)=>B!==void 0);return new Map(E)}function s3(D,u,F,C){if(!JD(D)){C.push(`${F}: agents.${u} must be an object with a "path" \u2014 ignored`);return}let E=D.path;if(typeof E!=="string"||E.trim()===""){C.push(`${F}: agents.${u}.path must be a non-empty string \u2014 ignored`);return}if(!fu(E)){C.push(`${F}: agents.${u}.path must be an absolute, ~/, or $HOME/ path \u2014 ignored: ${E}`);return}return E}function r3(D,u){return`started alias "${D}" (${u}) \u2014 a directory named ${D} exists in the current directory; use ./${D} to run it instead`}function a3(D,u,F,C){let E=C.size>0?` (known agents: ${[...C.keys()].join(", ")})`:"";return`agent folder not found: ${u} \u2014 and no "agents.${D}" entry in ${F}${E}`}function I2(D){return`// generated by cradle from the agent folder's models.json \u2014 do not edit
74
+ `;class m0{constructor(D,u,F,C){var E,B,$;this.yargs=D,this.usage=u,this.command=F,this.shim=C,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=($=((E=this.shim.getEnv("SHELL"))===null||E===void 0?void 0:E.includes("zsh"))||((B=this.shim.getEnv("ZSH_NAME"))===null||B===void 0?void 0:B.includes("zsh")))!==null&&$!==void 0?$:!1}defaultCompletion(D,u,F,C){let E=this.command.getCommandHandlers();for(let $=0,Z=D.length;$<Z;++$)if(E[D[$]]&&E[D[$]].builder){let M=E[D[$]].builder;if(Nu(M)){this.indexAfterLastReset=$+1;let O=this.yargs.getInternalMethods().reset();return M(O,!0),O.argv}}let B=[];this.commandCompletions(B,D,F),this.optionCompletions(B,D,u,F),this.choicesFromOptionsCompletions(B,D,u,F),this.choicesFromPositionalsCompletions(B,D,u,F),C(null,B)}commandCompletions(D,u,F){let C=this.yargs.getInternalMethods().getContext().commands;if(!F.match(/^-/)&&C[C.length-1]!==F&&!this.previousArgHasChoices(u))this.usage.getCommands().forEach((E)=>{let B=xD(E[0]).cmd;if(u.indexOf(B)===-1)if(!this.zshShell)D.push(B);else{let $=E[1]||"";D.push(B.replace(/:/g,"\\:")+":"+$)}})}optionCompletions(D,u,F,C){if((C.match(/^-/)||C===""&&D.length===0)&&!this.previousArgHasChoices(u)){let E=this.yargs.getOptions(),B=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(E.key).forEach(($)=>{let Z=!!E.configuration["boolean-negation"]&&E.boolean.includes($);if(!B.includes($)&&!E.hiddenOptions.includes($)&&!this.argsContainKey(u,$,Z))this.completeOptionKey($,D,C,Z&&!!E.default[$])})}}choicesFromOptionsCompletions(D,u,F,C){if(this.previousArgHasChoices(u)){let E=this.getPreviousArgChoices(u);if(E&&E.length>0)D.push(...E.map((B)=>B.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(D,u,F,C){if(C===""&&D.length>0&&this.previousArgHasChoices(u))return;let E=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],B=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),$=E[F._.length-B-1];if(!$)return;let Z=this.yargs.getOptions().choices[$]||[];for(let M of Z)if(M.startsWith(C))D.push(M.replace(/:/g,"\\:"))}getPreviousArgChoices(D){if(D.length<1)return;let u=D[D.length-1],F="";if(!u.startsWith("-")&&D.length>1)F=u,u=D[D.length-2];if(!u.startsWith("-"))return;let C=u.replace(/^-+/,""),E=this.yargs.getOptions(),B=[C,...this.yargs.getAliases()[C]||[]],$;for(let Z of B)if(Object.prototype.hasOwnProperty.call(E.key,Z)&&Array.isArray(E.choices[Z])){$=E.choices[Z];break}if($)return $.filter((Z)=>!F||Z.startsWith(F))}previousArgHasChoices(D){let u=this.getPreviousArgChoices(D);return u!==void 0&&u.length>0}argsContainKey(D,u,F){let C=(E)=>D.indexOf((/^[^0-9]$/.test(E)?"-":"--")+E)!==-1;if(C(u))return!0;if(F&&C(`no-${u}`))return!0;if(this.aliases){for(let E of this.aliases[u])if(C(E))return!0}return!1}completeOptionKey(D,u,F,C){var E,B,$,Z;let M=D;if(this.zshShell){let q=this.usage.getDescriptions(),H=(B=(E=this===null||this===void 0?void 0:this.aliases)===null||E===void 0?void 0:E[D])===null||B===void 0?void 0:B.find((S)=>{let d=q[S];return typeof d==="string"&&d.length>0}),W=H?q[H]:void 0,J=(Z=($=q[D])!==null&&$!==void 0?$:W)!==null&&Z!==void 0?Z:"";M=`${D.replace(/:/g,"\\:")}:${J.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let O=(q)=>/^--/.test(q),V=(q)=>/^[^0-9]$/.test(q),Y=!O(F)&&V(D)?"-":"--";if(u.push(Y+M),C)u.push(Y+"no-"+M)}customCompletion(D,u,F,C){if(MD(this.customCompletionFunction,null,this.shim),x3(this.customCompletionFunction)){let E=this.customCompletionFunction(F,u);if(l(E))return E.then((B)=>{this.shim.process.nextTick(()=>{C(null,B)})}).catch((B)=>{this.shim.process.nextTick(()=>{C(B,void 0)})});return C(null,E)}else if(b3(this.customCompletionFunction))return this.customCompletionFunction(F,u,(E=C)=>this.defaultCompletion(D,u,F,E),(E)=>{C(null,E)});else return this.customCompletionFunction(F,u,(E)=>{C(null,E)})}getCompletion(D,u){let F=D.length?D[D.length-1]:"",C=this.yargs.parse(D,!0),E=this.customCompletionFunction?(B)=>this.customCompletion(D,B,F,u):(B)=>this.defaultCompletion(D,B,F,u);return l(C)?C.then(E):E(C)}generateCompletionScript(D,u){let F=this.zshShell?w0:h0,C=this.shim.path.basename(D);if(D.match(/\.js$/))D=`./${D}`;return F=F.replace(/{{app_name}}/g,C),F=F.replace(/{{completion_command}}/g,u),F.replace(/{{app_path}}/g,D)}registerFunction(D){this.customCompletionFunction=D}setParsed(D){this.aliases=D.aliases}}function v0(D,u,F,C){return new m0(D,u,F,C)}function x3(D){return D.length<3}function b3(D){return D.length>3}function c0(D,u){if(D.length===0)return u.length;if(u.length===0)return D.length;let F=[],C;for(C=0;C<=u.length;C++)F[C]=[C];let E;for(E=0;E<=D.length;E++)F[0][E]=E;for(C=1;C<=u.length;C++)for(E=1;E<=D.length;E++)if(u.charAt(C-1)===D.charAt(E-1))F[C][E]=F[C-1][E-1];else if(C>1&&E>1&&u.charAt(C-2)===D.charAt(E-1)&&u.charAt(C-1)===D.charAt(E-2))F[C][E]=F[C-2][E-2]+1;else F[C][E]=Math.min(F[C-1][E-1]+1,Math.min(F[C][E-1]+1,F[C-1][E]+1));return F[u.length][D.length]}var d0=["$0","--","_"];function p0(D,u,F){let C=F.y18n.__,E=F.y18n.__n,B={};B.nonOptionCount=function(Y){let q=D.getDemandedCommands(),W=Y._.length+(Y["--"]?Y["--"].length:0)-D.getInternalMethods().getContext().commands.length;if(q._&&(W<q._.min||W>q._.max)){if(W<q._.min)if(q._.minMsg!==void 0)u.fail(q._.minMsg?q._.minMsg.replace(/\$0/g,W.toString()).replace(/\$1/,q._.min.toString()):null);else u.fail(E("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",W,W.toString(),q._.min.toString()));else if(W>q._.max)if(q._.maxMsg!==void 0)u.fail(q._.maxMsg?q._.maxMsg.replace(/\$0/g,W.toString()).replace(/\$1/,q._.max.toString()):null);else u.fail(E("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",W,W.toString(),q._.max.toString()))}},B.positionalCount=function(Y,q){if(q<Y)u.fail(E("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",q,q+"",Y+""))},B.requiredArguments=function(Y,q){let H=null;for(let W of Object.keys(q))if(!Object.prototype.hasOwnProperty.call(Y,W)||typeof Y[W]>"u")H=H||{},H[W]=q[W];if(H){let W=[];for(let S of Object.keys(H)){let d=H[S];if(d&&W.indexOf(d)<0)W.push(d)}let J=W.length?`
75
+ ${W.join(`
76
+ `)}`:"";u.fail(E("Missing required argument: %s","Missing required arguments: %s",Object.keys(H).length,Object.keys(H).join(", ")+J))}},B.unknownArguments=function(Y,q,H,W,J=!0){var S;let d=D.getInternalMethods().getCommandInstance().getCommands(),v=[],ZD=D.getInternalMethods().getContext();if(Object.keys(Y).forEach((m)=>{if(!d0.includes(m)&&!Object.prototype.hasOwnProperty.call(H,m)&&!Object.prototype.hasOwnProperty.call(D.getInternalMethods().getParseContext(),m)&&!B.isValidAndSomeAliasIsNotNew(m,q))v.push(m)}),J&&(ZD.commands.length>0||d.length>0||W))Y._.slice(ZD.commands.length).forEach((m)=>{if(!d.includes(""+m))v.push(""+m)});if(J){let g=((S=D.getDemandedCommands()._)===null||S===void 0?void 0:S.max)||0,uD=ZD.commands.length+g;if(uD<Y._.length)Y._.slice(uD).forEach((s)=>{if(s=String(s),!ZD.commands.includes(s)&&!v.includes(s))v.push(s)})}if(v.length)u.fail(E("Unknown argument: %s","Unknown arguments: %s",v.length,v.map((m)=>m.trim()?m:`"${m}"`).join(", ")))},B.unknownCommands=function(Y){let q=D.getInternalMethods().getCommandInstance().getCommands(),H=[],W=D.getInternalMethods().getContext();if(W.commands.length>0||q.length>0)Y._.slice(W.commands.length).forEach((J)=>{if(!q.includes(""+J))H.push(""+J)});if(H.length>0)return u.fail(E("Unknown command: %s","Unknown commands: %s",H.length,H.join(", "))),!0;else return!1},B.isValidAndSomeAliasIsNotNew=function(Y,q){if(!Object.prototype.hasOwnProperty.call(q,Y))return!1;let H=D.parsed.newAliases;return[Y,...q[Y]].some((W)=>!Object.prototype.hasOwnProperty.call(H,W)||!H[Y])},B.limitedChoices=function(Y){let q=D.getOptions(),H={};if(!Object.keys(q.choices).length)return;Object.keys(Y).forEach((S)=>{if(d0.indexOf(S)===-1&&Object.prototype.hasOwnProperty.call(q.choices,S))[].concat(Y[S]).forEach((d)=>{if(q.choices[S].indexOf(d)===-1&&d!==void 0)H[S]=(H[S]||[]).concat(d)})});let W=Object.keys(H);if(!W.length)return;let J=C("Invalid values:");W.forEach((S)=>{J+=`
77
+ ${C("Argument: %s, Given: %s, Choices: %s",S,u.stringifiedValues(H[S]),u.stringifiedValues(q.choices[S]))}`}),u.fail(J)};let $={};B.implies=function(Y,q){if(L("<string|object> [array|number|string]",[Y,q],arguments.length),typeof Y==="object")Object.keys(Y).forEach((H)=>{B.implies(H,Y[H])});else{if(D.global(Y),!$[Y])$[Y]=[];if(Array.isArray(q))q.forEach((H)=>B.implies(Y,H));else MD(q,void 0,F),$[Y].push(q)}},B.getImplied=function(){return $};function Z(V,Y){let q=Number(Y);if(Y=isNaN(q)?Y:q,typeof Y==="number")Y=V._.length>=Y;else if(Y.match(/^--no-.+/))Y=Y.match(/^--no-(.+)/)[1],Y=!Object.prototype.hasOwnProperty.call(V,Y);else Y=Object.prototype.hasOwnProperty.call(V,Y);return Y}B.implications=function(Y){let q=[];if(Object.keys($).forEach((H)=>{let W=H;($[H]||[]).forEach((J)=>{let S=W,d=J;if(S=Z(Y,S),J=Z(Y,J),S&&!J)q.push(` ${W} -> ${d}`)})}),q.length){let H=`${C("Implications failed:")}
78
+ `;q.forEach((W)=>{H+=W}),u.fail(H)}};let M={};B.conflicts=function(Y,q){if(L("<string|object> [array|string]",[Y,q],arguments.length),typeof Y==="object")Object.keys(Y).forEach((H)=>{B.conflicts(H,Y[H])});else{if(D.global(Y),!M[Y])M[Y]=[];if(Array.isArray(q))q.forEach((H)=>B.conflicts(Y,H));else M[Y].push(q)}},B.getConflicting=()=>M,B.conflicting=function(Y){if(Object.keys(Y).forEach((q)=>{if(M[q])M[q].forEach((H)=>{if(H&&Y[q]!==void 0&&Y[H]!==void 0)u.fail(C("Arguments %s and %s are mutually exclusive",q,H))})}),D.getInternalMethods().getParserConfiguration()["strip-dashed"])Object.keys(M).forEach((q)=>{M[q].forEach((H)=>{if(H&&Y[F.Parser.camelCase(q)]!==void 0&&Y[F.Parser.camelCase(H)]!==void 0)u.fail(C("Arguments %s and %s are mutually exclusive",q,H))})})},B.recommendCommands=function(Y,q){q=q.sort((S,d)=>d.length-S.length);let W=null,J=1/0;for(let S=0,d;(d=q[S])!==void 0;S++){let v=c0(Y,d);if(v<=3&&v<J)J=v,W=d}if(W)u.fail(C("Did you mean %s?",W))},B.reset=function(Y){return $=bD($,(q)=>!Y[q]),M=bD(M,(q)=>!Y[q]),B};let O=[];return B.freeze=function(){O.push({implied:$,conflicting:M})},B.unfreeze=function(){let Y=O.pop();MD(Y,void 0,F),{implied:$,conflicting:M}=Y},B}var GF=[],Yu;function Su(D,u,F,C){Yu=C;let E={};if(Object.prototype.hasOwnProperty.call(D,"extends")){if(typeof D.extends!=="string")return E;let B=/\.json|\..*rc$/.test(D.extends),$=null;if(!B)try{$=import.meta.resolve(D.extends)}catch(Z){return D}else $=w3(u,D.extends);h3($),GF.push($),E=B?JSON.parse(Yu.readFileSync($,"utf8")):C.require(D.extends),delete D.extends,E=Su(E,Yu.path.dirname($),F,Yu)}return GF=[],F?t0(E,D):Object.assign({},E,D)}function h3(D){if(GF.indexOf(D)>-1)throw new a(`Circular extended configurations: '${D}'.`)}function w3(D,u){return Yu.path.resolve(D,u)}function t0(D,u){let F={};function C(E){return E&&typeof E==="object"&&!Array.isArray(E)}Object.assign(F,D);for(let E of Object.keys(u))if(C(u[E])&&C(F[E]))F[E]=t0(D[E],u[E]);else F[E]=u[E];return F}var K=function(D,u,F,C,E){if(C==="m")throw TypeError("Private method is not writable");if(C==="a"&&!E)throw TypeError("Private accessor was defined without a setter");if(typeof u==="function"?D!==u||!E:!u.has(D))throw TypeError("Cannot write private member to an object whose class did not declare it");return C==="a"?E.call(D,F):E?E.value=F:u.set(D,F),F},z=function(D,u,F,C){if(F==="a"&&!C)throw TypeError("Private accessor was defined without a getter");if(typeof u==="function"?D!==u||!C:!u.has(D))throw TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?C:F==="a"?C.call(D):C?C.value:u.get(D)},e,yD,qu,GD,YD,Pu,wD,iD,xu,UD,bu,WD,jD,qD,VD,hu,gD,$D,N,wu,mu,OD,lD,$u,nD,mD,vu,b,oD,sD,rD,w,cu,_D,o;function Z2(D){return(u=[],F=D.process.cwd(),C)=>{let E=new Q2(u,F,C,D);return Object.defineProperty(E,"argv",{get:()=>{return E.parse()},enumerable:!0}),E.help(),E.version(),E}}var k0=Symbol("copyDoubleDash"),y0=Symbol("copyDoubleDash"),JF=Symbol("deleteFromParserHintObject"),i0=Symbol("emitWarning"),g0=Symbol("freeze"),l0=Symbol("getDollarZero"),aD=Symbol("getParserConfiguration"),n0=Symbol("getUsageConfiguration"),YF=Symbol("guessLocale"),o0=Symbol("guessVersion"),s0=Symbol("parsePositionalNumbers"),qF=Symbol("pkgUp"),vD=Symbol("populateParserHintArray"),zu=Symbol("populateParserHintSingleValueDictionary"),OF=Symbol("populateParserHintArrayDictionary"),HF=Symbol("populateParserHintDictionary"),UF=Symbol("sanitizeKey"),WF=Symbol("setKey"),VF=Symbol("unfreeze"),r0=Symbol("validateAsync"),a0=Symbol("getCommandInstance"),e0=Symbol("getContext"),D2=Symbol("getHasOutput"),u2=Symbol("getLoggerInstance"),F2=Symbol("getParseContext"),C2=Symbol("getUsageInstance"),E2=Symbol("getValidationInstance"),du=Symbol("hasParseCallback"),B2=Symbol("isGlobalContext"),eD=Symbol("postProcess"),$2=Symbol("rebase"),TF=Symbol("reset"),Ou=Symbol("runYargsParserAndExecuteCommands"),fF=Symbol("runValidation"),z2=Symbol("setHasOutput"),Du=Symbol("kTrackManuallySetKeys"),m3="en_US";class Q2{constructor(D=[],u,F,C){this.customScriptName=!1,this.parsed=!1,e.set(this,void 0),yD.set(this,void 0),qu.set(this,{commands:[],fullCommands:[]}),GD.set(this,null),YD.set(this,null),Pu.set(this,"show-hidden"),wD.set(this,null),iD.set(this,!0),xu.set(this,{}),UD.set(this,!0),bu.set(this,[]),WD.set(this,void 0),jD.set(this,{}),qD.set(this,!1),VD.set(this,null),hu.set(this,!0),gD.set(this,void 0),$D.set(this,""),N.set(this,void 0),wu.set(this,void 0),mu.set(this,{}),OD.set(this,null),lD.set(this,null),$u.set(this,{}),nD.set(this,{}),mD.set(this,void 0),vu.set(this,!1),b.set(this,void 0),oD.set(this,!1),sD.set(this,!1),rD.set(this,!1),w.set(this,void 0),cu.set(this,{}),_D.set(this,null),o.set(this,void 0),K(this,b,C,"f"),K(this,mD,D,"f"),K(this,yD,u,"f"),K(this,wu,F,"f"),K(this,WD,new XF(this),"f"),this.$0=this[l0](),this[TF](),K(this,e,z(this,e,"f"),"f"),K(this,w,z(this,w,"f"),"f"),K(this,o,z(this,o,"f"),"f"),K(this,N,z(this,N,"f"),"f"),z(this,N,"f").showHiddenOpt=z(this,Pu,"f"),K(this,gD,this[y0](),"f"),z(this,b,"f").y18n.setLocale(m3)}addHelpOpt(D,u){if(L("[string|boolean] [string]",[D,u],arguments.length),z(this,VD,"f"))this[JF](z(this,VD,"f")),K(this,VD,null,"f");if(D===!1&&u===void 0)return this;return K(this,VD,typeof D==="string"?D:"help","f"),this.boolean(z(this,VD,"f")),this.describe(z(this,VD,"f"),u||z(this,w,"f").deferY18nLookup("Show help")),this}help(D,u){return this.addHelpOpt(D,u)}addShowHiddenOpt(D,u){if(L("[string|boolean] [string]",[D,u],arguments.length),D===!1&&u===void 0)return this;let F=typeof D==="string"?D:z(this,Pu,"f");return this.boolean(F),this.describe(F,u||z(this,w,"f").deferY18nLookup("Show hidden options")),z(this,N,"f").showHiddenOpt=F,this}showHidden(D,u){return this.addShowHiddenOpt(D,u)}alias(D,u){return L("<object|string|array> [string|array]",[D,u],arguments.length),this[OF](this.alias.bind(this),"alias",D,u),this}array(D){return L("<array|string>",[D],arguments.length),this[vD]("array",D),this[Du](D),this}boolean(D){return L("<array|string>",[D],arguments.length),this[vD]("boolean",D),this[Du](D),this}check(D,u){return L("<function> [boolean]",[D,u],arguments.length),this.middleware((F,C)=>{return kD(()=>{return D(F,C.getOptions())},(E)=>{if(!E)z(this,w,"f").fail(z(this,b,"f").y18n.__("Argument check failed: %s",D.toString()));else if(typeof E==="string"||E instanceof Error)z(this,w,"f").fail(E.toString(),E);return F},(E)=>{return z(this,w,"f").fail(E.message?E.message:E.toString(),E),F})},!1,u),this}choices(D,u){return L("<object|string|array> [string|array]",[D,u],arguments.length),this[OF](this.choices.bind(this),"choices",D,u),this}coerce(D,u){if(L("<object|string|array> [function]",[D,u],arguments.length),Array.isArray(D)){if(!u)throw new a("coerce callback must be provided");for(let C of D)this.coerce(C,u);return this}else if(typeof D==="object"){for(let C of Object.keys(D))this.coerce(C,D[C]);return this}if(!u)throw new a("coerce callback must be provided");let F=D;return z(this,N,"f").key[F]=!0,z(this,WD,"f").addCoerceMiddleware((C,E)=>{var B;let $=(B=E.getAliases()[F])!==null&&B!==void 0?B:[],Z=[F,...$].filter((M)=>Object.prototype.hasOwnProperty.call(C,M));if(Z.length===0)return C;return kD(()=>{return u(C[Z[0]])},(M)=>{return Z.forEach((O)=>{C[O]=M}),C},(M)=>{throw new a(M.message)})},F),this}conflicts(D,u){return L("<string|object> [string|array]",[D,u],arguments.length),z(this,o,"f").conflicts(D,u),this}config(D="config",u,F){if(L("[object|string] [string|function] [function]",[D,u,F],arguments.length),typeof D==="object"&&!Array.isArray(D))return D=Su(D,z(this,yD,"f"),this[aD]()["deep-merge-config"]||!1,z(this,b,"f")),z(this,N,"f").configObjects=(z(this,N,"f").configObjects||[]).concat(D),this;if(typeof u==="function")F=u,u=void 0;return this.describe(D,u||z(this,w,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(D)?D:[D]).forEach((C)=>{z(this,N,"f").config[C]=F||!0}),this}completion(D,u,F){if(L("[string] [string|boolean|function] [function]",[D,u,F],arguments.length),typeof u==="function")F=u,u=void 0;if(K(this,YD,D||z(this,YD,"f")||"completion","f"),!u&&u!==!1)u="generate completion script";if(this.command(z(this,YD,"f"),u),F)z(this,GD,"f").registerFunction(F);return this}command(D,u,F,C,E,B){return L("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[D,u,F,C,E,B],arguments.length),z(this,e,"f").addHandler(D,u,F,C,E,B),this}commands(D,u,F,C,E,B){return this.command(D,u,F,C,E,B)}commandDir(D,u){L("<string> [object]",[D,u],arguments.length);let F=z(this,wu,"f")||z(this,b,"f").require;return z(this,e,"f").addDirectory(D,F,z(this,b,"f").getCallerFile(),u),this}count(D){return L("<array|string>",[D],arguments.length),this[vD]("count",D),this[Du](D),this}default(D,u,F){if(L("<object|string|array> [*] [string]",[D,u,F],arguments.length),F)QF(D,z(this,b,"f")),z(this,N,"f").defaultDescription[D]=F;if(typeof u==="function"){if(QF(D,z(this,b,"f")),!z(this,N,"f").defaultDescription[D])z(this,N,"f").defaultDescription[D]=z(this,w,"f").functionDescription(u);u=u.call()}return this[zu](this.default.bind(this),"default",D,u),this}defaults(D,u,F){return this.default(D,u,F)}demandCommand(D=1,u,F,C){if(L("[number] [number|string] [string|null|undefined] [string|null|undefined]",[D,u,F,C],arguments.length),typeof u!=="number")F=u,u=1/0;return this.global("_",!1),z(this,N,"f").demandedCommands._={min:D,max:u,minMsg:F,maxMsg:C},this}demand(D,u,F){if(Array.isArray(u))u.forEach((C)=>{MD(F,!0,z(this,b,"f")),this.demandOption(C,F)}),u=1/0;else if(typeof u!=="number")F=u,u=1/0;if(typeof D==="number")MD(F,!0,z(this,b,"f")),this.demandCommand(D,u,F,F);else if(Array.isArray(D))D.forEach((C)=>{MD(F,!0,z(this,b,"f")),this.demandOption(C,F)});else if(typeof F==="string")this.demandOption(D,F);else if(F===!0||typeof F>"u")this.demandOption(D);return this}demandOption(D,u){return L("<object|string|array> [string]",[D,u],arguments.length),this[zu](this.demandOption.bind(this),"demandedOptions",D,u),this}deprecateOption(D,u){return L("<string> [string|boolean]",[D,u],arguments.length),z(this,N,"f").deprecatedOptions[D]=u,this}describe(D,u){return L("<object|string|array> [string]",[D,u],arguments.length),this[WF](D,!0),z(this,w,"f").describe(D,u),this}detectLocale(D){return L("<boolean>",[D],arguments.length),K(this,iD,D,"f"),this}env(D){if(L("[string|boolean]",[D],arguments.length),D===!1)delete z(this,N,"f").envPrefix;else z(this,N,"f").envPrefix=D||"";return this}epilogue(D){return L("<string>",[D],arguments.length),z(this,w,"f").epilog(D),this}epilog(D){return this.epilogue(D)}example(D,u){if(L("<string|array> [string]",[D,u],arguments.length),Array.isArray(D))D.forEach((F)=>this.example(...F));else z(this,w,"f").example(D,u);return this}exit(D,u){if(K(this,qD,!0,"f"),K(this,wD,u,"f"),z(this,UD,"f"))z(this,b,"f").process.exit(D)}exitProcess(D=!0){return L("[boolean]",[D],arguments.length),K(this,UD,D,"f"),this}fail(D){if(L("<function|boolean>",[D],arguments.length),typeof D==="boolean"&&D!==!1)throw new a("Invalid first argument. Expected function or boolean 'false'");return z(this,w,"f").failFn(D),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(D,u){if(L("<array> [function]",[D,u],arguments.length),!u)return new Promise((F,C)=>{z(this,GD,"f").getCompletion(D,(E,B)=>{if(E)C(E);else F(B)})});else return z(this,GD,"f").getCompletion(D,u)}getDemandedOptions(){return L([],0),z(this,N,"f").demandedOptions}getDemandedCommands(){return L([],0),z(this,N,"f").demandedCommands}getDeprecatedOptions(){return L([],0),z(this,N,"f").deprecatedOptions}getDetectLocale(){return z(this,iD,"f")}getExitProcess(){return z(this,UD,"f")}getGroups(){return Object.assign({},z(this,jD,"f"),z(this,nD,"f"))}getHelp(){if(K(this,qD,!0,"f"),!z(this,w,"f").hasCachedHelpMessage()){if(!this.parsed){let u=this[Ou](z(this,mD,"f"),void 0,void 0,0,!0);if(l(u))return u.then(()=>{return z(this,w,"f").help()})}let D=z(this,e,"f").runDefaultBuilderOn(this);if(l(D))return D.then(()=>{return z(this,w,"f").help()})}return Promise.resolve(z(this,w,"f").help())}getOptions(){return z(this,N,"f")}getStrict(){return z(this,oD,"f")}getStrictCommands(){return z(this,sD,"f")}getStrictOptions(){return z(this,rD,"f")}global(D,u){if(L("<string|array> [boolean]",[D,u],arguments.length),D=[].concat(D),u!==!1)z(this,N,"f").local=z(this,N,"f").local.filter((F)=>D.indexOf(F)===-1);else D.forEach((F)=>{if(!z(this,N,"f").local.includes(F))z(this,N,"f").local.push(F)});return this}group(D,u){L("<string|array> <string>",[D,u],arguments.length);let F=z(this,nD,"f")[u]||z(this,jD,"f")[u];if(z(this,nD,"f")[u])delete z(this,nD,"f")[u];let C={};return z(this,jD,"f")[u]=(F||[]).concat(D).filter((E)=>{if(C[E])return!1;return C[E]=!0}),this}hide(D){return L("<string>",[D],arguments.length),z(this,N,"f").hiddenOptions.push(D),this}implies(D,u){return L("<string|object> [number|string|array]",[D,u],arguments.length),z(this,o,"f").implies(D,u),this}locale(D){if(L("[string]",[D],arguments.length),D===void 0)return this[YF](),z(this,b,"f").y18n.getLocale();return K(this,iD,!1,"f"),z(this,b,"f").y18n.setLocale(D),this}middleware(D,u,F){return z(this,WD,"f").addMiddleware(D,!!u,F)}nargs(D,u){return L("<string|object|array> [number]",[D,u],arguments.length),this[zu](this.nargs.bind(this),"narg",D,u),this}normalize(D){return L("<array|string>",[D],arguments.length),this[vD]("normalize",D),this}number(D){return L("<array|string>",[D],arguments.length),this[vD]("number",D),this[Du](D),this}option(D,u){if(L("<string|object> [object]",[D,u],arguments.length),typeof D==="object")Object.keys(D).forEach((F)=>{this.options(F,D[F])});else{if(typeof u!=="object")u={};if(this[Du](D),z(this,_D,"f")&&(D==="version"||(u===null||u===void 0?void 0:u.alias)==="version"))this[i0](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
79
+ `),void 0,"versionWarning");if(z(this,N,"f").key[D]=!0,u.alias)this.alias(D,u.alias);let F=u.deprecate||u.deprecated;if(F)this.deprecateOption(D,F);let C=u.demand||u.required||u.require;if(C)this.demand(D,C);if(u.demandOption)this.demandOption(D,typeof u.demandOption==="string"?u.demandOption:void 0);if(u.conflicts)this.conflicts(D,u.conflicts);if("default"in u)this.default(D,u.default);if(u.implies!==void 0)this.implies(D,u.implies);if(u.nargs!==void 0)this.nargs(D,u.nargs);if(u.config)this.config(D,u.configParser);if(u.normalize)this.normalize(D);if(u.choices)this.choices(D,u.choices);if(u.coerce)this.coerce(D,u.coerce);if(u.group)this.group(D,u.group);if(u.boolean||u.type==="boolean"){if(this.boolean(D),u.alias)this.boolean(u.alias)}if(u.array||u.type==="array"){if(this.array(D),u.alias)this.array(u.alias)}if(u.number||u.type==="number"){if(this.number(D),u.alias)this.number(u.alias)}if(u.string||u.type==="string"){if(this.string(D),u.alias)this.string(u.alias)}if(u.count||u.type==="count")this.count(D);if(typeof u.global==="boolean")this.global(D,u.global);if(u.defaultDescription)z(this,N,"f").defaultDescription[D]=u.defaultDescription;if(u.skipValidation)this.skipValidation(D);let E=u.describe||u.description||u.desc,B=z(this,w,"f").getDescriptions();if(!Object.prototype.hasOwnProperty.call(B,D)||typeof E==="string")this.describe(D,E);if(u.hidden)this.hide(D);if(u.requiresArg)this.requiresArg(D)}return this}options(D,u){return this.option(D,u)}parse(D,u,F){if(L("[string|array] [function|boolean|object] [function]",[D,u,F],arguments.length),this[g0](),typeof D>"u")D=z(this,mD,"f");if(typeof u==="object")K(this,lD,u,"f"),u=F;if(typeof u==="function")K(this,OD,u,"f"),u=!1;if(!u)K(this,mD,D,"f");if(z(this,OD,"f"))K(this,UD,!1,"f");let C=this[Ou](D,!!u),E=this.parsed;if(z(this,GD,"f").setParsed(this.parsed),l(C))return C.then((B)=>{if(z(this,OD,"f"))z(this,OD,"f").call(this,z(this,wD,"f"),B,z(this,$D,"f"));return B}).catch((B)=>{if(z(this,OD,"f"))z(this,OD,"f")(B,this.parsed.argv,z(this,$D,"f"));throw B}).finally(()=>{this[VF](),this.parsed=E});else{if(z(this,OD,"f"))z(this,OD,"f").call(this,z(this,wD,"f"),C,z(this,$D,"f"));this[VF](),this.parsed=E}return C}parseAsync(D,u,F){let C=this.parse(D,u,F);return!l(C)?Promise.resolve(C):C}parseSync(D,u,F){let C=this.parse(D,u,F);if(l(C))throw new a(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return C}parserConfiguration(D){return L("<object>",[D],arguments.length),K(this,mu,D,"f"),this}pkgConf(D,u){L("<string> [string]",[D,u],arguments.length);let F=null,C=this[qF](u||z(this,yD,"f"));if(C[D]&&typeof C[D]==="object")F=Su(C[D],u||z(this,yD,"f"),this[aD]()["deep-merge-config"]||!1,z(this,b,"f")),z(this,N,"f").configObjects=(z(this,N,"f").configObjects||[]).concat(F);return this}positional(D,u){L("<string> <object>",[D,u],arguments.length);let F=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];u=bD(u,(B,$)=>{if(B==="type"&&!["string","number","boolean"].includes($))return!1;return F.includes(B)});let C=z(this,qu,"f").fullCommands[z(this,qu,"f").fullCommands.length-1],E=C?z(this,e,"f").cmdToParseOptions(C):{array:[],alias:{},default:{},demand:{}};return Eu(E).forEach((B)=>{let $=E[B];if(Array.isArray($)){if($.indexOf(D)!==-1)u[B]=!0}else if($[D]&&!(B in u))u[B]=$[D]}),this.group(D,z(this,w,"f").getPositionalGroupName()),this.option(D,u)}recommendCommands(D=!0){return L("[boolean]",[D],arguments.length),K(this,vu,D,"f"),this}required(D,u,F){return this.demand(D,u,F)}require(D,u,F){return this.demand(D,u,F)}requiresArg(D){if(L("<array|string|object> [number]",[D],arguments.length),typeof D==="string"&&z(this,N,"f").narg[D])return this;else this[zu](this.requiresArg.bind(this),"narg",D,NaN);return this}showCompletionScript(D,u){return L("[string] [string]",[D,u],arguments.length),D=D||this.$0,z(this,gD,"f").log(z(this,GD,"f").generateCompletionScript(D,u||z(this,YD,"f")||"completion")),this}showHelp(D){if(L("[string|function]",[D],arguments.length),K(this,qD,!0,"f"),!z(this,w,"f").hasCachedHelpMessage()){if(!this.parsed){let F=this[Ou](z(this,mD,"f"),void 0,void 0,0,!0);if(l(F))return F.then(()=>{z(this,w,"f").showHelp(D)}),this}let u=z(this,e,"f").runDefaultBuilderOn(this);if(l(u))return u.then(()=>{z(this,w,"f").showHelp(D)}),this}return z(this,w,"f").showHelp(D),this}scriptName(D){return this.customScriptName=!0,this.$0=D,this}showHelpOnFail(D,u){return L("[boolean|string] [string]",[D,u],arguments.length),z(this,w,"f").showHelpOnFail(D,u),this}showVersion(D){return L("[string|function]",[D],arguments.length),z(this,w,"f").showVersion(D),this}skipValidation(D){return L("<array|string>",[D],arguments.length),this[vD]("skipValidation",D),this}strict(D){return L("[boolean]",[D],arguments.length),K(this,oD,D!==!1,"f"),this}strictCommands(D){return L("[boolean]",[D],arguments.length),K(this,sD,D!==!1,"f"),this}strictOptions(D){return L("[boolean]",[D],arguments.length),K(this,rD,D!==!1,"f"),this}string(D){return L("<array|string>",[D],arguments.length),this[vD]("string",D),this[Du](D),this}terminalWidth(){return L([],0),z(this,b,"f").process.stdColumns}updateLocale(D){return this.updateStrings(D)}updateStrings(D){return L("<object>",[D],arguments.length),K(this,iD,!1,"f"),z(this,b,"f").y18n.updateLocale(D),this}usage(D,u,F,C){if(L("<string|null|undefined> [string|boolean] [function|object] [function]",[D,u,F,C],arguments.length),u!==void 0)if(MD(D,null,z(this,b,"f")),(D||"").match(/^\$0( |$)/))return this.command(D,u,F,C);else throw new a(".usage() description must start with $0 if being used as alias for .command()");else return z(this,w,"f").usage(D),this}usageConfiguration(D){return L("<object>",[D],arguments.length),K(this,cu,D,"f"),this}version(D,u,F){if(L("[boolean|string] [string] [string]",[D,u,F],arguments.length),z(this,_D,"f"))this[JF](z(this,_D,"f")),z(this,w,"f").version(void 0),K(this,_D,null,"f");if(arguments.length===0)F=this[o0](),D="version";else if(arguments.length===1){if(D===!1)return this;F=D,D="version"}else if(arguments.length===2)F=u,u=void 0;return K(this,_D,typeof D==="string"?D:"version","f"),u=u||z(this,w,"f").deferY18nLookup("Show version number"),z(this,w,"f").version(F||void 0),this.boolean(z(this,_D,"f")),this.describe(z(this,_D,"f"),u),this}wrap(D){return L("<number|null|undefined>",[D],arguments.length),z(this,w,"f").wrap(D),this}[(e=new WeakMap,yD=new WeakMap,qu=new WeakMap,GD=new WeakMap,YD=new WeakMap,Pu=new WeakMap,wD=new WeakMap,iD=new WeakMap,xu=new WeakMap,UD=new WeakMap,bu=new WeakMap,WD=new WeakMap,jD=new WeakMap,qD=new WeakMap,VD=new WeakMap,hu=new WeakMap,gD=new WeakMap,$D=new WeakMap,N=new WeakMap,wu=new WeakMap,mu=new WeakMap,OD=new WeakMap,lD=new WeakMap,$u=new WeakMap,nD=new WeakMap,mD=new WeakMap,vu=new WeakMap,b=new WeakMap,oD=new WeakMap,sD=new WeakMap,rD=new WeakMap,w=new WeakMap,cu=new WeakMap,_D=new WeakMap,o=new WeakMap,k0)](D){if(!D._||!D["--"])return D;D._.push.apply(D._,D["--"]);try{delete D["--"]}catch(u){}return D}[y0](){return{log:(...D)=>{if(!this[du]())console.log(...D);if(K(this,qD,!0,"f"),z(this,$D,"f").length)K(this,$D,z(this,$D,"f")+`
80
+ `,"f");K(this,$D,z(this,$D,"f")+D.join(" "),"f")},error:(...D)=>{if(!this[du]())console.error(...D);if(K(this,qD,!0,"f"),z(this,$D,"f").length)K(this,$D,z(this,$D,"f")+`
81
+ `,"f");K(this,$D,z(this,$D,"f")+D.join(" "),"f")}}}[JF](D){Eu(z(this,N,"f")).forEach((u)=>{if(((C)=>C==="configObjects")(u))return;let F=z(this,N,"f")[u];if(Array.isArray(F)){if(F.includes(D))F.splice(F.indexOf(D),1)}else if(typeof F==="object")delete F[D]}),delete z(this,w,"f").getDescriptions()[D]}[i0](D,u,F){if(!z(this,xu,"f")[F])z(this,b,"f").process.emitWarning(D,u),z(this,xu,"f")[F]=!0}[g0](){z(this,bu,"f").push({options:z(this,N,"f"),configObjects:z(this,N,"f").configObjects.slice(0),exitProcess:z(this,UD,"f"),groups:z(this,jD,"f"),strict:z(this,oD,"f"),strictCommands:z(this,sD,"f"),strictOptions:z(this,rD,"f"),completionCommand:z(this,YD,"f"),output:z(this,$D,"f"),exitError:z(this,wD,"f"),hasOutput:z(this,qD,"f"),parsed:this.parsed,parseFn:z(this,OD,"f"),parseContext:z(this,lD,"f")}),z(this,w,"f").freeze(),z(this,o,"f").freeze(),z(this,e,"f").freeze(),z(this,WD,"f").freeze()}[l0](){let D="",u;if(/\b(node|iojs|electron)(\.exe)?$/.test(z(this,b,"f").process.argv()[0]))u=z(this,b,"f").process.argv().slice(1,2);else u=z(this,b,"f").process.argv().slice(0,1);if(D=u.map((F)=>{let C=this[$2](z(this,yD,"f"),F);return F.match(/^(\/|([a-zA-Z]:)?\\)/)&&C.length<F.length?C:F}).join(" ").trim(),z(this,b,"f").getEnv("_")&&z(this,b,"f").getProcessArgvBin()===z(this,b,"f").getEnv("_"))D=z(this,b,"f").getEnv("_").replace(`${z(this,b,"f").path.dirname(z(this,b,"f").process.execPath())}/`,"");return D}[aD](){return z(this,mu,"f")}[n0](){return z(this,cu,"f")}[YF](){if(!z(this,iD,"f"))return;let D=z(this,b,"f").getEnv("LC_ALL")||z(this,b,"f").getEnv("LC_MESSAGES")||z(this,b,"f").getEnv("LANG")||z(this,b,"f").getEnv("LANGUAGE")||"en_US";this.locale(D.replace(/[.:].*/,""))}[o0](){return this[qF]().version||"unknown"}[s0](D){let u=D["--"]?D["--"]:D._;for(let F=0,C;(C=u[F])!==void 0;F++)if(z(this,b,"f").Parser.looksLikeNumber(C)&&Number.isSafeInteger(Math.floor(parseFloat(`${C}`))))u[F]=Number(C);return D}[qF](D){let u=D||"*";if(z(this,$u,"f")[u])return z(this,$u,"f")[u];let F={};try{let C=D||z(this,b,"f").mainFilename;if(z(this,b,"f").path.extname(C))C=z(this,b,"f").path.dirname(C);let E=z(this,b,"f").findUp(C,(B,$)=>{if($.includes("package.json"))return"package.json";else return});MD(E,void 0,z(this,b,"f")),F=JSON.parse(z(this,b,"f").readFileSync(E,"utf8"))}catch(C){}return z(this,$u,"f")[u]=F||{},z(this,$u,"f")[u]}[vD](D,u){u=[].concat(u),u.forEach((F)=>{F=this[UF](F),z(this,N,"f")[D].push(F)})}[zu](D,u,F,C){this[HF](D,u,F,C,(E,B,$)=>{z(this,N,"f")[E][B]=$})}[OF](D,u,F,C){this[HF](D,u,F,C,(E,B,$)=>{z(this,N,"f")[E][B]=(z(this,N,"f")[E][B]||[]).concat($)})}[HF](D,u,F,C,E){if(Array.isArray(F))F.forEach((B)=>{D(B,C)});else if(((B)=>typeof B==="object")(F))for(let B of Eu(F))D(B,F[B]);else E(u,this[UF](F),C)}[UF](D){if(D==="__proto__")return"___proto___";return D}[WF](D,u){return this[zu](this[WF].bind(this),"key",D,u),this}[VF](){var D,u,F,C,E,B,$,Z,M,O,V,Y;let q=z(this,bu,"f").pop();MD(q,void 0,z(this,b,"f"));let H;D=this,u=this,F=this,C=this,E=this,B=this,$=this,Z=this,M=this,O=this,V=this,Y=this,{options:{set value(W){K(D,N,W,"f")}}.value,configObjects:H,exitProcess:{set value(W){K(u,UD,W,"f")}}.value,groups:{set value(W){K(F,jD,W,"f")}}.value,output:{set value(W){K(C,$D,W,"f")}}.value,exitError:{set value(W){K(E,wD,W,"f")}}.value,hasOutput:{set value(W){K(B,qD,W,"f")}}.value,parsed:this.parsed,strict:{set value(W){K($,oD,W,"f")}}.value,strictCommands:{set value(W){K(Z,sD,W,"f")}}.value,strictOptions:{set value(W){K(M,rD,W,"f")}}.value,completionCommand:{set value(W){K(O,YD,W,"f")}}.value,parseFn:{set value(W){K(V,OD,W,"f")}}.value,parseContext:{set value(W){K(Y,lD,W,"f")}}.value}=q,z(this,N,"f").configObjects=H,z(this,w,"f").unfreeze(),z(this,o,"f").unfreeze(),z(this,e,"f").unfreeze(),z(this,WD,"f").unfreeze()}[r0](D,u){return kD(u,(F)=>{return D(F),F})}getInternalMethods(){return{getCommandInstance:this[a0].bind(this),getContext:this[e0].bind(this),getHasOutput:this[D2].bind(this),getLoggerInstance:this[u2].bind(this),getParseContext:this[F2].bind(this),getParserConfiguration:this[aD].bind(this),getUsageConfiguration:this[n0].bind(this),getUsageInstance:this[C2].bind(this),getValidationInstance:this[E2].bind(this),hasParseCallback:this[du].bind(this),isGlobalContext:this[B2].bind(this),postProcess:this[eD].bind(this),reset:this[TF].bind(this),runValidation:this[fF].bind(this),runYargsParserAndExecuteCommands:this[Ou].bind(this),setHasOutput:this[z2].bind(this)}}[a0](){return z(this,e,"f")}[e0](){return z(this,qu,"f")}[D2](){return z(this,qD,"f")}[u2](){return z(this,gD,"f")}[F2](){return z(this,lD,"f")||{}}[C2](){return z(this,w,"f")}[E2](){return z(this,o,"f")}[du](){return!!z(this,OD,"f")}[B2](){return z(this,hu,"f")}[eD](D,u,F,C){if(F)return D;if(l(D))return D;if(!u)D=this[k0](D);if(this[aD]()["parse-positional-numbers"]||this[aD]()["parse-positional-numbers"]===void 0)D=this[s0](D);if(C)D=tD(D,this,z(this,WD,"f").getMiddleware(),!1);return D}[TF](D={}){K(this,N,z(this,N,"f")||{},"f");let u={};u.local=z(this,N,"f").local||[],u.configObjects=z(this,N,"f").configObjects||[];let F={};u.local.forEach((B)=>{F[B]=!0,(D[B]||[]).forEach(($)=>{F[$]=!0})}),Object.assign(z(this,nD,"f"),Object.keys(z(this,jD,"f")).reduce((B,$)=>{let Z=z(this,jD,"f")[$].filter((M)=>!(M in F));if(Z.length>0)B[$]=Z;return B},{})),K(this,jD,{},"f");let C=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],E=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];if(C.forEach((B)=>{u[B]=(z(this,N,"f")[B]||[]).filter(($)=>!F[$])}),E.forEach((B)=>{u[B]=bD(z(this,N,"f")[B],($)=>!F[$])}),u.envPrefix=z(this,N,"f").envPrefix,K(this,N,u,"f"),K(this,w,z(this,w,"f")?z(this,w,"f").reset(F):b0(this,z(this,b,"f")),"f"),K(this,o,z(this,o,"f")?z(this,o,"f").reset(F):p0(this,z(this,w,"f"),z(this,b,"f")),"f"),K(this,e,z(this,e,"f")?z(this,e,"f").reset():S0(z(this,w,"f"),z(this,o,"f"),z(this,WD,"f"),z(this,b,"f")),"f"),!z(this,GD,"f"))K(this,GD,v0(this,z(this,w,"f"),z(this,e,"f"),z(this,b,"f")),"f");return z(this,WD,"f").reset(),K(this,YD,null,"f"),K(this,$D,"","f"),K(this,wD,null,"f"),K(this,qD,!1,"f"),this.parsed=!1,this}[$2](D,u){return z(this,b,"f").path.relative(D,u)}[Ou](D,u,F,C=0,E=!1){var B,$,Z,M;let O=!!F||E;D=D||z(this,mD,"f"),z(this,N,"f").__=z(this,b,"f").y18n.__,z(this,N,"f").configuration=this[aD]();let V=!!z(this,N,"f").configuration["populate--"],Y=Object.assign({},z(this,N,"f").configuration,{"populate--":!0}),q=z(this,b,"f").Parser.detailed(D,Object.assign({},z(this,N,"f"),{configuration:{"parse-positional-numbers":!1,...Y}})),H=Object.assign(q.argv,z(this,lD,"f")),W=void 0,J=q.aliases,S=!1,d=!1;if(Object.keys(H).forEach((v)=>{if(v===z(this,VD,"f")&&H[v])S=!0;else if(v===z(this,_D,"f")&&H[v])d=!0}),H.$0=this.$0,this.parsed=q,C===0)z(this,w,"f").clearCachedHelpMessage();try{if(this[YF](),u)return this[eD](H,V,!!F,!1);if(z(this,VD,"f")){if([z(this,VD,"f")].concat(J[z(this,VD,"f")]||[]).filter((uD)=>uD.length>1).includes(""+H._[H._.length-1]))H._.pop(),S=!0}K(this,hu,!1,"f");let v=z(this,e,"f").getCommands(),ZD=((B=z(this,GD,"f"))===null||B===void 0?void 0:B.completionKey)?[($=z(this,GD,"f"))===null||$===void 0?void 0:$.completionKey,...(M=this.getAliases()[(Z=z(this,GD,"f"))===null||Z===void 0?void 0:Z.completionKey])!==null&&M!==void 0?M:[]].some((g)=>Object.prototype.hasOwnProperty.call(H,g)):!1,m=S||ZD||E;if(H._.length){if(v.length){let g;for(let uD=C||0,s;H._[uD]!==void 0;uD++)if(s=String(H._[uD]),v.includes(s)&&s!==z(this,YD,"f")){let KD=z(this,e,"f").runCommand(s,this,q,uD+1,E,S||d||E);return this[eD](KD,V,!!F,!1)}else if(!g&&s!==z(this,YD,"f")){g=s;break}if(!z(this,e,"f").hasDefaultCommand()&&z(this,vu,"f")&&g&&!m)z(this,o,"f").recommendCommands(g,v)}if(z(this,YD,"f")&&H._.includes(z(this,YD,"f"))&&!ZD){if(z(this,UD,"f"))hD(!0);this.showCompletionScript(),this.exit(0)}}if(z(this,e,"f").hasDefaultCommand()&&!m){let g=z(this,e,"f").runCommand(null,this,q,0,E,S||d||E);return this[eD](g,V,!!F,!1)}if(ZD){if(z(this,UD,"f"))hD(!0);D=[].concat(D);let g=D.slice(D.indexOf(`--${z(this,GD,"f").completionKey}`)+1);return z(this,GD,"f").getCompletion(g,(uD,s)=>{if(uD)throw new a(uD.message);(s||[]).forEach((KD)=>{z(this,gD,"f").log(KD)}),this.exit(0)}),this[eD](H,!V,!!F,!1)}if(!z(this,qD,"f")){if(S){if(z(this,UD,"f"))hD(!0);O=!0,this.showHelp((g)=>{z(this,gD,"f").log(g),this.exit(0)})}else if(d){if(z(this,UD,"f"))hD(!0);O=!0,z(this,w,"f").showVersion("log"),this.exit(0)}}if(!O&&z(this,N,"f").skipValidation.length>0)O=Object.keys(H).some((g)=>z(this,N,"f").skipValidation.indexOf(g)>=0&&H[g]===!0);if(!O){if(q.error)throw new a(q.error.message);if(!ZD){let g=this[fF](J,{},q.error);if(!F)W=tD(H,this,z(this,WD,"f").getMiddleware(),!0);if(W=this[r0](g,W!==null&&W!==void 0?W:H),l(W)&&!F)W=W.then(()=>{return tD(H,this,z(this,WD,"f").getMiddleware(),!1)})}}}catch(v){if(v instanceof a)z(this,w,"f").fail(v.message,v);else throw v}return this[eD](W!==null&&W!==void 0?W:H,V,!!F,!0)}[fF](D,u,F,C){let E={...this.getDemandedOptions()};return(B)=>{if(F)throw new a(F.message);z(this,o,"f").nonOptionCount(B),z(this,o,"f").requiredArguments(B,E);let $=!1;if(z(this,sD,"f"))$=z(this,o,"f").unknownCommands(B);if(z(this,oD,"f")&&!$)z(this,o,"f").unknownArguments(B,D,u,!!C);else if(z(this,rD,"f"))z(this,o,"f").unknownArguments(B,D,{},!1,!1);z(this,o,"f").limitedChoices(B),z(this,o,"f").implications(B),z(this,o,"f").conflicting(B)}}[z2](){K(this,qD,!0,"f")}[Du](D){if(typeof D==="string")z(this,N,"f").key[D]=!0;else for(let u of D)z(this,N,"f").key[u]=!0}}function P0(D){return!!D&&typeof D.getInternalMethods==="function"}var v3=Z2(K0),X2=v3;var M2={name:"@coryrylan/cradle",version:"1.1.0",description:"A runtime for portable agents defined as folders \u2014 launches the pi coding agent configured from an agent folder, sandboxed with nono",main:"./dist/index.js",module:"./dist/index.js",types:"./dist/index.d.ts",type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},bin:{cradle:"dist/index.js"},files:["README.md","CHANGELOG.md","LICENSE","package.json","dist/index.js","dist/**/*.d.ts","!dist/**/*.test.d.ts"],repository:{type:"git",url:"git+https://github.com/coryrylan/cradle.git",directory:"projects/cli"},keywords:["pi","agents","agent-folders","sandbox","nono","cli","bun"],author:"Cory Rylan (https://coryrylan.com)",license:"MIT",bugs:{url:"https://github.com/coryrylan/cradle/issues"},homepage:"https://github.com/coryrylan/cradle/tree/main/projects/cli#readme",engines:{bun:">=1.3.0"},publishConfig:{access:"public"},scripts:{start:"wireit",ci:"wireit","ci:nocache":"bun run clean && bun run ci",clean:"rm -rf dist",test:"wireit","test:coverage":"wireit",lint:"wireit",build:"wireit","install:local":"wireit","uninstall:local":"wireit",release:"wireit"},wireit:{start:{command:"bun src/index.ts",cache:!1},ci:{dependencies:["lint","build","test:coverage"]},test:{command:"bun test",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},"test:coverage":{command:"bun test --coverage",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},lint:{command:"eslint .",files:["src/**/*.ts","eslint.config.js","package.json"],output:[]},build:{dependencies:["build:js","build:tsc","build:darwin-arm64","build:darwin-x64","build:linux-x64","build:linux-arm64","build:windows-x64"]},"build:js":{command:"bun build ./src/index.ts --outdir=./dist --target=bun --format=esm --minify",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/index.js"]},"build:tsc":{command:"tsc --emitDeclarationOnly --project tsconfig.types.json",files:["src/**/*.ts","src/**/*.json","tsconfig.json","tsconfig.types.json"],output:["dist/**/*.d.ts"]},"build:darwin-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-arm64 --outfile dist/cradle-macos-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-arm64"]},"build:darwin-x64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-x64 --outfile dist/cradle-macos-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-x64"]},"build:linux-x64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-x64 --outfile dist/cradle-linux-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-x64"]},"build:linux-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-arm64 --outfile dist/cradle-linux-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-arm64"]},"build:windows-x64":{command:"bun build --compile --minify src/index.ts --target=bun-windows-x64 --outfile dist/cradle-windows-x64.exe",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-windows-x64.exe"]},"install:local":{dependencies:["build"],command:"bash install.sh",cache:!1},"uninstall:local":{command:'rm -f "$HOME/.local/bin/cradle"',cache:!1},release:{command:"HUSKY=0 bun x semantic-release",dependencies:["ci"]}},dependencies:{yargs:"^18.0.0"},devDependencies:{"@coryrylan/tools":"1.1.0","@eslint/js":"catalog:","@eslint/json":"1.2.0","@types/bun":"catalog:","@types/yargs":"17.0.35",eslint:"catalog:","eslint-plugin-jsdoc":"63.2.0",typescript:"catalog:","typescript-eslint":"catalog:"}};import{join as J2}from"path";var pu="agent-browser-nono-fallback.ts";function G2(){return`// generated by cradle for sandboxed agent-browser processes \u2014 do not edit
84
82
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
85
83
 
86
- const providers = ${D} as const;
84
+ export default function configureAgentBrowserNonoEnvironment(_pi: ExtensionAPI): void {
85
+ if (process.platform === 'darwin') {
86
+ const agentBrowserArgs = (process.env.AGENT_BROWSER_ARGS ?? '')
87
+ .split(/[,\\n]/)
88
+ .map(value => value.trim())
89
+ .filter(value => value !== '' && value !== '--no-sandbox');
90
+ process.env.AGENT_BROWSER_ARGS = [...agentBrowserArgs, '--no-sandbox'].join(',');
91
+ }
92
+
93
+ const nonoProxy = process.env.HTTPS_PROXY ?? process.env.HTTP_PROXY;
94
+ if (process.env.AGENT_BROWSER_PROXY === undefined && nonoProxy !== undefined) {
95
+ process.env.AGENT_BROWSER_PROXY = nonoProxy;
96
+ }
97
+ }
98
+ `}function d3(D){let u=[];if(D.systemFilePath!==null)u.push("--system-prompt",D.systemFilePath);if(D.appendSystemFilePath!==null)u.push("--append-system-prompt",D.appendSystemFilePath);return u}function p3(D){let{folder:u}=D,{settings:F}=u,C=[D.piBin,...d3(u),"--no-extensions","--no-skills","--no-prompt-templates"];if(u.providersJson!==null)C.push("-e",J2(D.extensionsDir,"providers.ts"));if(D.backend==="nono")C.push("-e",J2(D.extensionsDir,pu));for(let E of D.packageEntries??[])C.push("-e",E);for(let E of u.extensionFiles)C.push("-e",E);if(u.skillsDir!==null)C.push("--skill",u.skillsDir);if(F.defaultProvider!==void 0)C.push("--provider",F.defaultProvider);if(F.defaultModel!==void 0)C.push("--model",F.defaultModel);if(F.defaultThinkingLevel!==void 0)C.push("--thinking",F.defaultThinkingLevel);return C.push("--session-dir",D.sessionsDir),C.push(...D.passthrough),C}function IF(D){return D.backend==="nono"?{MISE_CACHE_DIR:D.miseCacheDir}:{}}function Zu(D){let u=p3(D);if(D.backend!=="nono")return u;return[D.nonoBin,"run",...D.verbose===!0?[]:["--silent"],"--profile",D.profilePath,"--",...u]}import{existsSync as t3}from"fs";import{homedir as k3}from"os";import{join as y3}from"path";function i3(D,u=k3()){let F=y3(u,".local","share","mise","shims",D);return t3(F)?F:null}var Y2=(D)=>Bun.which(D)??i3(D);function LF(D,u=Y2){return u(D)}function tu(D,u=Y2){let F=LF(D,u);if(!F)throw Error(`Required executable "${D}" not found on PATH \u2014 install it, then run \`cradle doctor\` to verify`);return F}var g3="recommended: the supported way to install pi/nono \u2014 cradle resolves them from mise shims and the sandbox profile assumes a mise-managed install",l3="required for sandboxed runs (a folder declaring sandbox/nono.json, or --sandbox/--offline/--allow-host); not needed otherwise",n3="required for sbx-backend runs (a folder declaring sandbox/sbx.json, or --sandbox-backend sbx); not needed otherwise";async function q2(D={}){let u=(Y)=>LF(Y,D.which),F=async(Y,q)=>Y!==null&&D.readVersion?D.readVersion(Y,q):null,C=u("pi"),E=u("nono"),B=u("sbx"),$=u("mise"),[Z,M,O,V]=await Promise.all([F(C),F(E),F(B,["version"]),F($)]);return[{name:"pi",bin:"pi",required:!0,found:C,version:Z},{name:"nono",bin:"nono",required:!1,found:E,version:M,...E?{}:{note:l3}},{name:"sbx",bin:"sbx",required:!1,found:B,version:O,...B?{}:{note:n3}},{name:"mise",bin:"mise",required:!1,found:$,version:V,...$?{}:{note:g3}}]}function o3(D){let u=D.found?`\u2713 ${D.name.padEnd(8)} ${D.version??"?"} ${D.found}`:D.required?`\u2717 ${D.name.padEnd(8)} MISSING (required)`:`\u25CB ${D.name.padEnd(8)} not found (recommended)`;return D.note?`${u}
99
+ \u26A0 ${D.note}`:u}function O2(D){return D.map(o3).join(`
100
+ `)}function H2(D){return D.some((u)=>u.required&&!u.found)?1:0}import{exists as V6,mkdir as SF,rm as T6,writeFile as z8}from"fs/promises";import{homedir as f6}from"os";import{basename as I6,dirname as L6,join as fu}from"path";import{stat as G1}from"fs/promises";import{join as _2,resolve as J1}from"path";import{basename as r3,isAbsolute as a3,join as e3,relative as D1}from"path";var Hu={extends:"default",meta:{name:"cradle-pi"},groups:{include:["node_runtime","git_config","unlink_protection"]},filesystem:{read:["$HOME/.agents","$HOME/.local/share/mise","$HOME/.config/mise","$HOME/.local/state/mise","$HOME/.config/gh","/System/iOSSupport/System/Library/ExtensionKit/Extensions","/System/Library/AssetsV2/com_apple_MobileAsset_TTSAXResourceModelAssets","/System/Library/AssetsV2/com_apple_MobileAsset_UAF_Siri_TextToSpeech"],allow:["$HOME/.pi/agent"]},unsafe_macos_seatbelt_rules:['(allow user-preference-read (preference-domain "kCFPreferencesAnyApplication") (preference-domain "com.apple.speech.voice.prefs") (preference-domain "com.apple.speakselection") (preference-domain "com.apple.assistant.backedup") (preference-domain "com.apple.assistant.support") (preference-domain "com.apple.accessibility"))']};var U2="nono-profile.json";function ku(D,u){let F=D1(D,u);return F===""||!F.startsWith("..")&&!a3(F)}function W2(D,u){let F=e3(u,".local","state","nono");return ku(D,F)||ku(F,D)?D:void 0}function Uu(D,u){if(D==="~"||D==="$HOME")return u;if(D.startsWith("~/"))return`${u}${D.slice(1)}`;if(D.startsWith("$HOME/"))return`${u}${D.slice(5)}`;return D}function V2(D){let u=($)=>Uu($,D.home),F=Hu.filesystem,C=D.network!==void 0?u1(D.network):void 0,E=[...F.unix_socket_dir_bind??[],...D.grants.unixSocketDirBind.map(u)],B={...Hu,meta:{...Hu.meta,name:`cradle-${r3(D.stateDir)}`},filesystem:{...F,read:[...F.read??[],D.agentDir,...D.grants.read.map(u)],write:[...F.write??[],...D.grants.write.map(u)],allow:[...F.allow??[],D.cwd,D.stateDir,...D.linkedGitDir!==void 0?[D.linkedGitDir]:[],...D.grants.allow.map(u)],...E.length>0?{unix_socket_dir_bind:E}:{}},unsafe_macos_seatbelt_rules:[...Hu.unsafe_macos_seatbelt_rules,...D.rules],...C!==void 0?{network:C}:{}};return JSON.stringify(B,null,2)}function u1(D){return{...D.block!==void 0?{block:D.block}:{},...D.networkProfile!==void 0?{network_profile:D.networkProfile}:{},...D.allowDomain!==void 0?{allow_domain:D.allowDomain}:{},...D.openPort!==void 0?{open_port:D.openPort}:{},...D.listenPort!==void 0?{listen_port:D.listenPort}:{}}}import{chmod as T2,lstat as F1,mkdir as C1,readdir as f2,readFile as E1,rm as B1,writeFile as $1}from"fs/promises";import{dirname as z1,join as iu,relative as Z1}from"path";function QD(D){return typeof D==="object"&&D!==null&&!Array.isArray(D)}function Qu(D,u){try{return JSON.parse(D)}catch(F){throw Error(`${u} is not valid JSON: ${uu(F)}`,{cause:F})}}function uu(D){return D instanceof Error?D.message:String(D)}function ID(D,u){return typeof D==="object"&&D!==null&&"code"in D&&D.code===u}function Xu(D){if(/^[A-Za-z0-9_./:@%+=,-]+$/u.test(D))return D;return`'${D.replaceAll("'","'\\''")}'`}function cD(D){return Array.isArray(D)&&D.every((u)=>typeof u==="string")}function Wu(D){return/^(?:\/|~(?:\/|$)|\$HOME(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/.test(D)}function RD(D,u,F,C){let E=Object.keys(D).filter((B)=>!F.includes(B));if(E.length>0)C.push(`${u}: unsupported keys ignored: ${E.join(", ")}`)}function yu(D,u,F,C){D.results.push({name:u,detail:F,status:C})}function Q1(D,u,F){D.failures.push(`${u}: ${F}`),yu(D,u,F,"failed")}async function I2(D,u,F,C){try{if(await M1(F,C)){yu(D,u,F,"unchanged");return}if(D.dryRun){yu(D,u,`would replace ${F}`,"changed");return}await K2(F),await B1(F,{force:!0,recursive:!0});for(let E of C)await X1(F,E);yu(D,u,F,"changed")}catch(E){Q1(D,u,uu(E))}}async function X1(D,u){let F=iu(D,u.rel);if(await C1(z1(F),{recursive:!0}),await $1(F,u.content,"utf8"),u.mode!==void 0)await T2(F,u.mode)}async function M1(D,u){let F=await L2(D);if(F.length!==u.length)return!1;let C=new Set(F);for(let E of u){if(!C.has(E.rel))return!1;if(await SD(iu(D,E.rel))!==E.content)return!1}return!0}async function L2(D,u=D){let F=await j2(D);if(!F||!F.isDirectory())return[];let C=[];for(let E of await f2(D,{withFileTypes:!0})){let B=iu(D,E.name);if(E.isDirectory())C.push(...await L2(B,u));else C.push(Z1(u,B))}return C}async function K2(D){let u=await j2(D);if(!u||u.isSymbolicLink())return;if(await T2(D,u.isDirectory()?493:420),!u.isDirectory())return;let F=await f2(D);await Promise.all(F.map((C)=>K2(iu(D,C))))}async function SD(D){try{return await E1(D,"utf8")}catch(u){if(ID(u,"ENOENT"))return;throw u}}async function j2(D){try{return await F1(D)}catch(u){if(ID(u,"ENOENT"))return;throw u}}var Y1=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function N2(D,u){if(!q1(D))return{dir:D,warnings:[]};let F=_2(u.home,".cradle","settings.json"),C=[],E=await O1(F,C),B=_2(u.cwd,D),$=E.get(D);if($!==void 0){let Z=J1(Uu($,u.home));if(await R2(B))C.push(W1(D,Z));return{dir:Z,warnings:C}}if(await R2(B))return{dir:B,warnings:C};throw Error(V1(D,B,F,E))}function q1(D){return Y1.test(D)}async function R2(D){try{return(await G1(D)).isDirectory()}catch(u){if(ID(u,"ENOENT")||ID(u,"ENOTDIR"))return!1;throw u}}async function O1(D,u){let F=await SD(D);if(F===void 0)return new Map;let C=Qu(F,D);if(!QD(C))return u.push(`${D}: settings must be a JSON object \u2014 ignored`),new Map;return RD(C,D,["agents"],u),H1(C,D,u)}function H1(D,u,F){let C=D.agents;if(C===void 0)return new Map;if(!QD(C))return F.push(`${u}: agents must be an object \u2014 ignored`),new Map;let E=Object.entries(C).map((B)=>{let[$,Z]=B,M=U1(Z,$,u,F);return M===void 0?void 0:[$,M]}).filter((B)=>B!==void 0);return new Map(E)}function U1(D,u,F,C){if(!QD(D)){C.push(`${F}: agents.${u} must be an object with a "path" \u2014 ignored`);return}let E=D.path;if(typeof E!=="string"||E.trim()===""){C.push(`${F}: agents.${u}.path must be a non-empty string \u2014 ignored`);return}if(!Wu(E)){C.push(`${F}: agents.${u}.path must be an absolute, ~/, or $HOME/ path \u2014 ignored: ${E}`);return}return E}function W1(D,u){return`started alias "${D}" (${u}) \u2014 a directory named ${D} exists in the current directory; use ./${D} to run it instead`}function V1(D,u,F,C){let E=C.size>0?` (known agents: ${[...C.keys()].join(", ")})`:"";return`Agent folder not found: ${u} \u2014 and no "agents.${D}" entry in ${F}${E}`}import{createHash as T1}from"crypto";import{join as f1}from"path";var S2="host.docker.internal",A2="@earendil-works/pi-coding-agent",I1=/^\d+\.\d+\.\d+\.\d+$/,L1=new Set(["localhost","127.0.0.1"]);function P2(D){let u=(C)=>Uu(C,D.home),F=[{path:D.cwd,readonly:!1},{path:D.agentDir,readonly:!0},{path:D.stateDir,readonly:!1},{path:f1(D.home,".pi","agent"),readonly:!1},...D.linkedGitDir!==void 0?[{path:D.linkedGitDir,readonly:!1}]:[],...D.grants.read.map((C)=>({path:u(C),readonly:!0})),...D.grants.write.map((C)=>({path:u(C),readonly:!1})),...D.grants.allow.map((C)=>({path:u(C),readonly:!1}))];return K1(F)}function K1(D){let u=[],F=new Map;for(let C of D){if(!F.has(C.path))u.push(C.path);if(F.get(C.path)!==!1)F.set(C.path,C.readonly)}return u.map((C)=>({path:C,readonly:F.get(C)===!0}))}function x2(D,u){let F=u.map((E)=>`${E.path}:${E.readonly?"ro":"rw"}`).sort().join("|"),C=T1("sha256").update(F).digest("hex").slice(0,8);return`cradle-${D}-${C}`}function b2(D){let u=D.mounts.map((F)=>F.readonly?`${F.path}:ro`:F.path);return[D.sbxBin,"create","shell",...u,"--name",D.name,"-q"]}function j1(D){let u=[],F=!1;for(let C of D)if(L1.has(C))F=!0;else if(I1.test(C))u.push(C);else u.push(C,`*.${C}`);if(F)u.push(S2);return u}function h2(D){let{network:u,sbxBin:F,name:C}=D;if(u===void 0)return[];if(u.block===!0)return[[F,"policy","deny","network","--sandbox",C,"**"]];let E=j1(u.allowDomain??[]);return E.length>0?[[F,"policy","allow","network","--sandbox",C,E.join(",")]]:[]}function _1(D){return D.networkProfile!==void 0?"network_profile is nono-only \u2014 ignored under the sbx backend":void 0}function R1(D){return(D.openPort?.length??0)>0||(D.listenPort?.length??0)>0?"open_port/listen_port are nono-only \u2014 guest-local ports are unrestricted and host services are reachable via host.docker.internal under sbx":void 0}function N1(D){return D.block!==!0&&(D.allowDomain?.length??0)>0?"sbx allow rules add to your global sbx policy but cannot subtract from it \u2014 run `sbx policy init deny-all` for strict allowlist semantics (nono enforces the allowlist exactly)":void 0}function w2(D){if(D===void 0)return[];return[_1(D),R1(D),N1(D)].filter((u)=>u!==void 0)}function m2(D){return D.unixSocketDirBind.length>0?["unix_socket_dir_bind is nono-only \u2014 Unix sockets cannot cross the sbx VM boundary; grant ignored"]:[]}function KF(D){let u=D.piVersion===null?`command -v pi >/dev/null 2>&1 || npm i -g ${A2}`:`command -v pi >/dev/null 2>&1 && [ "$(pi --version 2>/dev/null)" = "${D.piVersion}" ] || npm i -g ${A2}@${D.piVersion}`;return[D.sbxBin,"exec",D.name,"bash","-lc",u]}function gu(D,u){return[D.sbxBin,"exec","-i",...D.tty?["-t"]:[],"-e",`HOME=${D.home}`,"-w",D.cwd,D.name,...u]}function v2(D){return D.toLowerCase().includes("already exists")}function c2(D){let u;try{u=new URL(D)}catch{return D}if(u.hostname!=="localhost"&&u.hostname!=="127.0.0.1")return D;return u.hostname=S2,u.toString()}function d2(D,u={}){return`// generated by cradle from the agent folder's models.json \u2014 do not edit
101
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
102
+
103
+ const providers = ${u.rewriteLocalhostBaseUrls===!0?A1(D):D} as const;
87
104
 
88
105
  export default function (pi: ExtensionAPI): void {
89
106
  for (const [name, config] of Object.entries(providers)) {
90
107
  pi.registerProvider(name, config as never);
91
108
  }
92
109
  }
93
- `}import{lstat as G1,readdir as x2,stat as Q1}from"fs/promises";import{join as AD,resolve as J1}from"path";import{join as HF,resolve as e3,sep as L2}from"path";var D1=/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,u1=/^[0-9A-Za-z.^~><=* +-]+$/;function _2(D,u,F){let C=D.packages;if(C===void 0)return[];if(!cD(C))return F.push(`${u}: packages must be an array of strings \u2014 ignored`),[];let E=F1(C,u,F);return C1(E,u,F)}function F1(D,u,F){let C=D.filter((B)=>B.startsWith("npm:")),E=D.filter((B)=>!B.startsWith("npm:"));if(E.length>0)F.push(`${u}: only npm: package sources are supported \u2014 ignored: ${E.join(", ")}`);return C}function C1(D,u,F){let C=[],E=[];for(let B of D){let z=E1(B.slice(4));if(z===null)E.push(B);else C.push(z)}if(E.length>0)F.push(`${u}: packages entries must be npm:<name>[@<version>] \u2014 ignored: ${E.join(", ")}`);return C}function E1(D){let u=D.lastIndexOf("@"),F=u>0,C=F?D.slice(0,u):D,E=F?D.slice(u+1):"latest";if(!D1.test(C)||!u1.test(E))return null;return{name:C,version:E}}function K2(D){let u=Object.fromEntries([...D].sort((F,C)=>F.name.localeCompare(C.name)).map((F)=>[F.name,F.version]));return`${JSON.stringify({name:"cradle-agent-packages",private:!0,dependencies:u},null,2)}
94
- `}async function j2(D,u){let F=await Promise.all(u.map(async(C)=>{let E=[];return{entries:await B1(D,C,E),warnings:E}}));return{entries:F.flatMap((C)=>C.entries),warnings:F.flatMap((C)=>C.warnings)}}async function B1(D,u,F){let C=HF(D,"node_modules",u.name),E=await $1(u.name,C,F);if(E===null)return[];let B=z1(E);if(B===void 0)return Z1(u.name,C,F);let z=[];for(let X of B){let J=await X1(u.name,C,X,F);if(J!==null)z.push(J)}return z}async function $1(D,u,F){let C=HF(u,"package.json"),E=await RD(C);if(E===void 0)return F.push(`package ${D} is not installed \u2014 skipped`),null;try{let B=zu(E,C);if(!JD(B))return F.push(`package ${D}: ${C} must be a JSON object \u2014 skipped`),null;return B}catch(B){return F.push(`package ${D}: ${Du(B)} \u2014 skipped`),null}}function z1(D){let u=D.pi;if(u===void 0||!JD(u))return;let F=u.extensions;if(F===void 0||!cD(F))return;return F}async function Z1(D,u,F){let C=HF(u,"index.ts");if(await Bun.file(C).exists())return[C];return F.push(`package ${D} declares no pi extensions \u2014 skipped`),[]}async function X1(D,u,F,C){let E=e3(u,F),B=u.endsWith(L2)?u:`${u}${L2}`;if(E!==u&&!E.startsWith(B))return C.push(`package ${D}: extension entry "${F}" escapes the package directory \u2014 skipped`),null;if(!await Bun.file(E).exists())return C.push(`package ${D}: extension entry "${F}" not found \u2014 skipped`),null;return E}var N2=["off","minimal","low","medium","high","xhigh"],R2=new Set(["schedules","subagents","channels","connections"]),M1=new Set(["APPEND_SYSTEM.md","settings.json","models.json","skills","extensions","sandbox"]),O1=new Set([".git",".gitignore",".DS_Store","README.md","LICENSE"]),VF={read:[],write:[],allow:[]},WF={posture:"unconfigured",filesystem:VF,unsafeMacosSeatbeltRules:[]};async function P2(D){let u=J1(D),F=await Y1(u),C=new Map(F.map((B)=>[B.name,B]));if(!C.has("APPEND_SYSTEM.md")){let B=C.has("AGENTS.md")?" \u2014 found AGENTS.md, rename it to APPEND_SYSTEM.md":"";throw Error(`not an agent folder: ${u} (missing APPEND_SYSTEM.md${B} \u2014 see ARCHITECTURE.md)`)}let E=[];return f1(F,E),{dir:u,appendSystemFilePath:AD(u,"APPEND_SYSTEM.md"),settings:await U1(u,C.has("settings.json"),E),providersJson:await T1(u,C.has("models.json"),E),skillsDir:await I1(u,C.get("skills"),E),extensionFiles:await L1(u,C.get("extensions"),E),sandbox:await _1(u,C.get("sandbox"),E),warnings:E}}async function Y1(D){try{return await x2(D,{withFileTypes:!0})}catch(u){if(ID(u,"ENOENT")||ID(u,"ENOTDIR"))throw Error(`agent folder not found: ${D}`,{cause:u});throw u}}async function LF(D,u){if(u.isDirectory())return!0;if(!u.isSymbolicLink())return!1;try{return(await Q1(AD(D,u.name))).isDirectory()}catch(F){if(ID(F,"ENOENT"))return!1;throw F}}function f1(D,u){let F=D.filter((E)=>R2.has(E.name)).map((E)=>E.name),C=D.map((E)=>E.name).filter((E)=>!M1.has(E)&&!R2.has(E)&&!O1.has(E));if(F.length>0)u.push(`reserved for a future cradle release, ignored: ${F.join(", ")}`);if(C.length>0)u.push(`not part of the agent folder format, ignored: ${C.join(", ")}`)}async function U1(D,u,F){if(!u)return{};let C=AD(D,"settings.json"),E=await _F(C);H1(E,C,F);let B=IF(E,"defaultProvider",C,F),z=IF(E,"defaultModel",C,F),X=b1(E,C,F),J=_2(E,C,F),f=W1(E,C,F);return{...B!==void 0?{defaultProvider:B}:{},...z!==void 0?{defaultModel:z}:{},...X!==void 0?{defaultThinkingLevel:X}:{},...J.length>0?{packages:J}:{},...f!==void 0?{npmCommand:f}:{}}}var q1=new Set(["defaultProvider","defaultModel","defaultThinkingLevel","packages","npmCommand"]);function H1(D,u,F){let C=Object.keys(D).filter((E)=>!q1.has(E));if(C.length>0)F.push(`${u}: keys cradle does not map are ignored \u2014 pi reads them from ~/.pi/agent/settings.json or `+`the project's .pi/settings.json, not the agent folder: ${C.join(", ")}`)}var A2=new Set(["npm","pnpm","yarn","bun"]);function W1(D,u,F){let C=D.npmCommand;if(C===void 0)return;let[E,...B]=cD(C)?C:[];if(E===void 0||B.length>0||!A2.has(E)){let z=[...A2].join(", ");F.push(`${u}: npmCommand must be a single-element array naming one of ${z} \u2014 ignored`);return}return[E]}async function T1(D,u,F){if(!u)return null;let C=AD(D,"models.json"),E=await _F(C),B=E.providers;if(B===void 0||!JD(B))throw Error(`${C} must contain a "providers" object`);return uu(E,C,["providers"],F),JSON.stringify(V1(B),null,2)}function V1(D){let u={input:0,output:0,cacheRead:0,cacheWrite:0};return Object.fromEntries(Object.entries(D).map(([F,C])=>{if(!JD(C)||!Array.isArray(C.models))return[F,C];let E=C.models.map((B)=>JD(B)&&B.cost===void 0?{cost:u,...B}:B);return[F,{...C,models:E}]}))}async function I1(D,u,F){if(!u)return null;if(!await LF(D,u))return F.push("skills must be a directory \u2014 ignored"),null;return AD(D,"skills")}async function L1(D,u,F){if(!u)return[];if(!await LF(D,u))return F.push("extensions must be a directory \u2014 ignored"),[];let C=AD(D,"extensions"),E=await x2(C,{withFileTypes:!0});return(await Promise.all(E.sort((z,X)=>z.name.localeCompare(X.name)).map(async(z)=>{if(z.isFile()&&z.name.endsWith(".ts")&&!z.name.startsWith("."))return AD(C,z.name);if(z.isDirectory()){let X=AD(C,z.name,"index.ts");return await Bun.file(X).exists()?X:null}return null}))).filter((z)=>z!==null)}async function _1(D,u,F){if(!u)return WF;if(!await LF(D,u))return F.push("sandbox must be a directory \u2014 ignored"),WF;let C=AD(D,"sandbox","nono.json"),E=await K1(C);if(E===void 0)return F.push("sandbox/ has no nono.json \u2014 sandboxing stays off unless --sandbox is passed"),WF;let B=b2(E,"sandbox",C,F),z=R1(E,C,F);return N1(E,C,F),uu(E,C,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules","net"],F),{posture:B===!1?"disabled":"enabled",...z!==void 0?{network:z}:{},filesystem:x1(E.filesystem,C,F),unsafeMacosSeatbeltRules:S1(E.unsafe_macos_seatbelt_rules,C,F)}}async function K1(D){return await j1(D)?_F(D):void 0}async function j1(D){try{return await G1(D),!0}catch(u){if(ID(u,"ENOENT"))return!1;throw u}}function N1(D,u,F){if(D.net!==void 0)F.push(`${u}: "net" was removed \u2014 use "network" instead (see ARCHITECTURE.md) \u2014 ignored`)}function R1(D,u,F){let C=D.network;if(C===void 0)return;if(!JD(C)){F.push(`${u}: network must be an object \u2014 ignored`);return}let E=`${u} network`;uu(C,E,["block","network_profile","allow_domain","open_port","listen_port"],F);let B=b2(C,"block",E,F),z=IF(C,"network_profile",E,F),X=A1(C,"allow_domain",E,F),J=S2(C,"open_port",E,F),f=S2(C,"listen_port",E,F),W={...B!==void 0?{block:B}:{},...z!==void 0?{networkProfile:z}:{},...X.length>0?{allowDomain:X}:{},...J.length>0?{openPort:J}:{},...f.length>0?{listenPort:f}:{}};return Object.keys(W).length>0?W:void 0}function A1(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!cD(E))return C.push(`${F}: ${u} must be an array of strings \u2014 ignored`),[];let B=E.map((z)=>z.trim()).filter((z)=>z!=="");if(B.length!==E.length)C.push(`${F}: ${u} entries must be non-empty \u2014 blanks ignored`);return B}function S2(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!Array.isArray(E))return C.push(`${F}: ${u} must be an array of port numbers \u2014 ignored`),[];let B=(X)=>typeof X==="number"&&Number.isInteger(X)&&X>=0&&X<=65535,z=E.filter((X)=>!B(X));if(z.length>0)C.push(`${F}: ${u} entries must be integers 0\u201365535 \u2014 ignored: ${z.join(", ")}`);return E.filter(B)}function S1(D,u,F){if(D===void 0)return[];if(!cD(D))return F.push(`${u}: unsafe_macos_seatbelt_rules must be an array of strings \u2014 ignored`),[];let C=(B)=>{let z=B.trim();return z.startsWith("(")&&z.endsWith(")")},E=D.filter((B)=>!C(B));if(E.length>0)F.push(`${u}: unsafe_macos_seatbelt_rules entries must be parenthesized s-expressions \u2014 ignored: ${E.join(", ")}`);return D.filter(C).map((B)=>B.trim())}function b2(D,u,F,C){let E=D[u];if(E===void 0)return;if(typeof E!=="boolean"){C.push(`${F}: ${u} must be true or false \u2014 ignored`);return}return E}function x1(D,u,F){if(D===void 0)return VF;if(!JD(D))return F.push(`${u}: filesystem must be an object \u2014 ignored`),VF;return uu(D,`${u} filesystem`,["read","write","allow"],F),{read:TF(D,"read",u,F),write:TF(D,"write",u,F),allow:TF(D,"allow",u,F)}}function TF(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!cD(E))return C.push(`${F}: ${u} must be an array of strings \u2014 ignored`),[];let B=E.filter((z)=>!fu(z));if(B.length>0)C.push(`${F}: ${u} entries must be absolute, ~/, or $HOME/ paths \u2014 ignored: ${B.join(", ")}`);return E.filter(fu)}async function _F(D){let u=zu(await P1(D),D);if(!JD(u))throw Error(`${D} must be a JSON object`);return u}async function P1(D){let u;try{u=await RD(D)}catch(F){throw Error(`${D} could not be read: ${Du(F)}`,{cause:F})}if(u===void 0)throw Error(`${D} could not be read \u2014 broken symlink?`);return u}function IF(D,u,F,C){let E=D[u];if(E===void 0)return;if(typeof E!=="string"){C.push(`${F}: ${u} must be a string \u2014 ignored`);return}return E}function b1(D,u,F){let C=D.defaultThinkingLevel;if(C===void 0)return;if(typeof C!=="string"||!N2.includes(C)){F.push(`${u}: defaultThinkingLevel must be one of ${N2.join(", ")} \u2014 ignored`);return}return C}import{createHash as h1}from"crypto";import{homedir as w1}from"os";import{basename as m1,join as Uu}from"path";function c1(D){let u=m1(D).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),F=h1("sha256").update(D).digest("hex").slice(0,8);return`${u===""?"agent":u}-${F}`}function h2(D,u=w1(),F=process.env.CRADLE_STATE_DIR){let C=F||Uu(u,".cradle");return Uu(C,"agents",c1(D))}function w2(D){return{extensionsDir:Uu(D,"extensions"),sessionsDir:Uu(D,"sessions"),miseCacheDir:Uu(D,"mise-cache")}}import{readFile as v1}from"fs/promises";import{join as m2,resolve as c2}from"path";var v2="gitdir:";async function p2(D){try{return await v1(D,"utf8")}catch{return}}async function t2(D){let u=await p2(m2(D,".git"));if(u===void 0||!u.startsWith(v2))return;let F=c2(D,u.slice(v2.length).trim()),C=await p2(m2(F,"commondir")),E=C!==void 0?c2(F,C.trim()):F;return mu(D,E)?void 0:E}async function k2(D,u={}){let F=u.home??d1(),C=u.cwd??process.cwd(),{dir:E,warnings:B}=await V2(D.dir,{home:F,cwd:C}),z=await P2(E),X=h2(z.dir,F),{extensionsDir:J,sessionsDir:f,miseCacheDir:W}=w2(X),{sandbox:O,network:Y,warnings:q}=i1(D,z),H=[...B,...q],M=D.dryRun??!1,S=y1({folder:z,flags:D,sandbox:O,dryRun:M,stateDir:X,extensionsDir:J,sessionsDir:f,miseCacheDir:W,...u.which!==void 0?{which:u.which}:{}}),p=C6(z),m=O?await t2(C):void 0,BD=F6(O,z,Y,{home:F,cwd:C,stateDir:X,profilePath:S.profilePath,...m!==void 0?{linkedGitDir:m}:{}}),c=n1(z,X);return{files:p,extensionsDir:J,sessionsDir:f,warnings:H,profile:BD,packages:c,launch:S,dryRun:M}}function y1(D){let{folder:u,flags:F,sandbox:C,dryRun:E,stateDir:B,extensionsDir:z,sessionsDir:X,miseCacheDir:J,which:f}=D,{nonoBin:W,piBin:O}=u6(C,E,f),Y=qu(B,Q2);return{folder:u,stateDir:B,extensionsDir:z,sessionsDir:X,miseCacheDir:J,sandbox:C,passthrough:F.passthrough??[],nonoBin:W,piBin:O,profilePath:Y,...F.verbose?{verbose:!0}:{}}}function n1(D,u){let F=D.settings.packages;if(F===void 0||F.length===0)return null;return{npmDir:qu(u,"npm"),manifest:K2(F),specs:F,installCommand:[...D.settings.npmCommand??["npm"],"install","--ignore-scripts"]}}function i1(D,u){let{sandbox:F,warnings:C}=a1(D,u),E=[],B=o1(D,u,E);return{sandbox:F,network:B,warnings:s1(F,B,[...C,...E])}}function o1(D,u,F){if(D.offline)return{block:!0};let C=g1(D.allowHost??[],F);if(C.length>0)return{allowDomain:C};return u.sandbox.network}function g1(D,u){let F=D.map((C)=>C.trim()).filter((C)=>C!=="");if(F.length!==D.length)u.push("--allow-host entries must be non-empty \u2014 blanks ignored");return F}function l1(D){return D!==void 0&&(D.block===!0||(D.allowDomain?.length??0)>0)}function s1(D,u,F){if(D||!l1(u))return F;return[...F,"network policy has no effect without the sandbox \u2014 pi runs with no network isolation (--sandbox to enforce it)"]}function r1(D){return D.offline===!0||(D.allowHost?.length??0)>0}function a1(D,u){let F=D.noSandbox===void 0?void 0:!D.noSandbox;if(F!==void 0)return{sandbox:F,warnings:u.warnings};if(u.sandbox.posture==="enabled")return{sandbox:!0,warnings:u.warnings};let C=u.sandbox.posture==="disabled"?"sandbox disabled by sandbox/nono.json":"sandbox/nono.json not found";if(r1(D))return{sandbox:!0,warnings:[...u.warnings,`${C} \u2014 sandbox forced on to enforce the requested network policy (--no-sandbox to override)`]};return{sandbox:!1,warnings:[...u.warnings,`${C} \u2014 agent is running without OS isolation (--sandbox to force enable)`]}}async function y2(D,u={}){let F={dryRun:!1,results:[],failures:[]};if(await f2(F,"extensions",D.extensionsDir,D.files),F.failures.length>0)throw Error(`failed to write agent extensions: ${F.failures.join("; ")}`);if(await KF(D.sessionsDir,{recursive:!0}),D.profile!==null)await KF(k1(D.profile.path),{recursive:!0}),await d2(D.profile.path,D.profile.content,"utf8");let C={...D.launch,extensionsDir:D.extensionsDir,sessionsDir:D.sessionsDir};if(D.packages===null)return{argv:Ou(C),warnings:[]};return D6(D.packages,C,u)}async function e1(D,u){if(await RD(qu(D,"package.json"))!==u)return!1;return p1(qu(D,"node_modules"))}async function D6(D,u,F){if(await KF(D.npmDir,{recursive:!0}),!await e1(D.npmDir,D.manifest)){if(F.install===void 0)throw Error("packages declared but no installer provided");let B=qu(D.npmDir,"package.json");await d2(B,D.manifest,"utf8");try{await F.install(D.installCommand,D.npmDir)}catch(z){throw await t1(B,{force:!0}),z}}let{entries:C,warnings:E}=await j2(D.npmDir,D.specs);return{argv:Ou({...u,packageEntries:C}),warnings:E}}function u6(D,u,F){if(u)return{nonoBin:"nono",piBin:"pi"};let C=D?fF("nono",F):"nono",E=fF("pi",F);return{nonoBin:C,piBin:E}}function F6(D,u,F,C){if(!D)return null;let E=J2(C.cwd,C.home);if(E!==void 0)throw Error(`cannot sandbox from ${E} \u2014 this directory is (or contains) nono's protected state root `+"(~/.local/state/nono) and nono refuses to start with an overlapping grant; run `cradle start` from a project directory instead");let B=M2({home:C.home,cwd:C.cwd,agentDir:u.dir,stateDir:C.stateDir,grants:u.sandbox.filesystem,rules:u.sandbox.unsafeMacosSeatbeltRules,...F!==void 0?{network:F}:{},...C.linkedGitDir!==void 0?{linkedGitDir:C.linkedGitDir}:{}});return{path:C.profilePath,content:B}}function C6(D){if(D.providersJson===null)return[];return[{rel:"providers.ts",content:I2(D.providersJson)}]}function n2(D,u){return u?`\x1B[33m${D}\x1B[0m`:D}function i2(D,u){return()=>D.kill(u)}async function o2(D,u={}){let[F,...C]=D;if(!F)throw Error("runForeground requires at least one argument");let E=Bun.spawn([F,...C],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}),B=i2(E,"SIGINT"),z=i2(E,"SIGTERM");process.on("SIGINT",B),process.on("SIGTERM",z);try{return await E.exited}finally{process.off("SIGINT",B),process.off("SIGTERM",z)}}async function g2(D,u){let[F,...C]=D;if(!F)throw Error("runInstall requires at least one argument");let B=await Bun.spawn([F,...C],{cwd:u,stdin:"ignore",stdout:"inherit",stderr:"inherit",env:process.env}).exited;if(B!==0)throw Error(`package install failed (${D.join(" ")} exited ${B})`)}var Hu=B2(process.argv.slice(2)).scriptName("cradle").version($2.version).usage("$0 <cmd> [args]").parserConfiguration({"populate--":!0,"parse-numbers":!1,"parse-positional-numbers":!1}).strict();Hu.command("$0","show help",()=>{},async()=>{console.log(await Hu.getHelp())});Hu.command("start [dir]","run an agent folder with pi, sandboxed when sandbox/nono.json is present",(D)=>D.positional("dir",{type:"string",default:".",describe:"agent folder, or a name from ~/.cradle/settings.json (default: .)"}).option("offline",{type:"boolean",description:"block all outbound network (overrides the folder network policy; implies --sandbox)"}).option("allow-host",{type:"array",string:!0,description:"restrict network to these hosts (repeatable; overrides the folder allowlist; implies --sandbox)"}).option("sandbox",{type:"boolean",description:"run inside nono (--sandbox forces it when sandbox/nono.json is absent or opts out; --no-sandbox disables)"}).option("verbose",{type:"boolean",default:!1,description:"show nono's full sandbox capabilities banner instead of the one-line status"}).option("dry-run",{type:"boolean",default:!1,description:"print the write plan + command, do not spawn"}).epilogue("Everything after `--` is forwarded to pi."),async(D)=>{let u=(D["--"]??[]).map(String),F=(D.allowHost??[]).map(String),C={dir:D.dir,dryRun:D.dryRun,...D.sandbox!==void 0?{noSandbox:!D.sandbox}:{},...D.offline?{offline:!0}:{},...F.length?{allowHost:F}:{},...D.verbose?{verbose:!0}:{},...u.length?{passthrough:u}:{}};await B6(C)});Hu.command("doctor","check pi / nono / mise on PATH",()=>{},async()=>{let D=await Z2({readVersion:Z6});console.log(X2(D)),process.exitCode=G2(D)});async function B6(D){try{let u=await k2(D);if(l2(u.warnings),u.dryRun){$6(u);return}let F=await y2(u,{install:g2});if(l2(F.warnings),u.profile!==null&&!D.verbose)console.log("\uD83D\uDD12 Sandbox Active");process.exit(await o2(F.argv,OF(u.launch)))}catch(u){X6(u)}}function $6(D){for(let F of D.files)console.log(`write: ${s2(D.extensionsDir,F.rel)}`);if(D.profile!==null)console.log(`write: ${D.profile.path}`);if(D.packages!==null)z6(D.packages);let u=Object.entries(OF(D.launch)).map(([F,C])=>`${F}=${qF(C)}`);console.log([...u,...Ou(D.launch).map(qF)].join(" "))}function z6(D){console.log(`write: ${s2(D.npmDir,"package.json")}`);let u=D.specs.map((F)=>`${F.name}@${F.version}`).join(", ");console.log(`install: ${D.installCommand.join(" ")} (${D.npmDir}): ${u}`)}function l2(D){let u=process.stderr.isTTY===!0;for(let F of D)console.error(n2(`warning: ${F}`,u))}async function Z6(D){try{let u=Bun.spawn([D,"--version"],{stdout:"pipe",stderr:"ignore"}),[F,C]=await Promise.all([new Response(u.stdout).text(),u.exited]);if(C!==0)return null;let E=F.split(`
95
- `)[0]?.trim();if(!E)return null;let B=`${E6(D)} `;return E.startsWith(B)?E.slice(B.length):E}catch{return null}}function X6(D){console.error(D instanceof Error?D.message:String(D)),process.exitCode=1}Hu.parse();
110
+ `}function A1(D){let u=JSON.parse(D);for(let F of Object.values(u)){if(F===null||typeof F!=="object")continue;let C=F;if(typeof C.baseUrl==="string")C.baseUrl=c2(C.baseUrl)}return JSON.stringify(u,null,2)}import{lstat as t1,readdir as s2,stat as k1}from"fs/promises";import{join as LD,resolve as y1}from"path";import{join as jF,resolve as S1,sep as p2}from"path";var P1=/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,x1=/^[0-9A-Za-z.^~><=* +-]+$/;function t2(D,u,F){let C=D.packages;if(C===void 0)return[];if(!cD(C))return F.push(`${u}: packages must be an array of strings \u2014 ignored`),[];let E=b1(C,u,F);return h1(E,u,F)}function b1(D,u,F){let C=D.filter((B)=>B.startsWith("npm:")),E=D.filter((B)=>!B.startsWith("npm:"));if(E.length>0)F.push(`${u}: only npm: package sources are supported \u2014 ignored: ${E.join(", ")}`);return C}function h1(D,u,F){let C=[],E=[];for(let B of D){let $=w1(B.slice(4));if($===null)E.push(B);else C.push($)}if(E.length>0)F.push(`${u}: packages entries must be npm:<name>[@<version>] \u2014 ignored: ${E.join(", ")}`);return C}function w1(D){let u=D.lastIndexOf("@"),F=u>0,C=F?D.slice(0,u):D,E=F?D.slice(u+1):"latest";if(!P1.test(C)||!x1.test(E))return null;return{name:C,version:E}}function k2(D){let u=Object.fromEntries([...D].sort((F,C)=>F.name.localeCompare(C.name)).map((F)=>[F.name,F.version]));return`${JSON.stringify({name:"cradle-agent-packages",private:!0,dependencies:u},null,2)}
111
+ `}async function y2(D,u){let F=await Promise.all(u.map(async(C)=>{let E=[];return{entries:await m1(D,C,E),warnings:E}}));return{entries:F.flatMap((C)=>C.entries),warnings:F.flatMap((C)=>C.warnings)}}async function m1(D,u,F){let C=jF(D,"node_modules",u.name),E=await v1(u.name,C,F);if(E===null)return[];let B=c1(E);if(B===void 0)return d1(u.name,C,F);let $=[];for(let Z of B){let M=await p1(u.name,C,Z,F);if(M!==null)$.push(M)}return $}async function v1(D,u,F){let C=jF(u,"package.json"),E=await SD(C);if(E===void 0)return F.push(`package ${D} is not installed \u2014 skipped`),null;try{let B=Qu(E,C);if(!QD(B))return F.push(`package ${D}: ${C} must be a JSON object \u2014 skipped`),null;return B}catch(B){return F.push(`package ${D}: ${uu(B)} \u2014 skipped`),null}}function c1(D){let u=D.pi;if(u===void 0||!QD(u))return;let F=u.extensions;if(F===void 0||!cD(F))return;return F}async function d1(D,u,F){let C=jF(u,"index.ts");if(await Bun.file(C).exists())return[C];return F.push(`package ${D} declares no pi extensions \u2014 skipped`),[]}async function p1(D,u,F,C){let E=S1(u,F),B=u.endsWith(p2)?u:`${u}${p2}`;if(E!==u&&!E.startsWith(B))return C.push(`package ${D}: extension entry "${F}" escapes the package directory \u2014 skipped`),null;if(!await Bun.file(E).exists())return C.push(`package ${D}: extension entry "${F}" not found \u2014 skipped`),null;return E}var i2=["off","minimal","low","medium","high","xhigh"],g2=new Set(["schedules","subagents","channels","connections"]),i1=new Set(["SYSTEM.md","APPEND_SYSTEM.md","settings.json","models.json","skills","extensions","sandbox"]),g1=new Set([".git",".gitignore",".DS_Store","README.md","LICENSE"]),Vu={read:[],write:[],allow:[],unixSocketDirBind:[]},lu={posture:"unconfigured",filesystem:Vu,unsafeMacosSeatbeltRules:[]};async function r2(D){let u=y1(D),F=await l1(u),C=new Map(F.map((M)=>[M.name,M])),E=C.has("SYSTEM.md"),B=C.has("APPEND_SYSTEM.md");if(!E&&!B){let M=C.has("AGENTS.md")?" \u2014 found AGENTS.md, rename it to APPEND_SYSTEM.md":"";throw Error(`Not an agent folder: ${u} (needs SYSTEM.md or APPEND_SYSTEM.md${M} \u2014 see ARCHITECTURE.md)`)}let $=[];n1(F,$);let Z=await C6(u,C.get("sandbox"),$);return{dir:u,systemFilePath:E?LD(u,"SYSTEM.md"):null,appendSystemFilePath:B?LD(u,"APPEND_SYSTEM.md"):null,settings:await o1(u,C.has("settings.json"),$),providersJson:await e1(u,C.has("models.json"),$),skillsDir:await u6(u,C.get("skills"),$),extensionFiles:await F6(u,C.get("extensions"),$),sandbox:Z.nono,sbx:Z.sbx,warnings:$}}async function l1(D){try{return await s2(D,{withFileTypes:!0})}catch(u){if(ID(u,"ENOENT")||ID(u,"ENOTDIR"))throw Error(`Agent folder not found: ${D}`,{cause:u});throw u}}async function RF(D,u){if(u.isDirectory())return!0;if(!u.isSymbolicLink())return!1;try{return(await k1(LD(D,u.name))).isDirectory()}catch(F){if(ID(F,"ENOENT"))return!1;throw F}}function n1(D,u){let F=D.filter((E)=>g2.has(E.name)).map((E)=>E.name),C=D.map((E)=>E.name).filter((E)=>!i1.has(E)&&!g2.has(E)&&!g1.has(E));if(F.length>0)u.push(`reserved for a future cradle release, ignored: ${F.join(", ")}`);if(C.length>0)u.push(`not part of the agent folder format, ignored: ${C.join(", ")}`)}async function o1(D,u,F){if(!u)return{};let C=LD(D,"settings.json"),E=await AF(C);r1(E,C,F);let B=_F(E,"defaultProvider",C,F),$=_F(E,"defaultModel",C,F),Z=Y6(E,C,F),M=t2(E,C,F),O=a1(E,C,F);return{...B!==void 0?{defaultProvider:B}:{},...$!==void 0?{defaultModel:$}:{},...Z!==void 0?{defaultThinkingLevel:Z}:{},...M.length>0?{packages:M}:{},...O!==void 0?{npmCommand:O}:{}}}var s1=new Set(["defaultProvider","defaultModel","defaultThinkingLevel","packages","npmCommand"]);function r1(D,u,F){let C=Object.keys(D).filter((E)=>!s1.has(E));if(C.length>0)F.push(`${u}: keys cradle does not map are ignored \u2014 pi reads them from ~/.pi/agent/settings.json or `+`the project's .pi/settings.json, not the agent folder: ${C.join(", ")}`)}var l2=new Set(["npm","pnpm","yarn","bun"]);function a1(D,u,F){let C=D.npmCommand;if(C===void 0)return;let[E,...B]=cD(C)?C:[];if(E===void 0||B.length>0||!l2.has(E)){let $=[...l2].join(", ");F.push(`${u}: npmCommand must be a single-element array naming one of ${$} \u2014 ignored`);return}return[E]}async function e1(D,u,F){if(!u)return null;let C=LD(D,"models.json"),E=await AF(C),B=E.providers;if(B===void 0||!QD(B))throw Error(`${C} must contain a "providers" object`);return RD(E,C,["providers"],F),JSON.stringify(D6(B),null,2)}function D6(D){let u={input:0,output:0,cacheRead:0,cacheWrite:0};return Object.fromEntries(Object.entries(D).map(([F,C])=>{if(!QD(C)||!Array.isArray(C.models))return[F,C];let E=C.models.map((B)=>QD(B)&&B.cost===void 0?{cost:u,...B}:B);return[F,{...C,models:E}]}))}async function u6(D,u,F){if(!u)return null;if(!await RF(D,u))return F.push("skills must be a directory \u2014 ignored"),null;return LD(D,"skills")}async function F6(D,u,F){if(!u)return[];if(!await RF(D,u))return F.push("extensions must be a directory \u2014 ignored"),[];let C=LD(D,"extensions"),E=await s2(C,{withFileTypes:!0});return(await Promise.all(E.sort(($,Z)=>$.name.localeCompare(Z.name)).map(async($)=>{if($.isFile()&&$.name.endsWith(".ts")&&!$.name.startsWith("."))return LD(C,$.name);if($.isDirectory()){let Z=LD(C,$.name,"index.ts");return await Bun.file(Z).exists()?Z:null}return null}))).filter(($)=>$!==null)}async function C6(D,u,F){let C={nono:lu,sbx:lu};if(!u)return C;if(!await RF(D,u))return F.push("sandbox must be a directory \u2014 ignored"),C;let E=LD(D,"sandbox","nono.json"),B=LD(D,"sandbox","sbx.json"),$=await n2(E),Z=await n2(B);if($===void 0&&Z===void 0)return F.push("sandbox/ has no nono.json or sbx.json \u2014 sandboxing stays off unless --sandbox is passed"),C;return{nono:$===void 0?lu:E6($,E,F),sbx:Z===void 0?lu:B6(Z,B,F)}}function E6(D,u,F){let C=nu(D,"sandbox",u,F),E=X6(D,u,F);return Q6(D,u,F),RD(D,u,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules","net"],F),{posture:C===!1?"disabled":"enabled",...E!==void 0?{network:E}:{},filesystem:G6(D.filesystem,u,F),unsafeMacosSeatbeltRules:M6(D.unsafe_macos_seatbelt_rules,u,F)}}function B6(D,u,F){let C=nu(D,"sandbox",u,F),E=$6(D,u,F);return NF({record:D,key:"unsafe_macos_seatbelt_rules",path:u,explanation:"the sbx VM boundary replaces Seatbelt"},F),RD(D,u,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules"],F),{posture:C===!1?"disabled":"enabled",...E!==void 0?{network:E}:{},filesystem:z6(D.filesystem,u,F),unsafeMacosSeatbeltRules:[]}}function $6(D,u,F){let C=D.network;if(C===void 0)return;if(!QD(C)){F.push(`${u}: network must be an object \u2014 ignored`);return}for(let M of["network_profile","open_port","listen_port"])NF({record:C,key:M,path:u},F);let E=`${u} network`;RD(C,E,["block","allow_domain","network_profile","open_port","listen_port"],F);let B=nu(C,"block",E,F),$=a2(C,"allow_domain",E,F),Z={...B!==void 0?{block:B}:{},...$.length>0?{allowDomain:$}:{}};return Object.keys(Z).length>0?Z:void 0}function z6(D,u,F){if(D===void 0)return Vu;if(!QD(D))return F.push(`${u}: filesystem must be an object \u2014 ignored`),Vu;return NF({record:D,key:"unix_socket_dir_bind",path:u,explanation:"Unix sockets cannot cross the sbx VM boundary"},F),RD(D,`${u} filesystem`,["read","write","allow","unix_socket_dir_bind"],F),{read:Fu(D,"read",u,F),write:Fu(D,"write",u,F),allow:Fu(D,"allow",u,F),unixSocketDirBind:[]}}function NF({record:D,key:u,path:F,explanation:C},E){if(D[u]===void 0)return;E.push(`${F}: ${u} is nono-only \u2014 ${C!==void 0?`${C}; `:""}ignored`)}async function n2(D){return await Z6(D)?AF(D):void 0}async function Z6(D){try{return await t1(D),!0}catch(u){if(ID(u,"ENOENT"))return!1;throw u}}function Q6(D,u,F){if(D.net!==void 0)F.push(`${u}: "net" was removed \u2014 use "network" instead (see ARCHITECTURE.md) \u2014 ignored`)}function X6(D,u,F){let C=D.network;if(C===void 0)return;if(!QD(C)){F.push(`${u}: network must be an object \u2014 ignored`);return}let E=`${u} network`;RD(C,E,["block","network_profile","allow_domain","open_port","listen_port"],F);let B=nu(C,"block",E,F),$=_F(C,"network_profile",E,F),Z=a2(C,"allow_domain",E,F),M=o2(C,"open_port",E,F),O=o2(C,"listen_port",E,F),V={...B!==void 0?{block:B}:{},...$!==void 0?{networkProfile:$}:{},...Z.length>0?{allowDomain:Z}:{},...M.length>0?{openPort:M}:{},...O.length>0?{listenPort:O}:{}};return Object.keys(V).length>0?V:void 0}function a2(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!cD(E))return C.push(`${F}: ${u} must be an array of strings \u2014 ignored`),[];let B=E.map(($)=>$.trim()).filter(($)=>$!=="");if(B.length!==E.length)C.push(`${F}: ${u} entries must be non-empty \u2014 blanks ignored`);return B}function o2(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!Array.isArray(E))return C.push(`${F}: ${u} must be an array of port numbers \u2014 ignored`),[];let B=(Z)=>typeof Z==="number"&&Number.isInteger(Z)&&Z>=0&&Z<=65535,$=E.filter((Z)=>!B(Z)).map((Z)=>typeof Z==="object"&&Z!==null?JSON.stringify(Z):String(Z));if($.length>0)C.push(`${F}: ${u} entries must be integers 0\u201365535 \u2014 ignored: ${$.join(", ")}`);return E.filter(B)}function M6(D,u,F){if(D===void 0)return[];if(!cD(D))return F.push(`${u}: unsafe_macos_seatbelt_rules must be an array of strings \u2014 ignored`),[];let C=(B)=>{let $=B.trim();return $.startsWith("(")&&$.endsWith(")")},E=D.filter((B)=>!C(B));if(E.length>0)F.push(`${u}: unsafe_macos_seatbelt_rules entries must be parenthesized s-expressions \u2014 ignored: ${E.join(", ")}`);return D.filter(C).map((B)=>B.trim())}function nu(D,u,F,C){let E=D[u];if(E===void 0)return;if(typeof E!=="boolean"){C.push(`${F}: ${u} must be true or false \u2014 ignored`);return}return E}function G6(D,u,F){if(D===void 0)return Vu;if(!QD(D))return F.push(`${u}: filesystem must be an object \u2014 ignored`),Vu;return RD(D,`${u} filesystem`,["read","write","allow","unix_socket_dir_bind"],F),{read:Fu(D,"read",u,F),write:Fu(D,"write",u,F),allow:Fu(D,"allow",u,F),unixSocketDirBind:Fu(D,"unix_socket_dir_bind",u,F)}}function Fu(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!cD(E))return C.push(`${F}: ${u} must be an array of strings \u2014 ignored`),[];let B=E.filter(($)=>!Wu($));if(B.length>0)C.push(`${F}: ${u} entries must be absolute, ~/, or $HOME/ paths \u2014 ignored: ${B.join(", ")}`);return E.filter(Wu)}async function AF(D){let u=Qu(await J6(D),D);if(!QD(u))throw Error(`${D} must be a JSON object`);return u}async function J6(D){let u;try{u=await SD(D)}catch(F){throw Error(`${D} could not be read: ${uu(F)}`,{cause:F})}if(u===void 0)throw Error(`${D} could not be read \u2014 broken symlink?`);return u}function _F(D,u,F,C){let E=D[u];if(E===void 0)return;if(typeof E!=="string"){C.push(`${F}: ${u} must be a string \u2014 ignored`);return}return E}function Y6(D,u,F){let C=D.defaultThinkingLevel;if(C===void 0)return;if(typeof C!=="string"||!i2.includes(C)){F.push(`${u}: defaultThinkingLevel must be one of ${i2.join(", ")} \u2014 ignored`);return}return C}import{createHash as q6}from"crypto";import{homedir as O6}from"os";import{basename as H6,join as Tu}from"path";function U6(D){let u=H6(D).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),F=q6("sha256").update(D).digest("hex").slice(0,8);return`${u===""?"agent":u}-${F}`}function e2(D,u=O6(),F=process.env.CRADLE_STATE_DIR){let C=F||Tu(u,".cradle");return Tu(C,"agents",U6(D))}function D8(D){return{extensionsDir:Tu(D,"extensions"),sessionsDir:Tu(D,"sessions"),miseCacheDir:Tu(D,"mise-cache")}}import{readFile as W6}from"fs/promises";import{join as u8,resolve as F8}from"path";var C8="gitdir:";async function E8(D){try{return await W6(D,"utf8")}catch{return}}async function B8(D){let u=await E8(u8(D,".git"));if(u===void 0||!u.startsWith(C8))return;let F=F8(D,u.slice(C8.length).trim()),C=await E8(u8(F,"commondir")),E=C!==void 0?F8(F,C.trim()):F;return ku(D,E)?void 0:E}async function Z8(D,u={}){let F=u.home??f6(),C=u.cwd??process.cwd(),{dir:E,warnings:B}=await N2(D.dir,{home:F,cwd:C}),$=await r2(E),Z=e2($.dir,F),{extensionsDir:M,sessionsDir:O,miseCacheDir:V}=D8(Z),Y=_6(D,$),q=D.dryRun??!1,H=p6(Y.backend,q,u.which),W=K6({folder:$,flags:D,backend:Y.backend,bins:H,stateDir:Z,extensionsDir:M,sessionsDir:O,miseCacheDir:V}),J=await t6(Y,$,{home:F,cwd:C,stateDir:Z,profilePath:W.profilePath,sbxBin:H.sbxBin,hostPiBin:H.piBin,tty:u.tty??!1}),S=j6($,Z);return{files:i6($,Y.backend),extensionsDir:M,sessionsDir:O,warnings:[...B,...Y.warnings,...J.warnings],profile:J.profile,sbx:J.sbx,packages:S,launch:W,dryRun:q}}function K6(D){let{folder:u,flags:F,backend:C,bins:E,stateDir:B,extensionsDir:$,sessionsDir:Z,miseCacheDir:M}=D;return{folder:u,stateDir:B,extensionsDir:$,sessionsDir:Z,miseCacheDir:M,backend:C,passthrough:F.passthrough??[],nonoBin:E.nonoBin,piBin:C==="sbx"?"pi":E.piBin,profilePath:fu(B,U2),...F.verbose?{verbose:!0}:{}}}function j6(D,u){let F=D.settings.packages;if(F===void 0||F.length===0)return null;return{npmDir:fu(u,"npm"),manifest:k2(F),specs:F,installCommand:[...D.settings.npmCommand??["npm"],"install","--ignore-scripts"]}}function _6(D,u){let{backend:F,warnings:C}=x6(D,u),E=[],B=R6(D,u,F,E);return{backend:F,network:B,warnings:S6(F!==null,B,[...C,...E])}}function R6(D,u,F,C){if(D.offline)return{block:!0};let E=N6(D.allowHost??[],C);if(E.length>0)return{allowDomain:E};return F==="sbx"?u.sbx.network:u.sandbox.network}function N6(D,u){let F=D.map((C)=>C.trim()).filter((C)=>C!=="");if(F.length!==D.length)u.push("--allow-host entries must be non-empty \u2014 blanks ignored");return F}function A6(D){return D!==void 0&&(D.block===!0||(D.allowDomain?.length??0)>0)}function S6(D,u,F){if(D||!A6(u))return F;return[...F,"network policy has no effect without the sandbox \u2014 pi runs with no network isolation (--sandbox to enforce it)"]}function P6(D){return D.offline===!0||(D.allowHost?.length??0)>0}function x6(D,u){if(D.noSandbox===!0)return{backend:null,warnings:u.warnings};if(D.sandboxBackend!==void 0)return{backend:D.sandboxBackend,warnings:u.warnings};let F=b6(u);if(D.noSandbox===!1||F.backend!==null)return{...F,backend:F.backend??"nono"};return h6(D,u,F.warnings)}function b6(D){let u=D.sandbox.posture==="enabled",F=D.sbx.posture==="enabled";if(u&&F)return{backend:"nono",warnings:[...D.warnings,"both sandbox/nono.json and sandbox/sbx.json declare a sandbox \u2014 using nono (pass --sandbox-backend sbx to override)"]};return{backend:u?"nono":F?"sbx":null,warnings:D.warnings}}function h6(D,u,F){let C=w6(u);if(P6(D))return{backend:"nono",warnings:[...F,`${C} \u2014 sandbox forced on to enforce the requested network policy (--no-sandbox to override)`]};return{backend:null,warnings:[...F,`${C} \u2014 agent is running without OS isolation (--sandbox to force enable)`]}}function w6(D){if(D.sandbox.posture==="disabled")return"sandbox disabled by sandbox/nono.json";if(D.sbx.posture==="disabled")return"sandbox disabled by sandbox/sbx.json";return"sandbox/nono.json or sbx.json not found"}async function Q8(D,u={}){let F={dryRun:!1,results:[],failures:[]};if(await I2(F,"extensions",D.extensionsDir,D.files),F.failures.length>0)throw Error(`Failed to write agent extensions: ${F.failures.join("; ")}`);if(await SF(D.sessionsDir,{recursive:!0}),D.profile!==null)await SF(L6(D.profile.path),{recursive:!0}),await z8(D.profile.path,D.profile.content,"utf8");if(D.sbx!==null)await m6(D.sbx,u);let C={...D.launch,extensionsDir:D.extensionsDir,sessionsDir:D.sessionsDir},E=D.packages===null?{argv:Zu(C),warnings:[]}:await d6(D.packages,C,u);if(D.sbx===null)return E;return{argv:gu(D.sbx.spec,E.argv),warnings:E.warnings}}async function m6(D,u){let F=u.run;if(F===void 0)throw Error("An sbx-backend run needs a command runner but none was provided");let C=await F(D.createArgv);if(C.exitCode!==0&&!v2(C.stderr))throw Error(`Failed to create sbx sandbox ${D.spec.name}: ${C.stderr.trim()}`);for(let E of D.policyArgvs)await $8(F,E,`apply sbx network policy (${D.spec.name})`);await $8(F,await v6(D,u),`provision pi in sbx sandbox ${D.spec.name}`)}async function $8(D,u,F){let C=await D(u);if(C.exitCode!==0)throw Error(`Failed to ${F}: ${C.stderr.trim()}`)}async function v6(D,u){if(u.readPiVersion===void 0)return D.provisionArgv;let F=await u.readPiVersion(D.hostPiBin);return KF({...D.spec,piVersion:F})}async function c6(D,u){if(await SD(fu(D,"package.json"))!==u)return!1;return V6(fu(D,"node_modules"))}async function d6(D,u,F){if(await SF(D.npmDir,{recursive:!0}),!await c6(D.npmDir,D.manifest)){if(F.install===void 0)throw Error("Packages declared but no installer provided");let B=fu(D.npmDir,"package.json");await z8(B,D.manifest,"utf8");try{await F.install(D.installCommand,D.npmDir)}catch($){throw await T6(B,{force:!0}),$}}let{entries:C,warnings:E}=await y2(D.npmDir,D.specs);return{argv:Zu({...u,packageEntries:C}),warnings:E}}function p6(D,u,F){if(u)return{nonoBin:"nono",piBin:"pi",sbxBin:"sbx"};return{nonoBin:D==="nono"?tu("nono",F):"nono",sbxBin:D==="sbx"?tu("sbx",F):"sbx",piBin:tu("pi",F)}}async function t6(D,u,F){let C=D.backend!==null?await B8(F.cwd):void 0,E=y6(D.backend==="nono",u,D.network,{home:F.home,cwd:F.cwd,stateDir:F.stateDir,profilePath:F.profilePath,...C!==void 0?{linkedGitDir:C}:{}});if(D.backend!=="sbx")return{profile:E,sbx:null,warnings:[]};let B=k6(D.network,u,{...F,...C!==void 0?{linkedGitDir:C}:{}});return{profile:E,sbx:B,warnings:[...w2(D.network),...m2(u.sbx.filesystem)]}}function k6(D,u,F){let C=P2({cwd:F.cwd,agentDir:u.dir,stateDir:F.stateDir,home:F.home,grants:u.sbx.filesystem,...F.linkedGitDir!==void 0?{linkedGitDir:F.linkedGitDir}:{}}),E={sbxBin:F.sbxBin,name:x2(I6(F.stateDir),C),cwd:F.cwd,home:F.home,mounts:C,...D!==void 0?{network:D}:{},piVersion:null,tty:F.tty};return{spec:E,hostPiBin:F.hostPiBin,createArgv:b2(E),policyArgvs:h2(E),provisionArgv:KF(E)}}function y6(D,u,F,C){if(!D)return null;let E=W2(C.cwd,C.home);if(E!==void 0)throw Error(`cannot sandbox from ${E} \u2014 this directory is (or contains) nono's protected state root `+"(~/.local/state/nono) and nono refuses to start with an overlapping grant; run `cradle run` from a project directory instead");let B=V2({home:C.home,cwd:C.cwd,agentDir:u.dir,stateDir:C.stateDir,grants:u.sandbox.filesystem,rules:u.sandbox.unsafeMacosSeatbeltRules,...F!==void 0?{network:F}:{},...C.linkedGitDir!==void 0?{linkedGitDir:C.linkedGitDir}:{}});return{path:C.profilePath,content:B}}function i6(D,u){return[...D.providersJson!==null?[{rel:"providers.ts",content:d2(D.providersJson,{rewriteLocalhostBaseUrls:u==="sbx"})}]:[],...u==="nono"?[{rel:pu,content:G2()}]:[]]}function X8(D,u){return u?`\x1B[33m${D}\x1B[0m`:D}function M8(D,u){return()=>{D.kill(u)}}async function G8(D,u={}){let[F,...C]=D;if(!F)throw Error("Command requires at least one argument");let E=Bun.spawn([F,...C],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}),B=M8(E,"SIGINT"),$=M8(E,"SIGTERM");process.on("SIGINT",B),process.on("SIGTERM",$);try{return await E.exited}finally{process.off("SIGINT",B),process.off("SIGTERM",$)}}async function J8(D){let[u,...F]=D;if(!u)throw Error("Command requires at least one argument");let C=Bun.spawn([u,...F],{stdin:"ignore",stdout:"ignore",stderr:"pipe",env:process.env}),[E,B]=await Promise.all([new Response(C.stderr).text(),C.exited]);return{exitCode:B,stderr:E}}async function Y8(D,u){let[F,...C]=D;if(!F)throw Error("Command requires at least one argument");let B=await Bun.spawn([F,...C],{cwd:u,stdin:"ignore",stdout:"inherit",stderr:"inherit",env:process.env}).exited;if(B!==0)throw Error(`Package install failed (${D.join(" ")} exited ${String(B)})`)}var Iu=X2(process.argv.slice(2)).scriptName("cradle").version(M2.version).usage("$0 <cmd> [args]").parserConfiguration({"populate--":!0,"parse-numbers":!1,"parse-positional-numbers":!1}).strict();Iu.command("$0","show help",()=>{},async()=>{console.log(await Iu.getHelp())});Iu.command("run [dir]","run an agent folder with pi, sandboxed when sandbox/nono.json or sandbox/sbx.json is present",(D)=>D.positional("dir",{type:"string",default:".",describe:"agent folder, or a name from ~/.cradle/settings.json (default: .)"}).option("offline",{type:"boolean",description:"block all outbound network (overrides the folder network policy; implies --sandbox)"}).option("allow-host",{type:"array",string:!0,description:"restrict network to these hosts (repeatable; overrides the folder allowlist; implies --sandbox)"}).option("sandbox",{type:"boolean",description:"run sandboxed (--sandbox forces it when no sandbox/ file enables one or the folder opts out; --no-sandbox disables)"}).option("sandbox-backend",{type:"string",choices:["nono","sbx"],description:"sandbox implementation (implies --sandbox): nono (host OS policy) or sbx (Docker Sandboxes microVM)"}).option("verbose",{type:"boolean",default:!1,description:"show nono's full sandbox capabilities banner instead of the one-line status"}).option("dry-run",{type:"boolean",default:!1,description:"print the write plan + command, do not spawn"}).epilogue("Everything after `--` is forwarded to pi."),async(D)=>{let u=(D["--"]??[]).map(String),F=(D.allowHost??[]).map(String),C={dir:D.dir,dryRun:D.dryRun,...D.sandbox!==void 0?{noSandbox:!D.sandbox}:{},...D.sandboxBackend!==void 0?{sandboxBackend:D.sandboxBackend}:{},...D.offline?{offline:!0}:{},...F.length?{allowHost:F}:{},...D.verbose?{verbose:!0}:{},...u.length?{passthrough:u}:{}};await g6(C)});Iu.command("doctor","check pi / nono / mise on PATH",()=>{},async()=>{let D=await q2({readVersion:H8});console.log(O2(D)),process.exitCode=H2(D)});async function g6(D){try{let u=await Z8(D,{tty:process.stdout.isTTY});if(q8(u.warnings),u.dryRun){l6(u);return}let F=await Q8(u,{install:Y8,run:J8,readPiVersion:H8});if(q8(F.warnings),u.profile!==null&&!D.verbose)console.log("\uD83D\uDD12 Sandbox Active");if(u.sbx!==null&&!D.verbose)console.log("\uD83D\uDD12 Sandbox Active (sbx)");process.exit(await G8(F.argv,IF(u.launch)))}catch(u){s6(u)}}function l6(D){for(let C of D.files)console.log(`write: ${O8(D.extensionsDir,C.rel)}`);if(D.profile!==null)console.log(`write: ${D.profile.path}`);if(D.sbx!==null)n6(D.sbx);if(D.packages!==null)o6(D.packages);let u=Object.entries(IF(D.launch)).map(([C,E])=>`${C}=${Xu(E)}`),F=D.sbx!==null?gu(D.sbx.spec,Zu(D.launch)):Zu(D.launch);console.log([...u,...F.map(Xu)].join(" "))}function n6(D){console.log(`create: ${D.createArgv.map(Xu).join(" ")}`);for(let u of D.policyArgvs)console.log(`policy: ${u.map(Xu).join(" ")}`);console.log(`provision: ${D.provisionArgv.map(Xu).join(" ")}`)}function o6(D){console.log(`write: ${O8(D.npmDir,"package.json")}`);let u=D.specs.map((F)=>`${F.name}@${F.version}`).join(", ");console.log(`install: ${D.installCommand.join(" ")} (${D.npmDir}): ${u}`)}function q8(D){let u=process.stderr.isTTY;for(let F of D)console.error(X8(`warning: ${F}`,u))}async function H8(D,u=["--version"]){try{let F=Bun.spawn([D,...u],{stdout:"pipe",stderr:"ignore"}),[C,E]=await Promise.all([new Response(F.stdout).text(),F.exited]);if(E!==0)return null;return C.split(`
112
+ `)[0]?.match(/v?\d+\.\d+\S*/)?.[0]??null}catch{return null}}function s6(D){console.error(D instanceof Error?D.message:String(D)),process.exitCode=1}Iu.parse();