@visulima/cerebro 3.0.6 → 3.1.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +5 -811
  3. package/README.md +41 -0
  4. package/dist/commands/completion-command.d.ts +1 -1
  5. package/dist/commands/completion-command.js +5 -5
  6. package/dist/commands/help-command.d.ts +1 -1
  7. package/dist/commands/help-command.js +1 -1
  8. package/dist/commands/readme-command.d.ts +1 -1
  9. package/dist/commands/readme-command.js +20 -20
  10. package/dist/commands/version-command.d.ts +1 -1
  11. package/dist/commands/version-command.js +1 -1
  12. package/dist/index.d.ts +284 -7
  13. package/dist/index.js +1 -1
  14. package/dist/logger/create-pail-logger.d.ts +36 -1
  15. package/dist/logger/create-pail-logger.js +1 -1
  16. package/dist/packem_chunks/has-new-version.js +1 -1
  17. package/dist/packem_shared/Cerebro-Dh8am0pz.js +4 -0
  18. package/dist/packem_shared/InvalidArgumentChoiceError-BpovuqrZ.js +1 -0
  19. package/dist/packem_shared/MissingArgumentError-D78kza2a.js +1 -0
  20. package/dist/packem_shared/SurplusArgumentError-BLwT9lo0.js +1 -0
  21. package/dist/packem_shared/VERBOSITY_DEBUG-D7HfSD5l.js +1 -0
  22. package/dist/packem_shared/VisulimaError-BDqtOVL5-Db_MJ_p7.js +1 -0
  23. package/dist/packem_shared/VisulimaError-CuhG0hlQ.js +76 -0
  24. package/dist/packem_shared/cerebro-error-Dv3FuXO8.js +1 -0
  25. package/dist/packem_shared/{command.d-B_G9vIYJ.d.ts → command.d-CLlirnwR.d.ts} +148 -4
  26. package/dist/packem_shared/constants-BKuEbBw1-BRv49X2l.js +1 -0
  27. package/dist/packem_shared/defineCommand-C_isHeEs.js +1 -0
  28. package/dist/packem_shared/format-positional-usage-DWL9qN10.js +6 -0
  29. package/dist/packem_shared/lazyNamed-BKSCmVsV.js +1 -0
  30. package/dist/packem_shared/renderError-CIIYTTfx-BdX-afLI.js +27 -0
  31. package/dist/packem_shared/runtime-process-BN-eTlwy.js +1 -0
  32. package/dist/plugins/error-handler-plugin.d.ts +1 -1
  33. package/dist/plugins/error-handler-plugin.js +1 -1
  34. package/dist/plugins/runtime-version-check-plugin.d.ts +1 -1
  35. package/dist/plugins/runtime-version-check-plugin.js +1 -1
  36. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +1 -1
  37. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
  38. package/dist/util/general/heap-tuning.js +1 -1
  39. package/package.json +2 -2
  40. package/dist/packem_shared/Cerebro-58LHN3_T.js +0 -4
  41. package/dist/packem_shared/VERBOSITY_DEBUG-XPultrIA.js +0 -1
  42. package/dist/packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js +0 -1
  43. package/dist/packem_shared/VisulimaError-k1qGkvab.js +0 -76
  44. package/dist/packem_shared/cerebro-error-DWpjBY_M.js +0 -1
  45. package/dist/packem_shared/index-Dpm7gUHe.js +0 -29
  46. package/dist/packem_shared/lazyNamed-DMUm8mZe.js +0 -1
  47. package/dist/packem_shared/renderError-BISXNU8L-B47ZikMV.js +0 -27
  48. package/dist/packem_shared/runtime-process-BEw54Ar-.js +0 -1
  49. package/dist/packem_shared/split-by-case-BZ6XOTIf.js +0 -1
@@ -0,0 +1,6 @@
1
+ import{createRequire as te}from"node:module";import{L as U,B as v,c as ie}from"./constants-BKuEbBw1-BRv49X2l.js";import{createTable as A}from"@visulima/tabular";import{NO_BORDER as M}from"@visulima/tabular/style";import ae from"@visulima/colorize/template";import{c as le}from"./runtime-process-BN-eTlwy.js";import{bold as $,underline as ue}from"@visulima/colorize";let re;const ne=e=>(re??=te(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:w,T=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[t,r]=b.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return b.getBuiltinModule(e)}return ne(e)},w=b,{execFileSync:se}=T("node:child_process"),W=T("node:fs"),oe=T("node:tty"),ce=T("node:os"),de=[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],fe=12288,he=65510,pe=[12288,12288,65281,65376,65504,65510],me=8361,we=65518,ge=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],be=32,ye=10630,Ne=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ie=4352,We=262141,Y=[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],O=(e,t)=>{let r=0,i=Math.floor(e.length/2)-1;for(;r<=i;){const o=Math.floor((r+i)/2),c=o*2;if(t<e[c])i=o-1;else if(t>e[c+1])r=o+1;else return!0}return!1},P=19968,[Oe,ve]=xe(Y);function xe(e){let t=e[0],r=e[1];for(let i=0;i<e.length;i+=2){const o=e[i],c=e[i+1];if(P>=o&&P<=c)return[o,c];c-o>r-t&&(t=o,r=c)}return[t,r]}const Ee=e=>e<161||e>1114109?!1:O(de,e),Ae=e=>e<fe||e>he?!1:O(pe,e),Me=e=>e<me||e>we?!1:O(ge,e),$e=e=>e<be||e>ye?!1:O(Ne,e),Se=e=>e>=Oe&&e<=ve?!0:e<Ie||e>We?!1:O(Y,e);function Ce(e){return Ee(e)?"ambiguous":Ae(e)?"fullwidth":Me(e)?"halfwidth":$e(e)?"narrow":Se(e)?"wide":"neutral"}function Te(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function G(e){return Te(e),Ce(e)}const D=new Map,ke=e=>[e.ambiguousIsNarrow?1:0,e.control,e.fullWidth,e.regular,e.wide].join("|"),Le=e=>{const t=ke(e.width);let r=D.get(t);return r||(r=new Map,D.set(t,r)),r},x=new RegExp(U.source,"y"),_=new RegExp(ie.source,"uy"),E=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,V=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",Re=(e,t)=>{const r=Le(t),i=Math.floor(e/65536),o=e%65536;let c=r.get(i);if(c||(c=new Map,r.set(i,c)),c.has(o))return c.get(o);let n;switch(V(e)){case"control":{n=t.width.control;break}case"latin":{n=t.width.regular;break}case"wide":{n=t.width.wide;break}case"zero":{n=0;break}default:switch(G(e)){case"ambiguous":{n=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{n=t.width.fullWidth;break}case"wide":{n=t.width.wide;break}default:n=t.width.regular}}return c.set(o,n),n},_e=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,F=(e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?F(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},i=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:o}=e,c=o>1e4;let n=0,s=0,l=o,a=!1;const u=e.includes("\x1B")||e.includes("›");for(;n<o;){if(u&&(e[n]==="\x1B"||e[n]==="›")){if(e.startsWith("\x1B]8;;",n)){const f="\x1B]8;;\x07",p=f.length,k=e.indexOf("\x07",n+5);if(k!==-1){const L=e.indexOf(f,k+1);if(L!==-1){const Q=L+p,ee=e.slice(k+1,L).replace(U,""),z=F(ee,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,i-s),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),R=z.width;if(z.truncated)a=!0,l=Math.min(l,n);else if(s+R>i&&(l=Math.min(l,n),a=!0,s+R>r.truncation.limit))break;if(s+=R,n=Q,a&&s>=r.truncation.limit)break;continue}}}if(x.lastIndex=n,x.test(e)){const f=x.lastIndex-n,p=r.truncation.countAnsiEscapeCodes?f:r.width.ansi;if(s+p>i&&(l=Math.min(l,n),s+p>r.truncation.limit)){a=!0;break}s+=p,n=x.lastIndex;continue}}const m=e.codePointAt(n);if(m===8203||m===65279||m>=8288&&m<=8292){n+=1;continue}if(m===9){if(s+r.width.tab>i&&(l=Math.min(l,n),s+r.width.tab>r.truncation.limit)){a=!0;break}s+=r.width.tab,n+=1;continue}if(E.lastIndex=n,E.test(e)){const f=(E.lastIndex-n)*r.width.regular;if(s+f>i){const p=r.width.regular>0?Math.floor((i-s)/r.width.regular):0;if(l=Math.min(l,n+p),s+f>r.truncation.limit){a=!0;break}}s+=f,n=E.lastIndex;continue}if((m<=31||m>=127&&m<=159)&&(v.lastIndex=n,v.test(e))){const f=(v.lastIndex-n)*r.width.control;if(s+f>i){const p=r.width.control>0?Math.floor((i-s)/r.width.control):0;if(l=Math.min(l,n+p),s+f>r.truncation.limit){a=!0;break}}s+=f,n=v.lastIndex;continue}if(_.lastIndex=n,_.test(e)){if(s+r.width.emoji>i&&(l=Math.min(l,n),s+r.width.emoji>r.truncation.limit)){a=!0;break}s+=r.width.emoji,n=_.lastIndex;continue}const g=e.codePointAt(n)??0;if(_e(g)){n+=g>65535?2:1;continue}let d;if(c)d=Re(g,r);else switch(V(g)){case"control":{d=r.width.control;break}case"latin":{d=r.width.regular;break}case"wide":{d=r.width.wide;break}case"zero":{d=0;break}default:switch(G(g)){case"ambiguous":{d=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{d=r.width.fullWidth;break}case"wide":{d=r.width.wide;break}default:d=r.width.regular}}if(s+d>i&&(l=Math.min(l,n),s+d>r.truncation.limit)){a=!0;break}s+=d,n+=g>65535?2:1}let y=s,N=!1;return a&&r.truncation.limit>=r.truncation.ellipsisWidth&&(y=r.truncation.limit,N=!0),{ellipsed:N,index:a?l:o,truncated:a,width:y}},je=(e,t={})=>F(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,K=80,J=24,B=(e,t,{shell:r,env:i}={})=>se(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:i}).trim(),S=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),X=(e,t)=>{const{columns:r,rows:i}=S(e,t);if(!(Number.isNaN(r)||Number.isNaN(i))&&!(r===K&&i===J))return{columns:r,rows:i}},Fe=()=>{if(w.platform!=="linux")return!0;try{const e=W.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const r=e.slice(t+2).trim().split(/\s+/),i=Number.parseInt(r[2],10),o=Number.parseInt(r[5],10);return Number.isNaN(i)||Number.isNaN(o)||o<=0?!1:i===o}catch{return!1}};function Be(){const{env:e,stdout:t,stderr:r}=w;if(t?.columns&&t?.rows)return S(t.columns,t.rows);if(r?.columns&&r?.rows)return S(r.columns,r.rows);if(e.COLUMNS&&e.LINES)return S(e.COLUMNS,e.LINES);const i={columns:K,rows:J};return w.platform==="win32"?j()??i:w.platform==="darwin"?q()??j()??i:q()??j()??ze()??i}const q=()=>{try{const e=w.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:t,rows:r}=oe.WriteStream(W.openSync("/dev/tty",e));return{columns:t,rows:r}}catch{}},j=()=>{try{const e=B("tput",["cols"],{env:{TERM:"dumb",...w.env}}),t=B("tput",["lines"],{env:{TERM:"dumb",...w.env}});if(e&&t)return X(e,t)}catch{}},ze=()=>{try{if(!Fe())return;const e=B("resize",["-u"]).match(/\d+/g);if(e.length===2)return X(e[0],e[1])}catch{}},I=new Map,Pe=500,h=e=>{if(!e||e==="")return"";const t=I.get(e);if(t!==void 0)return t;let r;try{r=ae(Object.assign([],{raw:[e]}))}catch{r=e}if(I.size>=Pe){const i=I.keys().next().value;i!==void 0&&I.delete(i)}return I.set(e,r),r},C=()=>{const t=le().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const r=Number.parseInt(t,10);if(!(Number.isNaN(r)||r<=0))return r};class Z{lines;constructor(){this.lines=[]}add(t){this.lines.push(t)}toString(){return this.lines.join(ce.EOL)}header(t){this.add($(t)),this.lines.push("")}}const De=e=>e!==void 0&&e>0?e:Be().columns,qe=(e,t,r,i)=>{if(e.length===0||e.some(u=>u.length!==2))return;let o=0;for(const u of e){const y=u[0];if(y===void 0)continue;const N=je(y);N>o&&(o=N)}if(o===0)return;const c=r+i,n=o+c,l=20+c;if(n+l>t)return;const a=t-n;return[n,a]};class He extends Z{constructor(t){if(super(),t.header&&this.header(h(t.header)),t.content){if(t.raw)if(Array.isArray(t.content)&&t.content.every(r=>typeof r=="string"))t.content.forEach(r=>{Array.isArray(r)?r.forEach(i=>{this.add(h(i))}):this.add(h(r))});else if(typeof t.content=="string")this.add(h(t.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(t.content));this.add("")}}getContentLines(t){if(typeof t=="string"){const r=A({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return r.addRow([h(t)]),r.toString()}if(Array.isArray(t)&&t.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(i=>typeof i=="string"))){const o=De(C()),c=a=>Array.isArray(a)?a.map(u=>h(u)):[h(a)],n=t.map(a=>c(a)),s=qe(n,o,4,1),l=A({columnWidths:s,showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:o,truncateOverflow:!1,wordWrap:!0});return n.forEach(a=>{s!==void 0&&a.length===2?l.addRow([{content:a[0],wordWrap:!1},a[1]]):l.addRow(a)}),l.toString()}if(typeof t=="object"){const r=t;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
2
+ ${JSON.stringify(t)}`);const i=A({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return r.data.forEach(o=>{Array.isArray(o)?i.addRow(o.map(c=>h(c))):i.addRow([h(o)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
+
4
+ ${JSON.stringify(t)}`)}}class Ue extends Z{constructor(t){super();let r=t.optionList??[];const i=Array.isArray(t.hide)?t.hide:[t.hide].filter(n=>typeof n=="string"),o=Array.isArray(t.group)?t.group:[t.group].filter(n=>typeof n=="string");i.length>0&&(r=r.filter(n=>!i.includes(n.name))),t.header&&this.header(h(t.header)),o.length>0&&(r=r.filter(n=>{const s=n,l=o.includes("_none")&&!s.group,a=s.group,u=this.intersect(Array.isArray(a)?a:[a],o);return l||u?n:void 0}));const c=A({showHeader:!1,style:{border:M,paddingLeft:2,paddingRight:1,...t.tableOptions?.style},terminalWidth:C()??t.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:t.tableOptions?.wordWrap??!0,...t.tableOptions});r.forEach(n=>{const s=n;c.addRow([this.getOptionNames(s,t.reverseNameOrder??!1,t.isArgument??!1),h(s.description)])}),this.add(c.toString()),this.lines.push("")}getOptionNames(t,r,i){if(!t.name)throw new TypeError("Invalid option definition, name is required.");const o=t.type?t.type.name.toLowerCase():"string",{lazyMultiple:c}=t,n=t.multiple||c?"[]":"",s=t.typeLabel===void 0?ue(`${o}${n}`):h(t.typeLabel),l=i?$(t.name):$.yellow(`--${t.name}`),a=t.alias;if(a){const u=$(`-${a}`);return r?`${l}, ${u} ${s}`:`${u}, ${l} ${s}`}return`${l} ${s}`}intersect(t,r){return t.some(i=>r.includes(i))}}const Qe=e=>(Array.isArray(e)?e:[e]).length===0?"":`
5
+ ${e.map(r=>r.optionList?new Ue(r).toString():new He(r).toString()).join(`
6
+ `)}`,H=(e,t)=>{const i=`${t==="readme"?e.name.toUpperCase():e.name}${e.multiple===!0?"...":""}`;return e.required===!0?t==="readme"?i:`<${i}>`:`[${i}]`},et=(e,t="help")=>e.argument?e.argument.hidden?"":t==="readme"?` ${H(e.argument,t)}`:" [positional arguments]":!e.arguments||e.arguments.length===0?"":e.arguments.filter(r=>!r.hidden).map(r=>` ${H(r,t)}`).join("");export{Qe as c,et as f,h as t};
@@ -0,0 +1 @@
1
+ const t=(a,d)=>async()=>({default:(await a())[d]});export{t as lazyNamed};
@@ -0,0 +1,27 @@
1
+ const q=globalThis.process??Object.create(null),M={versions:{}},w=new Proxy(q,{get(e,t){if(t in e)return e[t];if(t in M)return M[t]}}),D=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
+ `),Y=(e,t,n,o)=>{const r={column:0,line:-1,...e.start},i={...r,...e.end},l=r.line,s=r.column,a=i.line,d=i.column;let c=Math.max(l-(n+1),0),m=Math.min(t.length,a+o);l===-1&&(c=0),a===-1&&(m=t.length);const p=a-l,f={};if(p)for(let u=0;u<=p;u++){const h=u+l;if(!s)f[h]=!0;else if(u===0){const $=t[h-1]?.length;f[h]=[s,($??0)-s+1]}else if(u===p)f[h]=[0,d];else{const $=t[h-u]?.length;f[h]=[0,$]}}else s===d?f[l]=s?[s,0]:!0:f[l]=[s,(d??0)-(s??0)];return{end:m,markerLines:f,start:c}},H=w.platform==="win32"&&!w.env?.WT_SESSION?">":"❯",K=(e,t,n)=>{const o={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:u=>u,marker:u=>u,message:u=>u,...n?.color}},r=typeof t.start.column=="number";let i=(e.includes("\r")?D(e):e).split(`
3
+ `);typeof o.tabWidth=="number"&&e.includes(" ")&&(i=i.map(u=>u.replaceAll(" "," ".repeat(o.tabWidth))));const{end:l,markerLines:s,start:a}=Y(t,i,o.linesAbove,o.linesBelow),d=String(l).length,{gutter:c,marker:m,message:p}=o.color;let f=i.slice(a,l).map((u,h)=>{const $=a+1+h,x=s[$],R=String($).padStart(d),z=!s[$+1],N=` ${R}${o.showGutter?" |":""}`;if(x){let k="";if(Array.isArray(x)){const _=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(x[0]-1,0)),U=x[1]||1;k=[`
4
+ `,o.prefix+c(N.replaceAll(/\d/g," "))," ",_,m("^").repeat(U)].join(""),z&&o.message&&(k+=` ${p(o.message)}`)}return[o.prefix+m(H),c(N),u.length>0?` ${u}`:"",k].join("")}return`${o.prefix} ${c(N)}${u.length>0?` ${u}`:""}`}).join(`
5
+ `);return o.message&&!r&&(f=`${o.prefix+" ".repeat(d+1)+o.message}
6
+ ${f}`),f},S=e=>{let t;return()=>{if(t===void 0){if(typeof w.getBuiltinModule!="function")throw new TypeError(`[@visulima/error] Cannot load ${e}: this runtime implements no process.getBuiltinModule(). Requires Node ^22.14.0 || >=24.10.0, or another runtime providing process.getBuiltinModule().`);t=w.getBuiltinModule(e)}return t}},Q=()=>w.env?.DEBUG==="true",g=(e,...t)=>{if(Q()){const n=t.map(o=>typeof o=="function"?o():o);console.debug(`error:parse-stacktrace: ${e}`,...n)}},y="<unknown>",X=/^(?:node:internal\/|node:|internal\/)/,Z=e=>e!==void 0&&X.test(e),ee=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,te=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ne=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,oe=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,ie=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,re=/in\s(.*)\s\(at\s(.+)\)\sat/,se=/^(?:.*@)?(.*):(\d+):(\d+)$/,le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ae=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ce=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,L=/\(error: ([^)]*)\)/,de=/at\s/,ue=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,fe=/Error: |AggregateError:/,W=/^Anonymous function$/,me=/^\s*in\s.*/,pe=/^.*?\s*at\s.*/,he=/^.*?\s*@.*|\[native code\]/,O=(e,t)=>{const n=e.includes("safari-extension"),o=e.includes("safari-web-extension");return n||o?[e.includes("@")?e.split("@")[0]:y,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},B=(e,t)=>{const n=ne.exec(t);n&&(e.file=n[1],e.line=+n[2],e.column=+n[3])},ve=e=>{const t=re.exec(e);if(t){g(`parse nested node error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const o=t[2].split(":");return{column:o[2]?+o[2]:void 0,file:o[0],line:o[1]?+o[1]:void 0,methodName:t[1]??y,raw:e,type:void 0}}const n=ie.exec(e);if(n){g(`parse node error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`);const o={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(de,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??y,raw:e,type:e.startsWith("internal")?"internal":void 0};return B(o,`${n[2]}:${n[3]}:${n[4]}`),o}},$e=e=>{const t=ee.exec(e);if(t){g(`parse chrome error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const n=t[2]?.startsWith("native"),o=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let r,i;if(o){const d=te.exec(e);if(d){const c=ue.exec(d[1]);c?(t[2]=c[4]??c[1],t[3]=c[5]??c[2],t[4]=c[3]):d[2]&&(t[2]=d[1]),d[2]&&(r={column:d[4]?+d[4]:void 0,file:d[2],line:d[3]?+d[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const c=oe.exec(e);c&&(i={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},r={column:c[6]?+c[6]:void 0,file:c[1],line:c[5]?+c[5]:void 0,methodName:"eval",raw:c[0],type:"eval"})}}const[l,s]=O(t[1]?t[1].replace(W,"<anonymous>"):y,t[2]),a={column:t[4]?+t[4]:void 0,evalOrigin:r,file:s,line:t[3]?+t[3]:void 0,methodName:l,raw:e,type:o?"eval":n?"native":Z(s)?"internal":void 0};return i?(a.column=i.column,a.file=i.file,a.line=i.line):B(a,`${s}:${t[3]}:${t[4]}`),a}},ge=(e,t)=>{const n=le.exec(e);if(n){g(`parse gecko error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`);const o=n[3]?.includes(" > eval"),r=o&&n[3]&&ae.exec(n[3]);let i;o&&r&&(n[3]=r[1],i={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:e,type:"eval"},n[4]=r[2]);const[l,s]=O(n[1]?n[1].replace(W,"<anonymous>"):y,n[3]);let a;(t?.type==="safari"||!o&&t?.type==="firefox")&&t.column?a=t.column:!o&&n[5]&&(a=+n[5]);let d;return(t?.type==="safari"||!o&&t?.type==="firefox")&&t.line?d=t.line:n[4]&&(d=+n[4]),{column:a,evalOrigin:i,file:s,line:d,methodName:l,raw:e,type:o?"eval":s.includes("[native code]")?"native":void 0}}},ye=(e,t)=>{const n=ce.exec(e);if(!(n&&n[2].includes(" > eval"))&&n)return g(`parse firefox error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:t?.column??void 0,file:n[2],line:n[3]?+n[3]:t?.line??void 0,methodName:n[1]||y,raw:e,type:void 0}},we=e=>{const t=se.exec(e);if(t)return g(`parse react android native error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`),{column:t[3]?+t[3]:void 0,file:t[1],line:t[2]?+t[2]:void 0,methodName:y,raw:e,type:void 0}},xe=/(?:^|[(@\s])(?:node:internal\/|node:|internal\/)/,be=/node_modules[/\\]/,Oe={internals:e=>!xe.test(e),nodeModules:e=>!be.test(e)},Be=(...e)=>t=>e.every(n=>n(t)),T=(e,{filter:t,frameLimit:n=50}={})=>{const o=e;let r=(typeof o.stacktrace=="string"?o.stacktrace:e.stack??"").split(`
7
+ `).map(i=>(L.test(i)?i.replace(L,"$1"):i).trim()).filter(i=>!fe.test(i)&&i!=="eval code");return t&&(r=r.filter(i=>t(i))),r=r.slice(0,n),r.reduce((i,l,s)=>{if(!l||l.length>1024)return i;let a;if(me.test(l))a=ve(l);else if(pe.test(l))a=$e(l);else if(he.test(l)){let d;if(s===0){const c=e,m=c.columnNumber,p=c.lineNumber,f=c.line,u=c.column;m||p?d={column:m,line:p,type:"firefox"}:(f||u)&&(d={column:u,line:f,type:"safari"})}a=ye(l,d)??ge(l,d)}else a=we(l);return a?i.push(a):g(`parse error stack line: "${l}"`,"not parser found"),i},[])},C=S("node:fs"),b=S("node:path"),Se=S("node:process"),Ne=S("node:url"),v=(e,t,n)=>n===0?e:t===" "?e+" ".repeat(n):e+" ".repeat(t*n),j=e=>e.replaceAll("\\","/"),ke=e=>{if(!e.startsWith("file:"))return e;try{return Ne().fileURLToPath(e)}catch{return e}},Ee=(e,t)=>{const n=e.replace("async file:","file:");return j(b().relative(t,ke(n)))},Ae=(e,t,n)=>{if(t)return n.title(e.message);const o=e.message?`: ${e.message}`:"";return n.title(e.name+o)},V=(e,{color:t,hideErrorTitle:n,indentation:o,prefix:r},i)=>`${v(r,o,i)}${Ae(e,n,t)}
8
+ `,P=(e,{color:t,indentation:n,prefix:o},r)=>{if(e.hint===void 0)return;const i=v(o,n,r);let l="";if(Array.isArray(e.hint))for(const s of e.hint)l+=`${i+s}
9
+ `;else l+=i+e.hint;return t.hint(l)},E=(e,t)=>{if(!t||e.file===void 0||e.line===void 0)return{trace:e};try{const n=t({column:e.column,file:e.file,line:e.line});return n?{source:n.source,trace:{...e,column:n.column??e.column,file:n.file??e.file,line:n.line??e.line}}:{trace:e}}catch{return{trace:e}}},A=(e,t,n=0)=>{const{color:o,cwd:r,displayShortPath:i,indentation:l,prefix:s}=t,{trace:a}=e;let d;a.file===void 0?d="<unknown>":d=i?Ee(a.file,r):j(a.file);const{fileLine:c,method:m}=o;return`${v(s,l,n)}at ${a.methodName?`${m(a.methodName)} `:""}${c(d)}:${c(a.line?.toString()??"")}`},Me=(e,t)=>{if(t.allowAllFilePaths)return!0;const n=b().resolve(t.cwd),o=b().resolve(n,e);return o===n||o.startsWith(n+b().sep)},Le=e=>{try{return C().existsSync(e)?C().readFileSync(e,"utf8"):void 0}catch{return}},I=(e,t,n)=>{const{color:o,indentation:r,linesAbove:i,linesBelow:l,prefix:s,showGutter:a,showLineNumbers:d,tabWidth:c}=t,{source:m,trace:p}=e;if(p.file===void 0)return;let f;if(m===void 0){const u=p.file.replace("file://","");if(!Me(u,t))return;const h=Le(u);if(h===void 0)return;f=h}else f=m;return K(f,{start:{column:p.column,line:p.line}},{color:o,linesAbove:i,linesBelow:l,prefix:v(s,r,n),showGutter:a,showLineNumbers:d,tabWidth:c})},J=(e,t,n)=>{if(e.errors.length===0)return;let o=`${v(t.prefix,t.indentation,n)}Errors:
10
+
11
+ `,r=!0;for(const i of e.errors)r?r=!1:o+=`
12
+
13
+ `,o+=F(i,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},n+1);return`
14
+ ${o}`},Ce=e=>{if(typeof e=="object"&&e!==null)try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}return String(e)},G=(e,t,n,o=new Set)=>{o.add(e);let r=`${v(t.prefix,t.indentation,n)}Caused by:
15
+
16
+ `;const{cause:i}=e;if(!(i instanceof Error)){const a=Ce(i);return r+=`${v(t.prefix,t.indentation,n)}${t.color.title(a)}
17
+ `,`
18
+ ${r}`}r+=V(i,t,n);const l=T(i).shift(),s=P(i,t,n);if(s&&(r+=`${s}
19
+ `),l){const a=E(l,t.sourceMap);if(r+=A(a,t,n),!t.hideErrorCauseCodeView){const d=I(a,t,n);d!==void 0&&(r+=`
20
+ ${d}`)}}if(i instanceof AggregateError){const a=J(i,t,n);a!==void 0&&(r+=`
21
+ ${a}`)}return i.cause&&(r+=o.has(i)?`
22
+ ${v(t.prefix,t.indentation,n+1)}Caused by: [Circular]`:`
23
+ ${G(i,t,n+1,o)}`),`
24
+ ${r}`},We=(e,t)=>(e.length>0?`
25
+ `:"")+e.map(n=>A(E(n,t.sourceMap),t)).join(`
26
+ `),F=(e,t,n)=>{const o={allowAllFilePaths:!1,cwd:Se().cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:s=>s,gutter:s=>s,hint:s=>s,marker:s=>s,message:s=>s,method:s=>s,title:s=>s,...t.color}},r=T(e,{filter:t.filterStacktrace,frameLimit:o.framesMaxLimit}),i=r.shift(),l=i?E(i,o.sourceMap):void 0;return[t.hideMessage?void 0:V(e,o,n),P(e,o,n),l?A(l,o,n):void 0,l&&!o.hideErrorCodeView?I(l,o,n):void 0,e instanceof AggregateError?J(e,o,n):void 0,e.cause===void 0||e.cause===null?void 0:G(e,o,n),r.length>0?We(r,o):void 0].filter(Boolean).join(`
27
+ `)},Te=(e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return F(e,t,0)};export{K as C,T as Q,Oe as Y,Be as q,S as r,H as y,Te as z};
@@ -0,0 +1 @@
1
+ const o=e=>"Deno"in e,t=e=>"Bun"in e,i=()=>{if(o(globalThis)){const e=globalThis.Deno,n=e.execPath();let s=n;try{const{importMeta:r}=globalThis;r?.url&&(s=r.url)}catch{}return[n,s,...e.args]}return process.argv},c=()=>o(globalThis)?globalThis.Deno.cwd():process.cwd(),a=()=>{if(o(globalThis)){const e=globalThis.Deno;return new Proxy(e.env.toObject(),{get:(n,s)=>typeof s=="string"?e.env.get(s):n[s],has:(n,s)=>typeof s=="string"?e.env.has(s):s in n,set:(n,s,r)=>typeof s=="string"?(r===void 0||e.env.set(s,r),!0):!1})}return process.env},l=()=>o(globalThis)?[]:process.execArgv,g=()=>o(globalThis)?globalThis.Deno.execPath():process.execPath,u=()=>{if(o(globalThis)){const n=globalThis.Deno.build?.os??"unknown";return n==="windows"?"win32":n}return process.platform},h=()=>{if(o(globalThis)){const n=globalThis.Deno.build?.arch??"unknown";return n==="x86_64"?"x64":n==="aarch64"?"arm64":n}return process.arch},f=()=>{if(o(globalThis)){const e=globalThis.Deno,n={};return e.version?.deno&&(n.deno=e.version.deno),e.version?.v8&&(n.v8=e.version.v8),e.version?.typescript&&(n.typescript=e.version.typescript),n}if(t(globalThis)){const e=globalThis.Bun,n={...process.versions};return e.version&&(n.bun=e.version),n}return process.versions},b=(e=0)=>{if(o(globalThis))throw globalThis.Deno.exit(e),new Error("Deno exit failed");process.exit(e)},d=(e,n)=>{if(o(globalThis))return()=>{};const s=process;return s.on(e,n),()=>{s.removeListener(e,n)}};export{u as a,h as b,a as c,i as d,b as e,c as f,f as g,g as h,l as i,d as o};
@@ -1,5 +1,5 @@
1
+ import { P as Plugin } from "../packem_shared/command.d-CLlirnwR.js";
1
2
  import { O as Options$1 } from "../packem_shared/index.d-CnnVYgSZ.js";
2
- import { P as Plugin } from "../packem_shared/command.d-B_G9vIYJ.js";
3
3
  import '@visulima/tabular';
4
4
  type ErrorHandlerOptions = {
5
5
  /**
@@ -1 +1 @@
1
- import{G as m}from"../packem_shared/renderError-BISXNU8L-B47ZikMV.js";import{e as h}from"../packem_shared/runtime-process-BEw54Ar-.js";const u=(s={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:r,runtime:t}=n,{concise:l,detailed:o=!1,exitOnError:a=!0,formatter:i,logErrors:d=!0,renderOptions:f={}}=s;if(d)if(i)r.error(i(e));else if(!o&&l?.(e))r.error(e.message);else if(o){const c=t.getCwd(),g=m(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...f});r.error(g)}else r.error(e);a&&h(1)},version:"1.0.0"});export{u as errorHandlerPlugin};
1
+ import{z as h}from"../packem_shared/renderError-CIIYTTfx-BdX-afLI.js";import{e as m}from"../packem_shared/runtime-process-BN-eTlwy.js";const w=(i={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,s)=>{const{logger:r,runtime:t}=s,{concise:l,detailed:o=!1,exitOnError:d=!0,formatter:n,logErrors:a=!0,renderOptions:f={}}=i;if(a)if(n)r.error(n(e));else if(!o&&l?.(e))r.error(e.message);else if(o){const c=t.getCwd(),g=h(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...f});r.error(g)}else r.error(e);d&&m(1)},version:"1.0.0"});export{w as errorHandlerPlugin};
@@ -1,4 +1,4 @@
1
- import { P as Plugin } from "../packem_shared/command.d-B_G9vIYJ.js";
1
+ import { P as Plugin } from "../packem_shared/command.d-CLlirnwR.js";
2
2
  import '@visulima/tabular';
3
3
  type RuntimeType = "bun" | "deno" | "node";
4
4
  type RuntimeVersionRequirement = {
@@ -1 +1 @@
1
- import{c as p,e as c,g as v}from"../packem_shared/runtime-process-BEw54Ar-.js";const i=r=>{if(!r||typeof r!="string")return 0;const o=r.split(".");if(o.length===0||!o[0])return 0;const e=Number.parseInt(o[0],10);return Number.isNaN(e)?0:e},a=r=>!r||typeof r!="string"?"":r.replace("v",""),d=()=>{if(typeof Bun<"u"){const e=Bun.version||"";return{major:i(e),type:"bun",version:e}}if(typeof Deno<"u"){const e=Deno.version?.deno||"";return{major:i(e),type:"deno",version:e}}const r=v().node??"",o=a(r);return{major:i(o),type:"node",version:o}},y=(r={})=>({description:"Checks if the current runtime version meets the minimum requirement",init:o=>{const e=d(),m={bun:1,deno:1,node:18};let n;try{const s=p().CEREBRO_MIN_NODE_VERSION,u=s===void 0?void 0:Number.parseInt(s,10);n=Number.isNaN(u)?void 0:u}catch{n=void 0}let t;r.runtimes?.[e.type]?.minVersion!==void 0?t=r.runtimes[e.type].minVersion:e.type==="node"&&n!==void 0?t=n:t=m[e.type],e.major<t&&(o.logger.error(`cerebro requires ${e.type} version ${String(t)} or higher. You have ${e.type} ${e.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`),c(1)),o.logger.debug(`Runtime version check passed: ${e.type} ${e.version} >= ${String(t)}`)},name:"runtime-version-check",version:"1.0.0"});export{y as runtimeVersionCheckPlugin};
1
+ import{c,e as a,g as v}from"../packem_shared/runtime-process-BN-eTlwy.js";const i=n=>{if(!n||typeof n!="string")return 0;const o=n.split(".");if(o.length===0||!o[0])return 0;const e=Number.parseInt(o[0],10);return Number.isNaN(e)?0:e},p=n=>!n||typeof n!="string"?"":n.replace("v",""),d=()=>{if(typeof Bun<"u"){const r=Bun.version||"";return{major:i(r),type:"bun",version:r}}if(typeof Deno<"u"){const r=Deno.version?.deno||"";return{major:i(r),type:"deno",version:r}}const o=v().node??"",e=p(o);return{major:i(e),type:"node",version:e}},g=(n={})=>({description:"Checks if the current runtime version meets the minimum requirement",init:o=>{const e=d(),s={bun:1,deno:1,node:18};let r;try{const u=c().CEREBRO_MIN_NODE_VERSION,m=u===void 0?void 0:Number.parseInt(u,10);r=Number.isNaN(m)?void 0:m}catch{r=void 0}let t;n.runtimes?.[e.type]?.minVersion!==void 0?t=n.runtimes[e.type].minVersion:e.type==="node"&&r!==void 0?t=r:t=s[e.type],e.major<t&&(o.logger.error(`cerebro requires ${e.type} version ${String(t)} or higher. You have ${e.type} ${e.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`),a(1)),o.logger.debug(`Runtime version check passed: ${e.type} ${e.version} >= ${String(t)}`)},name:"runtime-version-check",version:"1.0.0"});export{g as runtimeVersionCheckPlugin};
@@ -1,4 +1,4 @@
1
- import { a as CerebroFs, P as Plugin } from "../../packem_shared/command.d-B_G9vIYJ.js";
1
+ import { a as CerebroFs, P as Plugin } from "../../packem_shared/command.d-CLlirnwR.js";
2
2
  import '@visulima/tabular';
3
3
  type UpdateNotifierOptions = {
4
4
  alwaysRun?: boolean;
@@ -1 +1 @@
1
- import{VERBOSITY_DEBUG as p}from"../../packem_shared/VERBOSITY_DEBUG-XPultrIA.js";import{c as A}from"../../packem_shared/runtime-process-BEw54Ar-.js";var R={},i,C;function m(){return C||(C=1,i=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]),i}var U;function l(){return U||(U=1,(function(a){const r=m(),e=process.env;Object.defineProperty(a,"_vendors",{value:r.map(function(n){return n.constant})}),a.name=null,a.isPR=null,a.id=null,e.CI!=="false"&&r.forEach(function(n){const t=(Array.isArray(n.env)?n.env:[n.env]).every(function(o){return E(o)});a[n.constant]=t,t&&(a.name=n.name,a.isPR=I(n),a.id=n.constant)}),a.isCI=!!(e.CI!=="false"&&(e.BUILD_ID||e.BUILD_NUMBER||e.CI||e.CI_APP_ID||e.CI_BUILD_ID||e.CI_BUILD_NUMBER||e.CI_NAME||e.CONTINUOUS_INTEGRATION||e.RUN_ID||a.name));function E(n){return typeof n=="string"?!!e[n]:"env"in n?e[n.env]&&e[n.env].includes(n.includes):"any"in n?n.any.some(function(t){return!!e[t]}):Object.keys(n).every(function(t){return e[t]===n[t]})}function I(n){switch(typeof n.pr){case"string":return!!e[n.pr];case"object":return"env"in n.pr?"any"in n.pr?n.pr.any.some(function(t){return e[n.pr.env]===t}):n.pr.env in e&&e[n.pr.env]!==n.pr.ne:"any"in n.pr?n.pr.any.some(function(t){return!!e[t]}):E(n.pr);default:return null}}})(R)),R}var P=l();const d=5e3,N=(a={})=>({beforeCommand:async r=>{const{fs:e,logger:E,runtime:I}=r,n=I.getPackageName(),t=I.getPackageVersion();if(!n||!t){E.debug("Update notifier: package name or version not provided, skipping...");return}const o=A(),c={alwaysRun:!1,debug:o.CEREBRO_OUTPUT_LEVEL===String(p),distTag:"latest",fs:e,pkg:{name:n,version:t},timeout:d,updateCheckInterval:1e3*60*60*24,...a};if(!(c.alwaysRun||!(o.NO_UPDATE_NOTIFIER||o.NODE_ENV==="test"||r.argv.includes("--no-update-notifier")||P.isCI))){E.debug("Update notifier: skipping check (disabled by environment or flags)");return}try{const _=await(await import("../../packem_chunks/has-new-version.js").then(s=>s.default))(c);if(_){const[{boxen:s},{dim:L,green:v,reset:T,yellow:u}]=await Promise.all([import("@visulima/boxen"),import("@visulima/colorize")]),D=`Update available ${L(t)}${T(" → ")}${v(_)}`;E.log(s(D,{borderColor:S=>u(S),borderStyle:"round",margin:1,padding:1,textAlignment:"center"}))}}catch(_){E.debug("Update notifier: failed to check for updates",_)}},description:"Checks for package updates and notifies users",name:"update-notifier",version:"1.0.0"});export{N as updateNotifierPlugin};
1
+ import{VERBOSITY_DEBUG as m}from"../../packem_shared/VERBOSITY_DEBUG-D7HfSD5l.js";import{c as l}from"../../packem_shared/runtime-process-BN-eTlwy.js";var i={},R,U;function v(){return U||(U=1,R=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]),R}var L;function P(){return L||(L=1,(function(a){const s=v(),e=process.env;Object.defineProperty(a,"_vendors",{value:s.map(function(n){return n.constant})}),a.name=null,a.isPR=null,a.id=null,e.CI!=="false"&&s.forEach(function(n){const r=(Array.isArray(n.env)?n.env:[n.env]).every(function(o){return E(o)});a[n.constant]=r,r&&(a.name=n.name,a.isPR=I(n),a.id=n.constant)}),a.isCI=!!(e.CI!=="false"&&(e.BUILD_ID||e.BUILD_NUMBER||e.CI||e.CI_APP_ID||e.CI_BUILD_ID||e.CI_BUILD_NUMBER||e.CI_NAME||e.CONTINUOUS_INTEGRATION||e.RUN_ID||a.name));function E(n){return typeof n=="string"?!!e[n]:"env"in n?e[n.env]&&e[n.env].includes(n.includes):"any"in n?n.any.some(function(t){return!!e[t]}):Object.keys(n).every(function(t){return e[t]===n[t]})}function I(n){switch(typeof n.pr){case"string":return!!e[n.pr];case"object":return"env"in n.pr?"any"in n.pr?n.pr.any.some(function(t){return e[n.pr.env]===t}):n.pr.env in e&&e[n.pr.env]!==n.pr.ne:"any"in n.pr?n.pr.any.some(function(t){return!!e[t]}):E(n.pr);default:return null}}})(i)),i}var O=P();const N=5e3,g=(a={})=>({beforeCommand:async s=>{const{fs:e,logger:E,runtime:I}=s,n=I.getPackageName(),t=I.getPackageVersion();if(!n||!t){E.debug("Update notifier: package name or version not provided, skipping...");return}const r=l(),o={alwaysRun:!1,debug:r.CEREBRO_OUTPUT_LEVEL===String(m),distTag:"latest",fs:e,pkg:{name:n,version:t},timeout:N,updateCheckInterval:1e3*60*60*24,...a};if(!(!!o.alwaysRun||!(r.NO_UPDATE_NOTIFIER||r.NODE_ENV==="test"||s.argv.includes("--no-update-notifier")||O.isCI))){E.debug("Update notifier: skipping check (disabled by environment or flags)");return}try{const C=await(await import("../../packem_chunks/has-new-version.js").then(_=>_.default))(o);if(C){const[{boxen:_},{dim:u,green:T,reset:D,yellow:p}]=await Promise.all([import("@visulima/boxen"),import("@visulima/colorize")]),S=`Update available ${u(t)}${D(" → ")}${T(C)}`;E.log(_(S,{borderColor:A=>p(A),borderStyle:"round",margin:1,padding:1,textAlignment:"center"}))}}catch(c){E.debug("Update notifier: failed to check for updates",c)}},description:"Checks for package updates and notifies users",name:"update-notifier",version:"1.0.0"});export{g as updateNotifierPlugin};
@@ -1 +1 @@
1
- import{createRequire as g}from"node:module";import{d as y,h as b,c as j,e as d,i as M}from"../../packem_shared/runtime-process-BEw54Ar-.js";let _;const h=e=>(_??=g(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,s]=o.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return o.getBuiltinModule(e)}return h(e)},{execFileSync:v}=u("node:child_process"),{totalmem:x}=u("node:os"),q=/--max-old-space-size=(\d+)/,z=/--max-semi-space-size=(\d+)/,E=e=>Math.floor(x()/1024/1024*e),P=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,l=(e,t)=>{for(const s of t){const r=e.exec(s);if(r)return Number.parseInt(r[1],10)}},A=e=>{const t=e?.maxOldSpacePercent??.75,s=[...M()],r=[...y()],n=l(q,s),c=l(z,s);if(n!==void 0&&c!==void 0)return;const a=n??E(t),m=c??P(a),i=[];if(n===void 0&&i.push(`--max-old-space-size=${String(a)}`),c===void 0&&i.push(`--max-semi-space-size=${String(m)}`),i.length!==0)try{v(b(),[...i,...s,...r.slice(1)],{env:j(),stdio:"inherit"}),d(0)}catch(f){const p=f.status;d(typeof p=="number"?p:1)}};export{A as applyHeapTuning};
1
+ import{createRequire as _}from"node:module";import{i as S,d as E,h as y,c as A,e as p}from"../../packem_shared/runtime-process-BN-eTlwy.js";let m;const h=e=>(m??=_(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[s,t]=r.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return r.getBuiltinModule(e)}return h(e)},{execFileSync:v}=g("node:child_process"),{totalmem:x}=g("node:os"),b=/--max-old-space-size=(\d+)/,j=/--max-semi-space-size=(\d+)/,z=e=>Math.floor(x()/1024/1024*e),P=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,f=(e,s)=>{for(const t of s){const o=e.exec(t);if(o)return Number.parseInt(o[1],10)}},M=e=>{const s=e?.maxOldSpacePercent??.75,t=[...S()],o=[...E()],c=f(b,t),i=f(j,t);if(c!==void 0&&i!==void 0)return;const a=c??z(s),l=i??P(a),n=[];if(c===void 0&&n.push(`--max-old-space-size=${String(a)}`),i===void 0&&n.push(`--max-semi-space-size=${String(l)}`),n.length!==0)try{v(y(),[...n,...t,...o.slice(1)],{env:A(),stdio:"inherit"}),p(0)}catch(d){const u=d.status;p(typeof u=="number"?u:1)}};export{M as applyHeapTuning};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
5
5
  "keywords": [
6
6
  "ansi",
@@ -124,7 +124,7 @@
124
124
  "fastest-levenshtein": "^1.0.16"
125
125
  },
126
126
  "peerDependencies": {
127
- "@bomb.sh/tab": ">=0.0.16",
127
+ "@bomb.sh/tab": ">=0.0.22",
128
128
  "@visulima/boxen": "4.0.0",
129
129
  "@visulima/find-cache-dir": "3.0.1",
130
130
  "@visulima/pail": "4.1.1",
@@ -1,4 +0,0 @@
1
- import{createRequire as je}from"node:module";import{VERBOSITY_DEBUG as M,POSITIONALS_KEY as Z,VERBOSITY_NORMAL as ee,VERBOSITY_QUIET as Ge,VERBOSITY_VERBOSE as Ye}from"./VERBOSITY_DEBUG-XPultrIA.js";import{t as w}from"./cerebro-error-DWpjBY_M.js";import{c as Q,d as ae,o as ue,e as U,a as He,b as Ke,f as Je,h as Ze,i as Qe}from"./runtime-process-BEw54Ar-.js";import{h as Y}from"./VisulimaError-DTMgXonA-CzaryRgZ.js";import{k as Xe,W as et}from"./split-by-case-BZ6XOTIf.js";import{distance as tt}from"fastest-levenshtein";let Se;const Te=t=>(Se??=je(import.meta.url))(t),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ue=t=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[e,n]=W.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return W.getBuiltinModule(t)}return Te(t)},{writeFile:Be,stat:Re,rm:ze,readFile:de,readdir:Fe,mkdir:qe,access:We}=Ue("node:fs/promises"),K=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let S=class extends w{commandName;constructor(e,n=[]){const o=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(o,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}},Ce=class extends w{option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}},nt=class extends w{unknownOptions;constructor(e,n){const o=e.join(", "),s=`Found unknown ${e.length===1?"option":"options"}: ${o}`;super(s,"UNKNOWN_OPTION",{suggestions:n,unknownOptions:e}),this.name="UnknownOptionError",this.unknownOptions=e,n&&n.length>0&&(this.hint=`Did you mean: ${n.join(", ")}?`)}},ot=class extends w{pluginName;constructor(e,n,o){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:o,pluginName:e}),this.name="PluginError",this.pluginName=e,o&&(this.cause=o)}},it=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);Q().CEREBRO_OUTPUT_LEVEL===String(M)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const o of n)if(typeof o.init=="function"){this.logger.debug(`initializing plugin: ${o.name}`);try{await o.init(e)}catch(s){const i=new ot(o.name,`Failed to initialize: ${s instanceof Error?s.message:String(s)}`,s instanceof Error?s:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,o){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const s=this.getDependencyOrder();for(const i of s){const l=i[e];if(typeof l=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?l(n,o):l(n))}catch(a){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,a),a}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const o=this.getDependencyOrder();for(const s of o)if(typeof s.onError=="function"){this.logger.debug(`executing error handler for plugin: ${s.name}`);try{await s.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${s.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,o=new Set,s=i=>{if(n.has(i))return;if(o.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const l=this.plugins.get(i);if(!l)throw new Error(`Plugin "${i}" not found`);if(o.add(i),l.dependencies)for(const a of l.dependencies)s(a);o.delete(i),n.add(i),e.push(l)};for(const i of this.plugins.keys())s(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};const G=t=>t.type?.name==="Boolean",st=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},me=t=>(G(t)||(t.typeLabel=t.typeLabel??st(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),at=new RegExp(/^-([^\d-])$/),rt=new RegExp(/^--(\S+)/),lt=new RegExp(/^-([^\d-]{2,})$/),ct=t=>at.test(t)||rt.test(t)||lt.test(t),dt=(t,e)=>{const n=e[0]&&ct(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}};let ut=class xe extends Y{optionName;value;constructor(e,n,o){super({hint:`Pass a valid ${o} value for '${e}'.`,message:`Invalid ${o} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,xe.prototype)}},mt=class Ie extends Y{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,Ie.prototype)}},he=class ke extends Y{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,ke.prototype)}},ht=class Ee extends Y{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,Ee.prototype)}};class O extends Y{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,O.prototype)}}const B=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",re=t=>t===Number||typeof t=="function"&&t.name==="Number",pe=t=>t===String||typeof t=="function"&&t.name==="String",fe=(t,e,n)=>{const o=Number(t);if(e&&Number.isNaN(o)&&String(t).trim().toLowerCase()!=="nan")throw new ut(n??"",String(t),"Number");return o},pt=(t,e,n={})=>{const{optionName:o,strictTypes:s}=n;return Array.isArray(t)?B(e)?t.map(Boolean):re(e)?t.map(i=>fe(i,s,o)):pe(e)?t.map(String):t.map(i=>e(String(i))):t===null?null:B(e)?!!t:re(e)?fe(t,s,o):pe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},b=(t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},ft=/-([a-z])/g,gt=/^\d+$/,wt=t=>t.codePointAt(0)===95,ge=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],we=t=>t==="__proto__"||t==="constructor"||t==="prototype",te=(t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},ye=(t,e,n,o,s)=>{let i=e.get(t)??n.get(t);if(!i&&o){const l=t.toLowerCase();i=o.get(l)??s?.get(l)}return i},yt=(t,e,n,o)=>{const s=n.debug??!1;b(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),b(s,"Starting argument resolution","resolver"),b(s,"Tokens:","resolver",t),b(s,"Definitions:","resolver",e),b(s,"Processing tokens...","resolver");const i=new Map,l=new Map,a=n.caseInsensitive?new Map:void 0,d=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,m=n.camelCase?new Map:void 0;for(const c of e)if(i.set(c.name,c),c.alias&&l.set(c.alias,c),n.caseInsensitive&&a&&(a.set(c.name.toLowerCase(),c),c.alias&&d&&d.set(c.alias.toLowerCase(),c)),n.camelCase&&r&&m){const u=c.name.replaceAll(ft,(p,_)=>_.toUpperCase());r.set(c.name,u),m.set(u,c.name)}const h=Object.create(null),f=Object.create(null),N=[],P=[],A=new Set;let V=!1;const y=e.find(c=>c.defaultOption),$=e.some(c=>c.group),E=e.find(c=>re(c.type));for(let c=0;c<t.length;c++){const u=t[c];if(u.kind==="option-terminator"){h._unknown=o.slice(u.index),V=!0;break}if(u.kind==="option"&&u.name){let p=ye(u.name,i,l,a,d);!p&&u.value===void 0&&E&&gt.test(u.name)&&(p=E,u.value=u.name,u.name=E.name);let _=!1;if(!p&&n.negation&&u.value===void 0&&u.name.startsWith("no-")){const v=u.name.slice(3),k=ye(v,i,l,a,d);k?.type&&B(k.type)&&(p=k,_=!0)}const g=p?p.name:u.name,x=p?.multiple,I=p?.lazyMultiple;if(Object.hasOwn(f,g)&&f[g]!==void 0&&!x&&!I&&!n.partial)throw new mt(g);if(!p&&n.partial){const v=u.rawName??`--${u.name}${u.value!==void 0&&u.inlineValue?`=${u.value}`:""}`;N.push({index:u.index,value:v});continue}if(!p&&n.stopAtFirstUnknown){h._unknown=o.slice(u.index);break}if(!p&&!n.partial)throw new he(u.name);if(u.value===void 0){const v=t[c+1],k=v?.kind==="option"&&!("name"in v)&&v.value!==void 0,L=v&&p&&!(p.type&&B(p.type))&&(v.kind==="positional"||k),Ve=p&&p.defaultOption&&!p.multiple&&!p.lazyMultiple;if(L&&(!p?.defaultOption||Ve))if(x){let D=c+1;const X=[];for(;D<t.length&&(t[D].kind==="positional"||t[D].kind==="option"&&!("name"in t[D])&&t[D].value!==void 0);)X.push(t[D].value),A.add(t[D].index),D++;f[g]=f[g]===void 0?X:ge(f[g],X),c=D-1}else I?(te(f,g,v.value,!0),A.add(v.index),c++):(f[g]=v.value,A.add(v.index),c++);else p?.type&&B(p.type)?te(f,g,!_,x):(x||I)&&f[g]!==void 0?te(f,g,null,!0):f[g]=x?[]:null}else{let{value:v}=u;if(p?.type&&B(p.type))switch(v){case"":{if(n.partial){const L=`${u.rawName??`--${u.name}`}${u.value?`=${u.value}`:""}`;P.push({index:u.index,value:L}),v=!0}else throw new he(u.name);break}case"false":{v=!1;break}case"true":{v=!0;break}default:v=!0}const k=[v];if(x){let L=c+1;for(;L<t.length&&t[L].kind==="positional";)k.push(t[L].value),A.add(t[L].index),L++;c=L-1}f[g]===void 0?f[g]=x||I?k:v:x||I?f[g]=ge(f[g],k):f[g]=v}}else if(u.kind==="positional"&&n.stopAtFirstUnknown&&!A.has(u.index)&&!y){b(s,`Found unconsumed positional token at index ${String(u.index)}, stopping processing`,"resolver"),h._unknown=o.slice(u.index);break}}for(const[c,u]of Object.entries(f)){const p=i.get(c);p&&(p.multiple||p.lazyMultiple)&&!Array.isArray(u)&&(f[c]=[u])}const z=c=>c.kind==="option"&&!i.has(c.name??"")&&!l.has(c.name??"")&&(!n.caseInsensitive||!a?.has(c.name?.toLowerCase()??"")&&!d?.has(c.name?.toLowerCase()??""));let C=-1,H=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!V&&(C=t.findIndex(c=>z(c)),C!==-1&&(H=t[C].index)),y){const c=[],u=[];for(const p of t)p.kind==="positional"&&!A.has(p.index)&&p.index<H&&(c.push(p.value),u.push(p));if(c.length>0){const p=f[y.name],_=y.multiple??y.lazyMultiple;p===void 0?_?(u.forEach(g=>A.add(g.index)),f[y.name]=c):(A.add(u[0].index),f[y.name]=c[0]):_&&(u.forEach(g=>A.add(g.index)),f[y.name]=Array.isArray(p)?[...c,...p]:[...c,p])}}if(!n.partial){for(const c of t)if(c.kind==="positional"&&!A.has(c.index))throw new ht(o[c.index])}if(n.partial&&!n.stopAtFirstUnknown){const c=[...N];for(const u of P)c.push({index:u.index,value:u.value});for(const u of t)u.kind==="positional"&&!A.has(u.index)&&c.push({index:u.index,value:o[u.index]});c.length>0&&(c.sort((u,p)=>u.index-p.index),h._unknown=c.map(u=>u.value))}if(n.stopAtFirstUnknown&&!V){const c=t.findIndex(p=>p.kind==="positional"&&!A.has(p.index));let u=-1;if(C!==-1&&c!==-1?u=Math.min(C,c):C!==-1?u=C:c!==-1&&(u=c),u>=0){const p=t[u].index;h._unknown=o.slice(p)}}for(const[c,u]of Object.entries(f)){const p=n.camelCase?r?.get(c)??c:c,_=i.get(c);_?.type?h[p]=pt(u,_.type,{optionName:_.name,strictTypes:n.strictTypes}):h[p]=u===void 0?null:u}for(const c of e){const u=n.camelCase?r?.get(c.name)??c.name:c.name;!(u in h)&&c.defaultValue!==void 0&&(c.multiple??c.lazyMultiple?h[u]=Array.isArray(c.defaultValue)?[...c.defaultValue]:[c.defaultValue]:h[u]=c.defaultValue)}if($){const c={},u={},p={};for(const g of e)if(g.group){const x=Array.isArray(g.group)?g.group:[g.group];for(const I of x)we(I)||(c[I]??={})}for(const g of Object.keys(h))if(!wt(g)){u[g]=h[g];let x=g;n.camelCase&&(x=m?.get(g)??g);const I=i.get(x);if(I?.group){const v=Array.isArray(I.group)?I.group:[I.group];for(const k of v)we(k)||c[k]&&(c[k][g]=h[g])}else p[g]=h[g]}const _={_all:u};for(const[g,x]of Object.entries(c))_[g]=x;Object.keys(p).length>0&&(_._none=p),h._unknown&&(_._unknown=h._unknown),Object.keys(h).forEach(g=>delete h[g]),Object.assign(h,_)}const ce=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));return b(s,"Final parsed result:","resolver",ce),ce},q="-".codePointAt(0),R="=",vt=R.codePointAt(0),Nt="--",$t="-",bt="--",Pe=t=>t.length>2&&t.startsWith(bt),At=t=>Pe(t)&&!t.includes(R,3),_t=t=>Pe(t)&&t.includes(R,3),Ot=t=>{if(t.length!==2||t.codePointAt(0)!==q||t.codePointAt(1)===q)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},Ct=t=>{if(t.length<=2||t.codePointAt(0)!==q||t.codePointAt(1)===q)return!1;const e=t.codePointAt(1);return!(e!==void 0&&e>=48&&e<=57)},xt=t=>{const e=[];let n=0,o=[],s=0,i=-1,l=0;for(;s<o.length||n<t.length;){let a;if(s<o.length?(a=o[s],s++):(a=t[n],n++),l>0?l--:i++,a===Nt){e.push({index:i,kind:"option-terminator"});const d=[...o.slice(s),...t.slice(n)],r=d.map((m,h)=>({index:i+h+1,kind:"positional",value:m}));e.push(...r),i+=d.length;break}if(Ot(a)){const d=a.charAt(1);e.push({index:i,kind:"option",name:d,rawName:a});continue}if(Ct(a)&&!a.includes(R)){const d=[];let r="",m=!1;for(let h=1;h<a.length;h++){const f=a.charAt(h);m?r+=f:f.codePointAt(0)===vt?m=!0:d.push(`${$t}${f}`)}if(m)if(d.length>0){const h=d.pop();d.push(`${h}=${r}`)}else d.push(r);o=s<o.length?[...d,...o.slice(s)]:d,s=0,l=d.length;continue}if(At(a)){const d=a.slice(2);e.push({index:i,kind:"option",name:d,rawName:a});continue}if(_t(a)){const d=a.indexOf(R),r=a.slice(2,d),m=a.slice(d+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:m});continue}if(a.length>2&&a.codePointAt(0)===q&&a.codePointAt(1)!==q&&a.includes(R)){const d=a.indexOf(R),r=a.charAt(1),m=a.slice(d+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:m});continue}e.push({index:i,kind:"positional",value:a})}return e},It=/\d/,kt=t=>typeof t=="function",Et=(t,e,n)=>{const o=n?.debug??!1;b(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,i=new Set,l=new Set,a=new Set;let d=0;for(const r of t){if(b(o,"Checking definition:","validation",r),!r.name)throw b(o,"Validation failed: name is required","validation"),new O("Invalid option definition: name is required");if(typeof r.name!="string")throw new O("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new O("Invalid option definition: name cannot be empty");const m=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&l.has(m))throw new O(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&a.has(m))throw new O(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&l.add(m),r.alias!==void 0){if(typeof r.alias!="string")throw new O("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new O("Invalid option definition: alias must be a single character");if(It.test(r.alias))throw new O("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new O('Invalid option definition: alias cannot be "-"');const h=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&a.has(h))throw new O(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&l.has(h))throw new O(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&a.add(h)}if(r.defaultOption&&(d++,r.type!==void 0&&B(r.type)))throw new O("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&kt(r.type)))throw new O("Invalid option definition: invalid type")}if(d>1)throw b(o,"Validation failed: multiple defaultOptions not allowed","validation"),new O("Invalid option definition: multiple defaultOptions not allowed");b(o,"Validation completed successfully","validation")};function Pt(t,e={}){const n=e.debug??!1;b(n,"Starting command-line-args parsing","index"),b(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const s=Array.isArray(t)?t:[t];b(n,"Normalized definitions:","index",s),Et(s,o.caseInsensitive,n?o:void 0);let{argv:i}=o;i??=process.argv.slice(2),b(n,"Using argv:","index",i);let l=i;o.caseInsensitive&&(l=i.map(r=>{if(r.startsWith("--")){const m=r.indexOf("="),h=(m===-1?r.slice(2):r.slice(2,m)).toLowerCase();return m===-1?`--${h}`:`--${h}${r.slice(m)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const m=r.indexOf("="),h=m===-1?r.slice(1):r.slice(1,m);if(!h)return r;const f=h.toLowerCase();return m===-1?`-${f}`:`-${f}${r.slice(m)}`}return r}));const a=xt(l.map(String));b(n,"Tokenized arguments:","index",a);const d=yt(a,s,o,i);return b(n,"Command-line-args parsing completed","index"),d}class Lt{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let ne=class extends w{commandName;constructor(e,n,o){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",o!==void 0&&(this.cause=o)}};const Dt=/^-{1,2}(\w+)(=(.+))?$/,Le=(t,e,n,o)=>{const s=Dt.exec(t);if(s===null)return{};const i=s[1];if(!i)return{};const l=n&&o?n.get(i)??o.get(i):e.find(a=>a.name===i||a.alias===i);return l!==void 0?{argName:l.name,argValue:s[3],option:l}:{}},ve=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},Mt=new Set(["0","1","false","true"]),Vt=(t,e,n,o)=>{if(e.length===0||t.length===0)return{};const s=(i,l)=>{const{argName:a,argValue:d,option:r}=Le(l,e,n,o),{lastOption:m}=i;return r&&G(r)&&d&&a?i.partial[a]=ve(d,r):i.lastName&&m&&G(m)&&Mt.has(l)&&(i.partial[i.lastName]=ve(l,m)),{lastName:a,lastOption:r,partial:i.partial}};return t.reduce(s,{partial:{}}).partial},jt=new Set(["0","1","false","true"]),St=(t,e,n,o)=>{if(e.length===0||t.length===0)return t;const s=(i,l)=>{const{argValue:a,option:d}=Le(l,e,n,o),{lastOption:r}=i;if(r&&G(r)&&jt.has(l)){const{args:m}=i;return{args:m.slice(0,-1)}}return d&&G(d)&&a?{args:i.args}:{args:[...i.args,l],lastOption:d}};return t.reduce(s,{args:[]}).args},Ne=t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},Tt=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},Ut=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Tt(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},Bt=/_./g,Rt=/^[A-Z]/,zt=t=>t.toLowerCase().replaceAll(Bt,e=>e[1]?.toUpperCase()??e).replace(Rt,e=>e.toLowerCase()),Ft=(t,e=Q())=>{if(!t||t.length===0)return{};const n={};for(const o of t){const s=e[o.name],i=Ut(o,s),l=i===void 0?o.defaultValue:i,a=zt(o.name);n[a]=l}return n},qt=t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of s)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},De=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ne(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new ne(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new ne(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},Wt=(t,e,n,o,s)=>{const i=new Lt(t.name,t),{_all:l,_unknown:a,positionals:d}=e,r=Object.keys(n).length>0?{...l,...n}:l;Z in r&&delete r[Z],i.argument=d?.[Z]??[],i.rawUnknown=[...a??[]];const m=Object.keys(o).length>0;return i.options=m?{...r,...o}:r,i.env=Ft(t.env,s),i},Gt=(t,e,n)=>{const o=t.options??[],s=o.length>0;let i=Ne(s?[...o,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:Z,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let l,a;if(s){const{optionMapByAlias:r,optionMapByName:m}=qt(o);l=St(e,o,m,r),a=Vt(e,o,m,r)}else l=e,a={};const d=Pt(i,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:a,parsedArgs:d}},oe=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await De(t))(e),Yt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Ht=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Kt=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const o=[];let s="",i="";for(let l=0;l<n;l++){const a=t[l];if(Xe.test(a)){s?(o.push(s+i+a),s="",i=""):(o.length>0&&o.push(e),s=a);continue}s?(i&&(i+=e),i+=a):(o.length>0&&o.push(e),o.push(a))}return o.join("")},F=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Kt(et(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{const i=s,l=i.toLowerCase();return n?(n=!1,Yt(l)):Ht(l)}),"")};let Jt=class extends w{commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}},Zt=class extends w{choices;option;value;constructor(e,n,o){super(`Invalid value "${n}" for option "${e}". Allowed values: ${o.join(", ")}`,"INVALID_CHOICE",{choices:o,option:e,value:n}),this.name="InvalidChoiceError",this.option=e,this.value=n,this.choices=o,this.hint=`Use one of: ${o.map(s=>`--${e} ${s}`).join(", ")}`}};const $e=(t,e,n=!1)=>{const o=[],s=e._all??e;for(const i of t){if(!n&&!i.required)continue;const l=i.__camelCaseName__??i.name;if(s[l]===void 0){if(i.type?.name==="Boolean"){e[l]=!1;continue}o.push(i)}}return o},Qt=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:tt(t,e)<=t.length/3,j=(t,e)=>{const n=t.toLowerCase();return e.filter(o=>Qt(o.toLowerCase(),n))},Xt=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const s=o.startsWith("--");let i=`Found unknown ${s?"option":"argument"} "${o}"`;if(s){const l=j(o.replace("--",""),(e.options??[]).map(a=>a.name));if(l.length>0){const[a,...d]=l.map(r=>`--${r}`);i+=d.length>0?`, did you mean ${a??""} or ${d.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
2
- `))},en=(t,e,n)=>{const o=n.__requiredOptions__,s=o?$e(o,e,!0):$e(t,e,!1);if(s.length>0)throw new Jt(n.name,s.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&Xt(e,n)},tn=(t,e,n)=>{const o=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(o.length>0){const s=o.find(i=>{const l=i.__camelCaseName__??F(i.name);return Array.isArray(i.conflicts)?i.conflicts.some(a=>e[F(a)]!==void 0)&&e[l]!==void 0:e[F(i.conflicts)]!==void 0&&e[l]!==void 0});if(s)throw new Ce(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},nn=(t,e)=>{const n=e.options;if(n)for(const o of n){if(!o.choices||o.choices.length===0)continue;const s=o.__camelCaseName__??F(o.name),i=t[s];if(i==null)continue;const l=Array.isArray(i)?i:[i];for(const a of l){const d=String(a);if(!o.choices.includes(d))throw new Zt(o.name,d,o.choices)}}},on=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}if(typeof s.alias=="string"&&s.alias.length>0){const i=n.get(s.alias)??[];i.push(s),n.set(s.alias,i)}else if(Array.isArray(s.alias)){for(const i of s.alias)if(i.length>0){const l=n.get(i)??[];l.push(s),n.set(i,l)}}}const o=[];for(const[s,i]of e)i.length>1&&o.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[s,i]of n)i.length>1&&o.push(`Duplicate option alias "-${s}" used by options ${i.map(l=>`"${l.name}"`).join(", ")} in command "${t.name}"`);if(o.length>0)throw new Error(o.join(`
3
- `))},sn=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let o;for(let s=1;s<=e.length;s+=1){const i=e[s-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const l=n.join(" ");t.has(l)&&(o={commandPath:[...n],depth:s})}return o?{argv:e.slice(o.depth),commandPath:o.commandPath}:{argv:e,commandPath:void 0}},T=t=>t.join(" "),be=(t,e)=>e&&e.length>0?[...e,t]:[t],an=/^no-/,rn=t=>{t.options?.forEach(e=>{e.__camelCaseName__=F(e.name)})},ln=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const o of t.options)e.add(o.name);const n=[];for(const o of t.options)if(o.name.startsWith("no-")){const s=o.name.replace(an,"");if(!e.has(s)){if(o.type!==Boolean)throw new Error(`Cannot add negated option "${o.name}" to command "${t.name}" because it is not a boolean.`);const i={...o,defaultValue:o.defaultValue===void 0?!0:!o.defaultValue,name:s};n.push(i),e.add(s)}}n.length>0&&t.options.push(...n)},cn=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,o=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const l=F(i.name);o.set(l,i)}const s=Object.keys(n).filter(i=>o.has(i));if(s.length!==0)for(const i of s){const l=i.charAt(2);if(!l)continue;const a=l.toLowerCase()+i.slice(3),d=o.get(i);d&&(d.__negated__=!0),n[a]=!n[i],Reflect.deleteProperty(n,i)}},dn=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:o}=t;for(const s of Object.keys(o)){const i=n.get(s);if(i?.implies){const{implies:l}=i;for(const[a,d]of Object.entries(l))o[a]===void 0&&(o[a]=d)}}},un=()=>!!process.versions.electron,mn=()=>un()&&!process.defaultApp,hn=()=>mn()?0:1,pn=t=>t.slice(hn()+1),fn=" ",gn=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,o)=>n===e[o]),wn=t=>{if(typeof t=="string")return t.split(fn);const e=ae();return gn(t,e)?pn(t):t},yn=t=>{const e=i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),U(1)},n=(i,l)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let a;if(typeof i=="string")a=i;else try{a=JSON.stringify(i)}catch{a=String(i)}t.error(`Promise rejection: ${a}`)}U(1)},o=ue("uncaughtException",e),s=ue("unhandledRejection",n);return()=>{o(),s()}},Ae=100,vn=/^[a-z][\w-]*$/i,le=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new w(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},_e=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new w(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},ie=(t,e)=>{if(typeof t!="object"||t===null)throw new w(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},J=t=>{const e=le(t,"Command name");if(e.length>Ae)throw new w(`Command name is too long (maximum ${String(Ae)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new w(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!vn.test(e))throw new w(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},Nn=new Set([`
4
- `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),$n=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArgumentLength??1e6;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Argument is too long (maximum ${String(o)} characters)`);if(n.checkDangerousChars){for(const s of t)if(Nn.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},Oe=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArguments??1e5;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Too many arguments (maximum ${String(o)})`);return t.map(s=>$n(s,n))},bn=/^-([^\d-])$/,An=/^--(\S+)/,_n=/^-([^\d-]{2,})$/,se=t=>bn.test(t)||An.test(t)||_n.test(t),On={access:(t,e)=>We(t,e),mkdir:(t,e)=>qe(t,e),readdir:t=>Fe(t),readFile:(async(t,e)=>e===void 0?de(t):de(t,e)),rm:(t,e)=>ze(t,e),stat:t=>Re(t),writeFile:(t,e,n)=>Be(t,e,n)},Cn=(t,e,n)=>{const o=e.indexOf("--"),s=o===-1?new Set:new Set(e.slice(o+1)),i=n.filter(d=>d.startsWith("--")&&d!=="--"&&!s.has(d));if(i.length===0)return;const l=(t.options??[]).map(d=>d.name),a=i.flatMap(d=>j(d.slice(2),l).map(r=>`--${r}`));throw new nt(i,a)};class Me{#t;#e;#d;#m;#h;#p;#_;#O;#C;#N;#x;#$;#I;#b=ee;#u;#n;#o;#i;#s;#a;#k=!1;#E;#P=!1;#f;#g;#w;#l=[];#S(){return this.#f===void 0&&(this.#f=[...this.#o.keys()]),this.#f}#L(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#r(){return this.#w===void 0&&(this.#w=[...this.#S(),...this.#L()]),this.#w}#D(){return this.#l.length===0?K:[...K,...this.#l]}#M(){this.#f=void 0,this.#g=void 0,this.#w=void 0}#A(){if(this.#d===void 0){const e=wn(this.#e.argv);this.#d=Oe(e,{maxArguments:this.#$}),this.#T()}return this.#d}#y(){return this.#N??Q()}#v(e){this.#b=e,this.#y().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){return this.#b}#T(){if(!this.#d)return;let e=!1;for(const n of this.#d){if(n==="--quiet"||n==="-q"){this.#v(Ge),e=!0;break}if(n==="--verbose"||n==="-v"){this.#v(Ye),e=!0;break}if(n==="--debug"){this.#v(M),e=!0;break}}e||this.#v(Object.hasOwn(this.#y(),"DEBUG")?M:ee)}#U(){this.#P||(this.#E=yn(this.#t),this.#P=!0)}#B(){return{arch:Ke(),argv:this.#A(),cwd:this.#m,env:this.#N??Q(),exit:this.#C??(e=>U(e??0)),platform:He(),stdin:this.#x}}#V(e,n,o,s){this.#c()===M&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:l,parsedArgs:a}=Gt(e,n,this.#D()),d=Object.keys(l).length>0;let r=a;d&&(r={...a,_all:{...a._all,...l}}),en(i,r,e);const m=Wt(e,a,l,o,this.#y());m.runtime=this,m.argv=this.#A(),m.fs=this.#O??On,m.process=this.#B(),m.console=this.#t;const h=e.options&&e.options.length>0;if(h&&e.options){const f=e.options.filter(N=>N.name.startsWith("no-"));for(const N of f){const P=N.name.slice(3),A=`--${N.name}`,V=`--${P}`,y=n.includes(A),$=n.includes(V);if(y&&$)throw new Ce(P,N.name)}}return h&&(cn(m,e),dn(m,e)),tn(i,m.options,e),nn(m.options,e),this.#I&&Cn(e,n,m.rawUnknown),this.#c()===M&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(m.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(m.argument,null,2))),{arguments_:i,booleanValues:l,commandArgs:r,parsedArgs:a,toolbox:m}}async#j(e,n,o){const s=this.getPluginManager();try{!this.#k&&s.hasPlugins()&&(await s.init({cli:this,cwd:this.#m,logger:this.#t}),this.#k=!0),await s.executeLifecycle("execute",n),await s.executeLifecycle("beforeCommand",n);let i;const l=o.global;if(l?.help){const a=this.#n.get("help");if(!a)throw new w("Help command not found","COMMAND_NOT_FOUND");i=await oe(a,n)}else if(l?.version??l?.V){const a=this.#n.get("version");if(!a)throw new w("Version command not found","COMMAND_NOT_FOUND");i=await oe(a,n)}else i=await oe(e,n);return await s.executeLifecycle("afterCommand",n,i),i}catch(i){throw await s.executeErrorHandlers(i,n),i}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new w("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#h=e.trim();const o=n.argv??ae(),s=n.cwd??Je();if(this.#e={...n,argv:o,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new w("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new w("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new w("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new w("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const h=["debug","error","info","log","warn"],f=[],N=this.#e.logger;for(const P of h)typeof N[P]!="function"&&f.push(P);if(f.length>0)throw new w(`Logger object is missing required methods: ${f.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:f});this.#t=this.#e.logger}else this.#t={...console,debug:(...h)=>{this.#c()===M&&console.debug(...h)}};this.#p=this.#e.packageVersion,this.#_=this.#e.packageName,this.#m=this.#e.cwd,this.#s="help",this.#a={};const i=n.fs;if(i!==void 0&&(typeof i!="object"||i===null))throw new w("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const l=n.exit;if(l!==void 0&&typeof l!="function")throw new w("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new w("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const d=n.stdin;if(d!==void 0&&typeof d!="string")throw new w("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#O=n.fs,this.#C=n.exit,this.#N=n.env,this.#x=n.stdin??"",this.#$=n.maxArguments,this.#I=n.strictOptions??!1;const r=this.#y().CEREBRO_OUTPUT_LEVEL,m=r===void 0?Number.NaN:Number(r);this.#b=Number.isNaN(m)?ee:m,this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#a=e,this}getCommandSection(){return this.#a.header||(this.#a.header=`${this.#h}${this.#p?` v${this.#p}`:""}`),this.#a}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){ie(e,"Command"),J(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new w(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new w(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?J(e.alias):_e(e.alias,"Command alias").forEach(r=>J(r))),e.argument&&ie(e.argument,"Command argument"),e.options&&ie(e.options,"Command options"),e.commandPath&&(_e(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{J(r)}));const s=be(e.name,e.commandPath),i=T(s);if(this.#o.has(i))throw new w(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const l=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),d=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!l&&d)throw new w(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)me(r);if(on(e),ln(e),rn(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),l&&a!==void 0)this.#n.set(i,e);else{if(!l&&a!==void 0&&!d){const r=be(a.name,a.commandPath);this.#n.set(T(r),a)}this.#n.set(e.name,e)}if(this.#o.set(i,s),this.#i.set(i,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const m of r){if(this.#c()===M&&this.#t.debug("adding alias",m),this.#n.has(m))throw new w(`Command alias "${m}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:m,commandName:e.name});this.#n.set(m,e)}}return this}addGlobalOption(e){const n=e,o=new Set(K.map(i=>i.name)),s=new Set(K.map(i=>i.alias).filter(Boolean));if(o.has(n.name))throw new w(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new w(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(i=>i.name)).has(n.name))throw new w(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",me(n),this.#l.push(n),this}getGlobalOptions(){return this.#D()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#u?this.#u:(this.#u=new it(this.#t),this.#u.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#u)}getCliName(){return this.#h}getPackageVersion(){return this.#p}getPackageName(){return this.#_}getCommands(){return this.#n}getCwd(){return this.#m}dispose(){this.#E?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../commands/help-command.js");this.addCommand(new y(this.#n))}const i=this.#L(),l=this.#o;this.#U();const a=this.#A();let d,r=[...a];this.#c()===M&&(this.#t.debug(`process.execPath: ${Ze()}`),this.#t.debug(`process.execArgv: ${Qe().join(" ")}`),this.#t.debug(`process.argv: ${ae().join(" ")}`));const m=sn(l,[...a]);if(m.commandPath)d=m.commandPath,r=m.argv;else{if(a.length>1&&a[0]&&a[1]&&!se(a[0])&&!se(a[1])){const $=[];let E=0;for(;E<a.length;){const C=a[E];if(!C||se(C))break;$.push(C),E+=1}const z=T($);if($[0]&&!i.includes($[0])){const C=this.#r(),H=j(z,C);throw new S(z,H)}}let y;try{y=dt([null,...i],[...a])}catch($){if($ instanceof Error&&$.name==="INVALID_COMMAND"&&"command"in $){const E=$.command,z=this.#r(),C=j(E,z);throw new S(E,C)}throw $}y.command&&(d=[y.command],r=y.argv)}if(!d)if(this.#s)d=[this.#s];else{const y=this.#r();throw new S("",y)}const h=T(d),f=this.#o.get(h);let N;if(f){if(N=this.#i.get(h),!N||T(f)!==h){const y=this.#r(),$=j(h,y);throw new S(h,$)}}else{const y=d.at(-1);if(N=y?this.#n.get(y):void 0,!N){const $=this.#r(),E=j(h,$);throw new S(h,E)}}if(typeof N.execute!="function"&&typeof N.loader!="function")return this.#t.error(`Command "${N.name}" has no function to execute.`),o?U(1):void 0;const P=r;let A,V;try{({commandArgs:A,toolbox:V}=this.#V(N,P,s,h))}catch(y){if(this.#t.error(y),o)return U(1);throw y}try{return await this.#j(N,V,A),o?U(0):void 0}catch(y){if(o)return this.#t.error(y),U(1);throw y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...s}=n;le(e,"Command name");const i=e.split(" ").filter(Boolean),l=T(i),a=this.#o.get(l)?this.#i.get(l):this.#n.get(e);if(!a){const h=this.#r(),f=j(l||e,h);throw new S(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new w(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const d=[...Oe(o,{maxArguments:this.#$})];this.#c()===M&&this.#t.debug(`running command '${e}' programmatically with args: ${d.join(", ")}`);const{commandArgs:r,toolbox:m}=this.#V(a,d,s,l||e);return this.#j(a,m,r)}clone(e){const n={...this.#e,...e},o=new Me(this.#h,n);for(const[s,i]of this.#n)o.#n.set(s,i);for(const[s,i]of this.#o)o.#o.set(s,[...i]);for(const[s,i]of this.#i)o.#i.set(s,i);for(const s of this.#l)o.#l.push(s);return o.#s=this.#s,o.#a={...this.#a},o.#M(),o}async getAction(e){le(e,"Command name");const n=e.split(" ").filter(Boolean),o=T(n),s=this.#o.get(o)?this.#i.get(o):this.#n.get(e);if(!s){const i=this.#r(),l=j(o||e,i);throw new S(e,l)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return De(s);throw new w(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}export{Me as Cli};
@@ -1 +0,0 @@
1
- const O=1,T=2,E=4,I=16,R=32,U=64,_=128,S="positionals";export{O as OUTPUT_NORMAL,E as OUTPUT_PLAIN,T as OUTPUT_RAW,S as POSITIONALS_KEY,_ as VERBOSITY_DEBUG,R as VERBOSITY_NORMAL,I as VERBOSITY_QUIET,U as VERBOSITY_VERBOSE};
@@ -1 +0,0 @@
1
- const h=s=>s instanceof Error&&s.type==="VisulimaError";class n extends Error{loc;title;hint;type="VisulimaError";constructor({cause:t,hint:e,location:i,message:a,name:c,stack:o,title:r}){super(a,{cause:t}),this.title=r,this.name=c,this.stack=o??this.stack,this.loc=i,this.hint=e}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{h as c,n as h};
@@ -1,76 +0,0 @@
1
- import{t as P}from"./renderError-BISXNU8L-B47ZikMV.js";import{S as fe,W as pe,X as me,Y as de,G as ye,R as he}from"./renderError-BISXNU8L-B47ZikMV.js";import{h as be,c as ve}from"./VisulimaError-DTMgXonA-CzaryRgZ.js";const E=(e,r)=>{let t=0,n=r.length-2;for(;t<n;){const o=t+(n-t>>1);if(e<r[o])n=o-1;else if(e>=r[o+1])t=o+1;else{t=o;break}}return t},T=/\n|\r(?!\n)/,I=e=>e.split(T).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),G=(e,r,t)=>{const n=t?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!n&&(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){const a=I(e),s=E(r,a);return{column:r-a[s]+1,line:s+1}}const o=E(r,e);return{column:r-e[o]+1,line:o+1}},Q=({applicationType:e,error:r,file:t})=>`You are a very skilled ${t.language??"unknown"} programmer.
2
-
3
- ${e?`You are working on a ${e} application.`:""}
4
-
5
- Use the following context to find a possible fix for the exception message at the end. Limit your answer to 4 or 5 sentences. Also include a few links to documentation that might help.
6
-
7
- Use this format in your answer, make sure links are json:
8
-
9
- FIX
10
- insert the possible fix here
11
- ENDFIX
12
- LINKS
13
- {"title": "Title link 1", "url": "URL link 1"}
14
- {"title": "Title link 2", "url": "URL link 2"}
15
- ENDLINKS
16
- ---
17
-
18
- Here comes the context and the exception message:
19
-
20
- Line: ${String(t.line)}
21
-
22
- File:
23
- ${t.file}
24
-
25
- Snippet including line numbers:
26
- ${t.snippet??""}
27
-
28
- Exception class:
29
- ${r.name}
30
-
31
- Exception message:
32
- ${r.message}`,d=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;"),_=e=>{try{const{protocol:r}=new URL(e);return r==="http:"||r==="https:"}catch{return!1}},$=(e,r,t)=>{const n=t.indexOf(e);if(n===-1)return"";const o=n+e.length,a=t.indexOf(r,o);return a===-1?"":t.slice(o,a).trim()},Z=e=>{const r=$("FIX","ENDFIX",e);if(!r)return["No solution found.",'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',`"${d(e)}"`].join("</br></br>");const t=$("LINKS","ENDLINKS",e),n=t?t.split(`
33
- `).map(a=>a.trim()).filter(Boolean).map(a=>{try{const s=JSON.parse(a);return typeof s.url=="string"&&typeof s.title=="string"&&_(s.url)?{title:s.title,url:s.url}:void 0}catch{return}}).filter(a=>a!==void 0):[],o=n.length>0?`
34
-
35
- ## Links
36
-
37
- ${n.map(a=>`- <a href="${d(a.url)}" target="_blank" rel="noopener noreferrer">${d(a.title)}</a>`).join(`
38
- `)}`:"";return`${d(r).replaceAll(/&quot;(.*?)&quot;(?:\s|\.)/g,"<code>$1</code> ")}${o}
39
-
40
- --------------------
41
- This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`},ee={handle:e=>e.hint===void 0?Promise.resolve(void 0):typeof e.hint=="string"&&e.hint!==""?Promise.resolve({body:e.hint}):typeof e.hint=="object"&&typeof e.hint.body=="string"?Promise.resolve(e.hint):Array.isArray(e.hint)?Promise.resolve({body:e.hint.join(`
42
- `)}):Promise.resolve(void 0),name:"errorHint",priority:1},C=e=>`\`\`\`
43
- ${e.trim()}
44
- \`\`\``,y=e=>`\`\`\`bash
45
- ${e.trim()}
46
- \`\`\``,h=e=>`\`\`\`ts
47
- ${e.trim()}
48
- \`\`\``,D=e=>`\`\`\`js
49
- ${e.trim()}
50
- \`\`\``,c=(e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},J=[{name:"esm-cjs-interop",test:e=>{const{message:r}=e;if(c(r,"err_require_esm","cannot use import statement outside a module","must use import to load es module","require() of es module","does not provide an export named"))return{md:["Your project or a dependency may be mixing CommonJS and ES Modules.","","Try:","- Ensure package.json has the correct `type` (either `module` or `commonjs`).","- Use dynamic `import()` when requiring ESM from CJS.","- Prefer ESM-compatible entrypoints from dependencies.","- In Node, align `module` resolution with your bundler config.","","Check Node resolution:",y(`node -v
51
- cat package.json | jq .type`),"","Example dynamic import in CJS:",D("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
52
- `),title:"ESM/CJS interop"}}},{name:"missing-default-export",test:e=>{const{message:r}=e;if(c(r,"default export not found","has no default export","does not provide an export named 'default'","is not exported from"))return{md:["Verify your import/export shapes.","","Default export example:",h(`export default function Component() {}
53
- // import Component from './file'`),"","Named export example:",h(`export function Component() {}
54
- // import { Component } from './file'`)].join(`
55
- `),title:"Export mismatch (default vs named)"}}},{name:"port-in-use",test:e=>{const{message:r}=e;if(c(r,"eaddrinuse","address already in use","listen eaddrinuse"))return{md:["Another process is using the port.","","Change the port or stop the other process.","","On macOS/Linux:",y(`lsof -i :3000
56
- kill -9 <PID>`),"","On Windows (PowerShell):",y(`netstat -ano | findstr :3000
57
- taskkill /PID <PID> /F`)].join(`
58
- `),title:"Port already in use"}}},{name:"file-not-found-or-case",test:(e,r)=>{const{message:t}=e;if(c(t,"enoent","module not found","cannot find module"))return{md:["Check the import path and filename case (Linux/macOS are case-sensitive).","If using TS path aliases, verify `tsconfig.paths` and bundler aliases.","","Current file:",C(`${r.file}:${String(r.line)}`)].join(`
59
- `),title:"Missing file or path case mismatch"}}},{name:"ts-path-mapping",test:e=>{const{message:r}=e;if(c(r,"ts2307","cannot find module")||r.includes("TS2307"))return{md:["If you use path aliases, align TS `paths` with Vite/Webpack resolve aliases.","Ensure file extensions are correct and included in resolver.","","tsconfig.json excerpt:",h(`{
60
- "compilerOptions": {
61
- "baseUrl": ".",
62
- "paths": { "@/*": ["src/*"] }
63
- }
64
- }`)].join(`
65
- `),title:"TypeScript path mapping / resolution"}}},{name:"network-dns-enotfound",test:e=>{const{message:r}=e;if(c(r,"enotfound","getaddrinfo","dns lookup","fetch failed","econnrefused"))return{md:["The host may be unreachable or misconfigured.","","Try:","- Verify the hostname and protocol (http/https).","- Check VPN/proxy and firewall.","- Confirm the service is running and listening on the expected port.","",y(`ping <host>
66
- nslookup <host>
67
- curl -v http://<host>:<port>`)].join(`
68
- `),title:"Network/DNS connection issue"}}},{name:"undefined-property",test:e=>{const{message:r}=e;if(c(r,"cannot read properties of undefined","reading '"))return{md:["A variable or function returned `undefined`.","","Mitigations:","- Add nullish checks before property access.","- Validate function return values and input props/state.","",h("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
69
- `),title:"Accessing property of undefined"}}}],re={handle:(e,r)=>{try{const t=J.map(o=>({match:o.test(e,r),rule:o})).filter(o=>!!o.match);if(t.length===0)return Promise.resolve(void 0);const n=t.toSorted((o,a)=>(o.match.priority??0)-(a.match.priority??0)).map(o=>`#### ${o.match.title}
70
-
71
- ${o.match.md}`).join(`
72
-
73
- ---
74
-
75
- `);return n===""?Promise.resolve(void 0):Promise.resolve({body:n,header:"### Potential fixes detected"})}catch{return Promise.resolve(void 0)}},name:"ruleBasedHints",priority:0};let p=class extends Error{constructor(r){super(r),this.name="NonError"}};const ne=()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},v=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError],...typeof AggregateError>"u"?[]:[["AggregateError",AggregateError]]]),oe=(e,r)=>{let t;try{t=new e}catch(o){throw new Error(`The error constructor "${e.name}" is not compatible`,{cause:o})}const n=r??t.name;if(v.has(n))throw new Error(`The error constructor "${n}" is already known.`);v.set(n,e)},x=e=>v.get(e),b=e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(x(e.name)!==void 0||e.name==="Error"),k=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},L={maxDepth:Number.POSITIVE_INFINITY},N=(e,r,t=0)=>b(e)?S(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new p(JSON.stringify(e)):new p(JSON.stringify(e)),F=(e,r,t,n,o)=>{const a=r.map(s=>l(s,n,o+1));return new e(a,t)},S=(e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new p(JSON.stringify(e));const{cause:n,errors:o,message:a,name:s,stack:i,...m}=e,w=x(s)??Error,u=s==="AggregateError"&&Array.isArray(o)?F(w,o,a,r,t):new w(a);return!u.name&&s&&(u.name=s),a!==void 0&&(u.message=a),i&&(u.stack=i),R(u,m,n,s,r,t),n!==void 0&&(u.cause=l(n,r,t+1)),M(u,e),u},l=(e,r,t)=>{if(k(e)){if(e.__dataType==="Map"&&Array.isArray(e.value))return new Map(e.value.map(([o,a])=>[l(o,r,t+1),l(a,r,t+1)]));if(e.__dataType==="Set"&&Array.isArray(e.value))return new Set(e.value.map(o=>l(o,r,t+1)));if(b(e))return N(e,r,t);const n={};for(const[o,a]of Object.entries(e))o==="__proto__"||o==="constructor"||o==="prototype"||(n[o]=l(a,r,t+1));return n}return Array.isArray(e)?e.map(n=>l(n,r,t)):e},R=(e,r,t,n,o,a)=>{const s=e;for(const[i,m]of Object.entries(r))if(!(i==="__proto__"||i==="constructor"||i==="prototype")){if(i==="cause"&&t!==void 0||i==="errors"&&n==="AggregateError")continue;Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:l(m,o,a+1),writable:!0})}},M=(e,r)=>{const t=new Set(["message","name","stack"]);for(const n of Object.keys(r))t.add(n);for(const n of t)if(n in e){const o=Object.getOwnPropertyDescriptor(e,n);o&&!o.enumerable&&Object.defineProperty(e,n,{...o,enumerable:!0})}},j=e=>new p(JSON.stringify(e)),U=e=>new p(JSON.stringify(e)),V=(e,r)=>b(e)?S(e,r,0):N(e,r),ae=(e,r={})=>{const t={...L,...r};return e instanceof Error?e:e===null?j(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?j(e):Array.isArray(e)?U(e):b(e)?S(e,t,0):k(e)?V(e,t):new p(JSON.stringify(e))},q=P("node:util"),Y=e=>{try{return q().inspect(e)}catch{}try{return String(e)}catch{return"<unprintable>"}},se=e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${Y(e)}`);break}if(t.push(n),r.add(n),typeof n!="object"||!("cause"in n))break;n=n.cause}return t},K=e=>{const r=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",t=e.file??"<unknown>",n=String(e.line??0),o=String(e.column??0);return r.trim()?` at ${r}(${t}:${n}:${o})`:` at ${t}:${n}:${o}`},ie=(e,r)=>{const t=[];if(r?.header&&(r.header.name||r.header.message)){const n=r.header.name??"Error",o=r.header.message??"";t.push(`${n}${o?": ":""}${o}`)}for(const n of e)t.push(K(n));return t.join(`
76
- `)},B=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}}),X=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},O=new WeakSet,H=e=>{if(Object.hasOwn(e,"name")&&typeof e.name=="string"&&e.name!=="")return e.name;const r=e.constructor?.name;return typeof r=="string"&&r!==""?r:e.name},A=e=>{const r=Object.getOwnPropertyNames(e);for(const t of r){const n=Object.getOwnPropertyDescriptor(e,t);n&&(n.enumerable||Object.defineProperty(e,t,{...n,enumerable:!0}),n.value&&typeof n.value=="object"&&!Array.isArray(n.value)&&(Object.getPrototypeOf(n.value)===Object.prototype||Object.getPrototypeOf(n.value)===null)&&A(n.value))}},W=e=>{O.add(e);const r=e.toJSON();return O.delete(e),Object.isExtensible(r)&&A(r),r},f=(e,r,t,n,o=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(t+=1,g(e,n,r,t));if(n.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(typeof URL<"u"&&e instanceof URL)return e.href;if(e instanceof Map){const a=[];for(const[s,i]of e.entries())a.push([f(s,r,t,n,o),f(i,r,t,n,o)]);return{__dataType:"Map",value:a}}if(e instanceof Set){const a=[];for(const s of e.values())a.push(f(s,r,t,n,o));return{__dataType:"Set",value:a}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(X(e)){if(o.has(e))return"[Circular]";if(n.maxDepth!==void 0&&n.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=n.maxDepth)return{};t+=1,o.add(e);const a={};for(const s in e)a[s]=f(e[s],r,t,n,o);return o.delete(e),a}try{return e}catch{return"[Not Available]"}},g=(e,r,t,n)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!O.has(e))return W(e);const o=Object.create(B);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:H(e),writable:!0}),Object.defineProperty(o,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(o,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const s=[];for(const i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(i))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;s.push(g(i,r,t,n))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:s,writable:!0})}const a=e.cause;if(a!=null)if(a instanceof Error)t.has(a)?Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:g(a,r,t,n),writable:!0});else{const s=f(a,t,n,r);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:s,writable:!0})}for(const s in e){if(s==="name"||s==="message"||s==="stack"||s==="cause"||s==="errors")continue;const i=e[s],m=f(i,t,n,r);Object.defineProperty(o,s,{configurable:!0,enumerable:!0,value:m,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const s of r.exclude)try{delete o[s]}catch{}return o},ue=(e,r={})=>g(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);export{fe as CODE_FRAME_POINTER,p as NonError,be as VisulimaError,oe as addKnownErrorConstructor,Q as aiPrompt,Z as aiSolutionResponse,ne as captureRawStackTrace,pe as codeFrame,me as composeFilters,ae as deserializeError,ee as errorHintFinder,K as formatStackFrameLine,ie as formatStacktrace,se as getErrorCauses,G as indexToLineColumn,b as isErrorLike,ve as isVisulimaError,de as parseStacktrace,ye as renderError,re as ruleBasedFinder,ue as serializeError,he as stackFilters};
@@ -1 +0,0 @@
1
- import{h as r}from"./VisulimaError-DTMgXonA-CzaryRgZ.js";class n extends r{code;context;constructor(e,t,o){super({message:e,name:"CerebroError"}),this.code=t,this.context=o}}export{n as t};