@visulima/cerebro 3.0.0-alpha.2 → 3.0.0-alpha.20

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 (89) hide show
  1. package/CHANGELOG.md +327 -0
  2. package/LICENSE.md +589 -4096
  3. package/README.md +26 -0
  4. package/dist/commands/completion-command.d.ts +6 -5
  5. package/dist/commands/completion-command.js +2 -2
  6. package/dist/commands/help-command.d.ts +9 -9
  7. package/dist/commands/help-command.js +1 -1
  8. package/dist/commands/readme-command.d.ts +6 -5
  9. package/dist/commands/readme-command.js +20 -20
  10. package/dist/commands/version-command.d.ts +4 -3
  11. package/dist/index.d.ts +422 -95
  12. package/dist/index.js +1 -1
  13. package/dist/logger/create-pail-logger.d.ts +779 -8
  14. package/dist/logger/create-pail-logger.js +1 -1
  15. package/dist/packem_chunks/has-new-version.js +1 -1
  16. package/dist/packem_shared/Cerebro-DVWKQlmP.js +4 -0
  17. package/dist/packem_shared/VisulimaError-Bh91XNXu.js +76 -0
  18. package/dist/packem_shared/index-B0BiusY7.js +6 -0
  19. package/dist/packem_shared/index.d-Br8HpP0A.d.ts +93 -0
  20. package/dist/packem_shared/lazyNamed-DOmefeJM.js +1 -0
  21. package/dist/packem_shared/plugin-manager.d-Dz-wu1tI.d.ts +544 -0
  22. package/dist/packem_shared/renderError-B_XyYPKJ-B65kP-Ou.js +24 -0
  23. package/dist/packem_shared/{runtime-process-G-n-wOub.js → runtime-process-DKHFvYkv.js} +1 -1
  24. package/dist/plugins/error-handler-plugin.d.ts +21 -19
  25. package/dist/plugins/error-handler-plugin.js +1 -1
  26. package/dist/plugins/runtime-version-check-plugin.d.ts +22 -20
  27. package/dist/plugins/runtime-version-check-plugin.js +1 -1
  28. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +21 -8
  29. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
  30. package/dist/util/general/compile-cache.d.ts +41 -0
  31. package/dist/util/general/compile-cache.js +1 -0
  32. package/dist/util/general/heap-tuning.d.ts +18 -0
  33. package/dist/util/general/heap-tuning.js +1 -0
  34. package/package.json +52 -44
  35. package/dist/cli.d.ts +0 -203
  36. package/dist/constants.d.ts +0 -29
  37. package/dist/default-env.d.ts +0 -7
  38. package/dist/default-options.d.ts +0 -3
  39. package/dist/empty-toolbox.d.ts +0 -15
  40. package/dist/errors/cerebro-error.d.ts +0 -10
  41. package/dist/errors/command-not-found-error.d.ts +0 -9
  42. package/dist/errors/command-validation-error.d.ts +0 -10
  43. package/dist/errors/completion-error.d.ts +0 -9
  44. package/dist/errors/conflicting-options-error.d.ts +0 -10
  45. package/dist/errors/plugin-error.d.ts +0 -9
  46. package/dist/errors/update-notifier-error.d.ts +0 -7
  47. package/dist/packem_shared/Cerebro-aPZjbfzf.js +0 -4
  48. package/dist/packem_shared/VisulimaError-BJideSBf.js +0 -76
  49. package/dist/packem_shared/help-command-CIRIXN03.js +0 -1
  50. package/dist/packem_shared/index-DQ3pvLQH.js +0 -6
  51. package/dist/packem_shared/renderError-ZMlMvw1N-eVUSdl6c.js +0 -24
  52. package/dist/plugin-manager.d.ts +0 -53
  53. package/dist/plugins/update-notifier/cache.d.ts +0 -11
  54. package/dist/plugins/update-notifier/get-distribution-version.d.ts +0 -2
  55. package/dist/plugins/update-notifier/has-new-version.d.ts +0 -14
  56. package/dist/types/cli.d.ts +0 -102
  57. package/dist/types/command-line-usage.d.ts +0 -37
  58. package/dist/types/command.d.ts +0 -136
  59. package/dist/types/option-types.d.ts +0 -83
  60. package/dist/types/options.d.ts +0 -4
  61. package/dist/types/plugin.d.ts +0 -53
  62. package/dist/types/toolbox.d.ts +0 -96
  63. package/dist/util/arg-processing/get-boolean-values.d.ts +0 -7
  64. package/dist/util/arg-processing/get-parameter-option.d.ts +0 -7
  65. package/dist/util/arg-processing/map-option-type-label.d.ts +0 -3
  66. package/dist/util/arg-processing/option-is-boolean.d.ts +0 -9
  67. package/dist/util/arg-processing/remove-boolean-values.d.ts +0 -9
  68. package/dist/util/command-line-commands.d.ts +0 -10
  69. package/dist/util/command-line-usage/get-terminal-width.d.ts +0 -7
  70. package/dist/util/command-line-usage/index.d.ts +0 -3
  71. package/dist/util/command-line-usage/section/base-section.d.ts +0 -8
  72. package/dist/util/command-line-usage/section/content-section.d.ts +0 -65
  73. package/dist/util/command-line-usage/section/option-list-section.d.ts +0 -44
  74. package/dist/util/command-processing/command-processor.d.ts +0 -37
  75. package/dist/util/command-processing/command-validation.d.ts +0 -17
  76. package/dist/util/command-processing/nested-command-parser.d.ts +0 -25
  77. package/dist/util/command-processing/option-processor.d.ts +0 -44
  78. package/dist/util/data-processing/list-missing-arguments.d.ts +0 -15
  79. package/dist/util/data-processing/merge-arguments.d.ts +0 -7
  80. package/dist/util/general/find-alternatives.d.ts +0 -8
  81. package/dist/util/general/hide-bin.d.ts +0 -2
  82. package/dist/util/general/parse-raw-command.d.ts +0 -7
  83. package/dist/util/general/register-exception-handler.d.ts +0 -9
  84. package/dist/util/general/runtime-process.d.ts +0 -65
  85. package/dist/util/general/semver-gt.d.ts +0 -2
  86. package/dist/util/general/validate-input.d.ts +0 -24
  87. package/dist/util/process-env-variables.d.ts +0 -9
  88. package/dist/util/security.d.ts +0 -58
  89. package/dist/util/text-processing/template-format.d.ts +0 -5
@@ -1 +1 @@
1
- var l=Object.defineProperty;var i=(o,r)=>l(o,"name",{value:r,configurable:!0});import m from"@visulima/pail/processor/caller";import c from"@visulima/pail/processor/message-formatter";import{createPail as f}from"@visulima/pail/server";import{VERBOSITY_DEBUG as g,VERBOSITY_QUIET as p}from"../packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{d as E}from"../packem_shared/runtime-process-G-n-wOub.js";var u=Object.defineProperty,d=i((o,r)=>u(o,"name",{value:r,configurable:!0}),"i");const B=d(o=>{const r={16:"informational",32:"informational",64:"trace",128:"debug",256:"debug"},t=[new c],e=E().CEREBRO_OUTPUT_LEVEL;(e===String(128)||e===String(g))&&t.push(new m);const n=e&&r[e]||"informational",s={...o,logLevel:o?.logLevel??n,processors:o?.processors?[...t,...o.processors]:t},a=f(s);return e===String(p)&&a.disable(),a},"createPailLogger");export{B as default};
1
+ var l=Object.defineProperty;var i=(o,r)=>l(o,"name",{value:r,configurable:!0});import m from"@visulima/pail/processor/caller";import c from"@visulima/pail/processor/message-formatter";import{createPail as f}from"@visulima/pail/server";import{VERBOSITY_DEBUG as g,VERBOSITY_QUIET as p}from"../packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{d as E}from"../packem_shared/runtime-process-DKHFvYkv.js";var u=Object.defineProperty,d=i((o,r)=>u(o,"name",{value:r,configurable:!0}),"i");const B=d(o=>{const r={16:"informational",32:"informational",64:"trace",128:"debug",256:"debug"},t=[new c],e=E().CEREBRO_OUTPUT_LEVEL;(e===String(128)||e===String(g))&&t.push(new m);const n=(e&&r[e])??"informational",s={...o,logLevel:o?.logLevel??n,processors:o?.processors?[...t,...o.processors]:t},a=f(s);return e===String(p)&&a.disable(),a},"createPailLogger");export{B as default};
@@ -1 +1 @@
1
- var Xt=Object.defineProperty;var _=(r,a)=>Xt(r,"name",{value:a,configurable:!0});import{createRequire as en}from"node:module";import{findCacheDirSync as sn}from"@visulima/find-cache-dir";import{c as an}from"../packem_shared/cerebro-error-BnJTixb2.js";const tn=en(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ve=_(r=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[a,i]=U.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return U.getBuiltinModule(r)}return tn(r)},"__cjs_getBuiltinModule"),{existsSync:be,mkdirSync:nn,writeFileSync:rn,readFileSync:on}=ve("node:fs"),{get:cn}=ve("node:https");var un=Object.defineProperty,ln=_((r,a)=>un(r,"name",{value:a,configurable:!0}),"o$1");const fn=ln((r,a)=>{const i=r.split(".").map(Number),f=a.split(".").map(Number);for(const[d,h]of i.entries()){if(h>f[d])return!0;if(h<f[d])return!1}return!1},"semverGt");var pn=Object.defineProperty,gn=_((r,a)=>pn(r,"name",{value:a,configurable:!0}),"$e"),dn=Object.defineProperty,H=gn((r,a)=>dn(r,"name",{value:a,configurable:!0}),"W"),hn=Object.defineProperty,u=H((r,a)=>hn(r,"name",{value:a,configurable:!0}),"u$1");let xe=u(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,h=u((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),$=u((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!d.call(e,o)&&o!==n&&a(e,o,{get:u(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),m=u(e=>$(a({},"__esModule",{value:!0}),e),"oe"),y={};h(y,{zeptomatch:u(()=>me,"zeptomatch")});var K=u(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:c}=o;if(c?.length)for(let l=0,g=c.length;l<g;l++)n.push(c[l])}return Array.from(t)},"M"),Ee=u(e=>{let t="";const n=K(e);for(let s=0,o=n.length;s<o;s++){const c=n[s];if(!c.regex)continue;const l=c.regex.flags;if(t||(t=l),t!==l)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${l}"`)}return t},"se"),Q=u((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let c="";if(e.regex&&(c+=o?"(?:$|":"",c+=e.regex.source),e.children?.length){const l=Re(e.children.map(g=>Q(g,t,n)).filter(Boolean));if(l?.length){const g=e.children.some(I=>!I.regex||!(I.partial??t)),v=l.length>1||o&&(!c.length||g);c+=v?o?"(?:$|":"(?:":"",c+=l.join("|"),c+=v?")":""}}return e.regex&&(c+=o?")":""),n.set(e,c),c},"O"),ke=u((e,t)=>{const n=new Map,s=K(e);for(let o=s.length-1;o>=0;o--){const c=Q(s[o],t,n);if(!(o>0))return c}return""},"ie"),Re=u(e=>Array.from(new Set(e)),"ue"),D=u((e,t,n)=>D.compile(e,n).test(t),"R");D.compile=(e,t)=>{const n=t?.partial??!1,s=ke(e,n),o=Ee(e);return new RegExp(`^(?:${s})$`,o)};var Ae=D,Me=u((e,t)=>{const n=Ae.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ne=Me,Pe=u(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Pe,X=u(e=>Array.isArray(e),"j"),z=u(e=>typeof e=="function","_"),Ce=u(e=>e.length===0,"he"),Ie=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Se=u(e=>typeof e=="number","de"),Ue=u(e=>typeof e=="object"&&e!==null,"xe"),Te=u(e=>e instanceof RegExp,"me"),Be=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),De=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ee=u(e=>typeof e=="string","A"),O=u(e=>e===void 0,"f"),Fe=u(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),te=u((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=E(t)(s),c=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${c}`)},"I"),p=u((e,t)=>X(e)?Le(e,t):ee(e)?ne(e,t):qe(e,t),"i"),Le=u((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let c=s.index,l=c;for(;l<o.length&&o.charCodeAt(l)in n;)l+=1;if(l>c){if(!O(t)&&!s.options.silent){const g=o.slice(c,l),v=z(t)?t(g,o,`${c}`):t;O(v)||s.output.push(v)}s.index=l}return!0}},"we"),qe=u((e,t)=>{if(De(e))return ne(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return Be(e)&&z(t)&&!Ie(t)?We(o,t):Ze(o,t)}},"$e"),We=u((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const c=e.exec(o);if(c){const l=e.lastIndex;if(!n.options.silent){const g=t(...c,o,`${s}`);O(g)||n.output.push(g)}return n.index=l,!0}else return!1},"Ee"),Ze=u((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const c=e.lastIndex;if(!O(t)&&!n.options.silent){const l=z(t)?t(o.slice(s,c),o,`${s}`):t;O(l)||n.output.push(l)}return n.index=c,!0}else return!1},"Ce"),ne=u((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!O(t)&&!n.options.silent){const c=z(t)?t(e,o,`${s}`):t;O(c)||n.output.push(c)}return n.index+=e.length,!0}else return!1},"F"),F=u((e,t,n,s)=>{const o=E(e),c=t>1;return q(L(oe(l=>{let g=0;for(;g<n;){const v=l.index;if(!o(l)||(g+=1,l.index===v))break}return g>=t},c),s))},"k"),re=u((e,t)=>F(e,0,1,t),"L"),B=u((e,t)=>F(e,0,1/0,t),"$"),Ve=u((e,t)=>F(e,1,1/0,t),"Re"),M=u((e,t)=>{const n=e.map(E);return q(L(oe(s=>{for(let o=0,c=n.length;o<c;o++)if(!n[o](s))return!1;return!0}),t))},"x"),w=u((e,t)=>{const n=e.map(E);return q(L(s=>{for(let o=0,c=n.length;o<c;o++)if(n[o](s))return!0;return!1},t))},"p"),oe=u((e,t=!0,n=!1)=>{const s=E(e);return t?o=>{const c=o.index,l=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=c,o.output.length!==l&&(o.output.length=l)),g}:s},"q"),L=u((e,t)=>{const n=E(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const c=s.output.splice(o,1/0),l=t(c);return O(l)||s.output.push(l),!0}else return!1}:n},"B"),q=(()=>{let e=0;return t=>{const n=E(t),s=e+=1;return o=>{var c;if(o.options.memoization===!1)return n(o);const l=o.index,g=(c=o.cache)[s]||(c[s]={indexMax:-1,queue:[]}),v=g.queue;if(l<=g.indexMax){const S=g.store||(g.store=new Map);if(v.length){for(let P=0,Yt=v.length;P<Yt;P+=2){const Kt=v[P*2],Qt=v[P*2+1];S.set(Kt,Qt)}v.length=0}const j=S.get(l);if(j===!1)return!1;if(Se(j))return o.index=j,!0;if(j)return o.index=j.index,j.output?.length&&o.output.push(...j.output),!0}const I=o.output.length,Ht=n(o);if(g.indexMax=Math.max(g.indexMax,l),Ht){const S=o.index,j=o.output.length;if(j>I){const P=o.output.slice(I,j);v.push(l,{index:S,output:P})}else v.push(l,S);return!0}else return v.push(l,!1),!1}}})(),se=u(e=>{let t;return n=>(t||(t=E(e())),t(n))},"G"),E=Fe(e=>{if(z(e))return Ce(e)?se(e):e;if(ee(e)||Te(e))return p(e);if(X(e))return M(e);if(Ue(e))return w(Object.values(e));throw new Error("Invalid rule")}),R=u(e=>e,"d"),Ge=u(e=>typeof e=="string","ke"),Je=u(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const c=o?.partial?n:t,l=c.get(s);if(l!==void 0)return l;const g=e(s,o);return c.set(s,g),g}},"Be"),He=u(e=>{const t={},n={};return(s,o)=>{const c=o?.partial?n:t;return c[s]??(c[s]=e(s,o))}},"Pe"),Ye=p(/\\./,R),Ke=p(/./,R),Qe=p(/\*\*\*+/,"*"),Xe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),et=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),tt=B(w([Ye,Qe,Xe,et,Ke])),nt=tt,rt=u(e=>te(e,nt,{memoization:!1}).join(""),"Ie"),ot=rt,ae="abcdefghijklmnopqrstuvwxyz",st=u(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ae[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ie=u(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ae.indexOf(e[n])+1;return t},"V"),W=u((e,t)=>{if(t<e)return W(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),at=u((e,t,n)=>W(e,t).map(s=>String(s).padStart(n,"0")),"qe"),ce=u((e,t)=>W(ie(e),ie(t)).map(st),"W"),x=u(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),C=u(e=>({children:e}),"y"),N=(()=>{const e=u((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let c=0,l=o.length;c<l;c++)e(o[c],n,s)},"e");return t=>{if(!t.length)return C([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],c=t[n];e(o,c,s)}return t[0]}})(),k=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),it=p(/\\./,x),ct=p(/[$.*+?^(){}[\]\|]/,e=>x(`\\${e}`)),ut=p(/[\\\/]/,k),lt=p(/[^$.*+?^(){}[\]\|\\\/]+/,x),ft=p(/^(?:!!)*!(.*)$/,(e,t)=>x(`(?!^${me.compile(t).source}$).*?`)),pt=p(/^(!!)+/),gt=w([ft,pt]),dt=p(/\/(\*\*\/)+/,()=>C([N([k(),x(".+?"),k()]),k()])),ht=p(/^(\*\*\/)+/,()=>C([x("^"),N([x(".*?"),k()])])),mt=p(/\/(\*\*)$/,()=>C([N([k(),x(".*?")]),x("$")])),xt=p(/\*\*/,()=>x(".*?")),ue=w([dt,ht,mt,xt]),$t=p(/\*\/(?!\*\*\/|\*$)/,()=>N([x("[^\\\\/]*?"),k()])),vt=p(/\*/,()=>x("[^\\\\/]*")),le=w([$t,vt]),fe=p("?",()=>x("[^\\\\/]")),bt=p("[",R),yt=p("]",R),wt=p(/[!^]/,"^\\\\/"),jt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,R),_t=p(/\\./,R),Ot=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,R),Rt=w([_t,Ot,Et,jt,kt]),pe=M([bt,re(wt),B(Rt),yt],e=>x(e.join(""))),At=p("{","(?:"),Mt=p("}",")"),Nt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>at(+t,+n,Math.min(t.length,n.length)).join("|")),Pt=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),zt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ct=w([Nt,Pt,zt]),ge=M([At,Ct,Mt],e=>x(e.join(""))),It=p("{"),St=p("}"),Ut=p(","),Tt=p(/\\./,x),Bt=p(/[$.*+?^(){[\]\|]/,e=>x(`\\${e}`)),Dt=p(/[\\\/]/,k),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,x),Lt=se(()=>he),qt=p("",()=>x("(?:)")),Wt=Ve(w([ue,le,fe,pe,ge,Lt,Tt,Bt,Dt,Ft]),N),de=w([Wt,qt]),he=M([It,re(M([de,B(M([Ut,de]))])),St],C),Zt=B(w([gt,ue,le,fe,pe,ge,he,it,ct,ut,lt]),N),Vt=Zt,Gt=u(e=>te(e,Vt,{memoization:!1})[0],"kr"),Jt=Gt,Z=u((e,t,n)=>Z.compile(e,n).test(t),"N");Z.compile=(()=>{const e=He((n,s)=>Ne(Jt(ot(n)),s)),t=Je((n,s)=>ze(n.map(o=>e(o,s))));return(n,s)=>Ge(n)?e(n,s):t(n,s)})();var me=Z;return m(y)})();return r.default||r},"_lazyMatch"),V;const mn=u((r,a)=>(V||(V=xe(),xe=null),V(r,a)),"default");var xn=Object.defineProperty,$n=H((r,a)=>xn(r,"name",{value:a,configurable:!0}),"t$1");const vn=/^[A-Z]:\//i,A=$n((r="")=>r&&r.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var bn=Object.defineProperty,b=H((r,a)=>bn(r,"name",{value:a,configurable:!0}),"r");const yn=/^[/\\]{2}/,wn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ye=/^[A-Z]:$/i,$e=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,_n=/^[/\\]|^[a-z]:[/\\]/i,On=b(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),we=b((r,a)=>{let i="",f=0,d=-1,h=0,$;for(let m=0;m<=r.length;++m){if(m<r.length)$=r[m];else{if($==="/")break;$="/"}if($==="/"){if(!(d===m-1||h===1))if(h===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const y=i.lastIndexOf("/");y===-1?(i="",f=0):(i=i.slice(0,y),f=i.length-1-i.lastIndexOf("/")),d=m,h=0;continue}else if(i.length>0){i="",f=0,d=m,h=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${r.slice(d+1,m)}`:i=r.slice(d+1,m),f=m-d-1;d=m,h=0}else $==="."&&h!==-1?++h:h=-1}return i},"normalizeString"),T=b(r=>wn.test(r),"isAbsolute"),je=b(function(r){if(r.length===0)return".";r=A(r);const a=yn.exec(r),i=T(r),f=r.at(-1)==="/";return r=we(r,!i),r.length===0?i?"/":f?"./":".":(f&&(r+="/"),ye.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!T(r)?`/${r}`:r)},"normalize"),En=b((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const f=a[a.length-1]==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return je(a)},"join"),G=b(function(...r){r=r.map(f=>A(f));let a="",i=!1;for(let f=r.length-1;f>=-1&&!i;f--){const d=f>=0?r[f]:On();!d||d.length===0||(a=`${d}/${a}`,i=T(d))}return a=we(a,!i),i&&!T(a)?`/${a}`:a.length>0?a:"."},"resolve");b(function(r){return A(r)},"toNamespacedPath");const kn=b(function(r){return jn.exec(A(r))?.[1]??""},"extname");b(function(r,a){const i=G(r).replace($e,"$1").split("/"),f=G(a).replace($e,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const h of d){if(f[0]!==h)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const _e=b(r=>{const a=A(r).replace(/\/$/,"").split("/").slice(0,-1);return a.length===1&&ye.test(a[0])&&(a[0]+="/"),a.join("/")||(T(r)?"/":".")},"dirname");b(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return A(r.root?G(...a):a.join("/"))},"format");const Rn=b((r,a)=>{const i=A(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");b(function(r){const a=_n.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Rn(r),f=kn(i);return{base:i,dir:_e(r),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");b((r,a)=>mn(a,je(r)),"matchesGlob");var An=Object.defineProperty,Mn=_((r,a)=>An(r,"name",{value:a,configurable:!0}),"e");let J=class extends an{static{_(this,"p")}static{Mn(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",f){super(a,i,f),this.name="UpdateNotifierError"}};var Nn=Object.defineProperty,Y=_((r,a)=>Nn(r,"name",{value:a,configurable:!0}),"n");const Pn="last-update-check.json",Oe=Y(r=>{const a=sn(r);if(a===void 0)throw new J("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return En(a,Pn)},"getConfigFile"),zn=Y(r=>{const a=Oe(r);try{if(!be(a))return;const{lastUpdateCheck:i}=JSON.parse(on(a,"utf8"));return i}catch{return}},"getLastUpdate"),Cn=Y(r=>{const a=Oe(r),i=_e(a);be(i)||nn(i,{recursive:!0}),rn(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var In=Object.defineProperty,Sn=_((r,a)=>In(r,"name",{value:a,configurable:!0}),"g");const Un=Sn(async(r,a,i)=>{const f=i.replace("__NAME__",r);return await new Promise((d,h)=>{cn(f,$=>{let m="";$.on("data",y=>m+=y),$.on("end",()=>{try{const y=JSON.parse(m)[a];y||h(new J("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d(y)}catch{h(new J("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",$=>h($))})},"getDistributionVersion");var Tn=Object.defineProperty,Bn=_((r,a)=>Tn(r,"name",{value:a,configurable:!0}),"i");const Zn=Bn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:f,registryUrl:d="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:h=1e3*60*60*24})=>{const $=zn(f.name);if(r||!$||$<Date.now()-h){const m=await Un(f.name,i,d);if(Cn(f.name),fn(m,f.version))return m;a&&console.error(`Latest version (${m}) not newer than current version (${f.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${h}ms but only ${Date.now()-$}ms since last check.`)},"hasNewVersion");export{Zn as default};
1
+ var Xt=Object.defineProperty;var _=(r,a)=>Xt(r,"name",{value:a,configurable:!0});import{createRequire as en}from"node:module";import{findCacheDirSync as sn}from"@visulima/find-cache-dir";import{c as an}from"../packem_shared/cerebro-error-BnJTixb2.js";const tn=en(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ve=_(r=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[a,i]=U.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return U.getBuiltinModule(r)}return tn(r)},"__cjs_getBuiltinModule"),{existsSync:be,readFileSync:nn,mkdirSync:rn,writeFileSync:on}=ve("node:fs"),{get:cn}=ve("node:https");var un=Object.defineProperty,ln=_((r,a)=>un(r,"name",{value:a,configurable:!0}),"o$1");const fn=ln((r,a)=>{const i=r.split(".").map(Number),f=a.split(".").map(Number);for(const[d,h]of i.entries()){if(h>f[d])return!0;if(h<f[d])return!1}return!1},"semverGt");var pn=Object.defineProperty,gn=_((r,a)=>pn(r,"name",{value:a,configurable:!0}),"$e"),dn=Object.defineProperty,H=gn((r,a)=>dn(r,"name",{value:a,configurable:!0}),"W"),hn=Object.defineProperty,u=H((r,a)=>hn(r,"name",{value:a,configurable:!0}),"u$1");let xe=u(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,h=u((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),$=u((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!d.call(e,o)&&o!==n&&a(e,o,{get:u(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),m=u(e=>$(a({},"__esModule",{value:!0}),e),"oe"),y={};h(y,{zeptomatch:u(()=>me,"zeptomatch")});var K=u(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:c}=o;if(c?.length)for(let l=0,g=c.length;l<g;l++)n.push(c[l])}return Array.from(t)},"M"),Ee=u(e=>{let t="";const n=K(e);for(let s=0,o=n.length;s<o;s++){const c=n[s];if(!c.regex)continue;const l=c.regex.flags;if(t||(t=l),t!==l)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${l}"`)}return t},"se"),Q=u((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let c="";if(e.regex&&(c+=o?"(?:$|":"",c+=e.regex.source),e.children?.length){const l=Re(e.children.map(g=>Q(g,t,n)).filter(Boolean));if(l?.length){const g=e.children.some(C=>!C.regex||!(C.partial??t)),v=l.length>1||o&&(!c.length||g);c+=v?o?"(?:$|":"(?:":"",c+=l.join("|"),c+=v?")":""}}return e.regex&&(c+=o?")":""),n.set(e,c),c},"O"),ke=u((e,t)=>{const n=new Map,s=K(e);for(let o=s.length-1;o>=0;o--){const c=Q(s[o],t,n);if(!(o>0))return c}return""},"ie"),Re=u(e=>Array.from(new Set(e)),"ue"),D=u((e,t,n)=>D.compile(e,n).test(t),"R");D.compile=(e,t)=>{const n=t?.partial??!1,s=ke(e,n),o=Ee(e);return new RegExp(`^(?:${s})$`,o)};var Me=D,Ae=u((e,t)=>{const n=Me.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ne=Ae,Se=u(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Pe=Se,X=u(e=>Array.isArray(e),"j"),P=u(e=>typeof e=="function","_"),ze=u(e=>e.length===0,"he"),Ce=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ie=u(e=>typeof e=="number","de"),Ue=u(e=>typeof e=="object"&&e!==null,"xe"),Te=u(e=>e instanceof RegExp,"me"),Be=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),De=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ee=u(e=>typeof e=="string","A"),O=u(e=>e===void 0,"f"),Fe=u(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),te=u((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=E(t)(s),c=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${c}`)},"I"),p=u((e,t)=>X(e)?Le(e,t):ee(e)?ne(e,t):qe(e,t),"i"),Le=u((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let c=s.index,l=c;for(;l<o.length&&o.charCodeAt(l)in n;)l+=1;if(l>c){if(!O(t)&&!s.options.silent){const g=o.slice(c,l),v=P(t)?t(g,o,`${c}`):t;O(v)||s.output.push(v)}s.index=l}return!0}},"we"),qe=u((e,t)=>{if(De(e))return ne(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return Be(e)&&P(t)&&!Ce(t)?We(o,t):Ze(o,t)}},"$e"),We=u((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const c=e.exec(o);if(c){const l=e.lastIndex;if(!n.options.silent){const g=t(...c,o,`${s}`);O(g)||n.output.push(g)}return n.index=l,!0}else return!1},"Ee"),Ze=u((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const c=e.lastIndex;if(!O(t)&&!n.options.silent){const l=P(t)?t(o.slice(s,c),o,`${s}`):t;O(l)||n.output.push(l)}return n.index=c,!0}else return!1},"Ce"),ne=u((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!O(t)&&!n.options.silent){const c=P(t)?t(e,o,`${s}`):t;O(c)||n.output.push(c)}return n.index+=e.length,!0}else return!1},"F"),F=u((e,t,n,s)=>{const o=E(e),c=t>1;return q(L(oe(l=>{let g=0;for(;g<n;){const v=l.index;if(!o(l)||(g+=1,l.index===v))break}return g>=t},c),s))},"k"),re=u((e,t)=>F(e,0,1,t),"L"),B=u((e,t)=>F(e,0,1/0,t),"$"),Ve=u((e,t)=>F(e,1,1/0,t),"Re"),A=u((e,t)=>{const n=e.map(E);return q(L(oe(s=>{for(let o=0,c=n.length;o<c;o++)if(!n[o](s))return!1;return!0}),t))},"x"),w=u((e,t)=>{const n=e.map(E);return q(L(s=>{for(let o=0,c=n.length;o<c;o++)if(n[o](s))return!0;return!1},t))},"p"),oe=u((e,t=!0,n=!1)=>{const s=E(e);return t?o=>{const c=o.index,l=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=c,o.output.length!==l&&(o.output.length=l)),g}:s},"q"),L=u((e,t)=>{const n=E(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const c=s.output.splice(o,1/0),l=t(c);return O(l)||s.output.push(l),!0}else return!1}:n},"B"),q=(()=>{let e=0;return t=>{const n=E(t),s=e+=1;return o=>{var c;if(o.options.memoization===!1)return n(o);const l=o.index,g=(c=o.cache)[s]||(c[s]={indexMax:-1,queue:[]}),v=g.queue;if(l<=g.indexMax){const I=g.store||(g.store=new Map);if(v.length){for(let S=0,Yt=v.length;S<Yt;S+=2){const Kt=v[S*2],Qt=v[S*2+1];I.set(Kt,Qt)}v.length=0}const j=I.get(l);if(j===!1)return!1;if(Ie(j))return o.index=j,!0;if(j)return o.index=j.index,j.output?.length&&o.output.push(...j.output),!0}const C=o.output.length,Ht=n(o);if(g.indexMax=Math.max(g.indexMax,l),Ht){const I=o.index,j=o.output.length;if(j>C){const S=o.output.slice(C,j);v.push(l,{index:I,output:S})}else v.push(l,I);return!0}else return v.push(l,!1),!1}}})(),se=u(e=>{let t;return n=>(t||(t=E(e())),t(n))},"G"),E=Fe(e=>{if(P(e))return ze(e)?se(e):e;if(ee(e)||Te(e))return p(e);if(X(e))return A(e);if(Ue(e))return w(Object.values(e));throw new Error("Invalid rule")}),R=u(e=>e,"d"),Ge=u(e=>typeof e=="string","ke"),Je=u(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const c=o?.partial?n:t,l=c.get(s);if(l!==void 0)return l;const g=e(s,o);return c.set(s,g),g}},"Be"),He=u(e=>{const t={},n={};return(s,o)=>{const c=o?.partial?n:t;return c[s]??(c[s]=e(s,o))}},"Pe"),Ye=p(/\\./,R),Ke=p(/./,R),Qe=p(/\*\*\*+/,"*"),Xe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),et=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),tt=B(w([Ye,Qe,Xe,et,Ke])),nt=tt,rt=u(e=>te(e,nt,{memoization:!1}).join(""),"Ie"),ot=rt,ae="abcdefghijklmnopqrstuvwxyz",st=u(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ae[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ie=u(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ae.indexOf(e[n])+1;return t},"V"),W=u((e,t)=>{if(t<e)return W(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),at=u((e,t,n)=>W(e,t).map(s=>String(s).padStart(n,"0")),"qe"),ce=u((e,t)=>W(ie(e),ie(t)).map(st),"W"),x=u(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),z=u(e=>({children:e}),"y"),N=(()=>{const e=u((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let c=0,l=o.length;c<l;c++)e(o[c],n,s)},"e");return t=>{if(!t.length)return z([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],c=t[n];e(o,c,s)}return t[0]}})(),k=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),it=p(/\\./,x),ct=p(/[$.*+?^(){}[\]\|]/,e=>x(`\\${e}`)),ut=p(/[\\\/]/,k),lt=p(/[^$.*+?^(){}[\]\|\\\/]+/,x),ft=p(/^(?:!!)*!(.*)$/,(e,t)=>x(`(?!^${me.compile(t).source}$).*?`)),pt=p(/^(!!)+/),gt=w([ft,pt]),dt=p(/\/(\*\*\/)+/,()=>z([N([k(),x(".+?"),k()]),k()])),ht=p(/^(\*\*\/)+/,()=>z([x("^"),N([x(".*?"),k()])])),mt=p(/\/(\*\*)$/,()=>z([N([k(),x(".*?")]),x("$")])),xt=p(/\*\*/,()=>x(".*?")),ue=w([dt,ht,mt,xt]),$t=p(/\*\/(?!\*\*\/|\*$)/,()=>N([x("[^\\\\/]*?"),k()])),vt=p(/\*/,()=>x("[^\\\\/]*")),le=w([$t,vt]),fe=p("?",()=>x("[^\\\\/]")),bt=p("[",R),yt=p("]",R),wt=p(/[!^]/,"^\\\\/"),jt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,R),_t=p(/\\./,R),Ot=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,R),Rt=w([_t,Ot,Et,jt,kt]),pe=A([bt,re(wt),B(Rt),yt],e=>x(e.join(""))),Mt=p("{","(?:"),At=p("}",")"),Nt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>at(+t,+n,Math.min(t.length,n.length)).join("|")),St=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),Pt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),zt=w([Nt,St,Pt]),ge=A([Mt,zt,At],e=>x(e.join(""))),Ct=p("{"),It=p("}"),Ut=p(","),Tt=p(/\\./,x),Bt=p(/[$.*+?^(){[\]\|]/,e=>x(`\\${e}`)),Dt=p(/[\\\/]/,k),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,x),Lt=se(()=>he),qt=p("",()=>x("(?:)")),Wt=Ve(w([ue,le,fe,pe,ge,Lt,Tt,Bt,Dt,Ft]),N),de=w([Wt,qt]),he=A([Ct,re(A([de,B(A([Ut,de]))])),It],z),Zt=B(w([gt,ue,le,fe,pe,ge,he,it,ct,ut,lt]),N),Vt=Zt,Gt=u(e=>te(e,Vt,{memoization:!1})[0],"kr"),Jt=Gt,Z=u((e,t,n)=>Z.compile(e,n).test(t),"N");Z.compile=(()=>{const e=He((n,s)=>Ne(Jt(ot(n)),s)),t=Je((n,s)=>Pe(n.map(o=>e(o,s))));return(n,s)=>Ge(n)?e(n,s):t(n,s)})();var me=Z;return m(y)})();return r.default||r},"_lazyMatch"),V;const mn=u((r,a)=>(V||(V=xe(),xe=null),V(r,a)),"default");var xn=Object.defineProperty,$n=H((r,a)=>xn(r,"name",{value:a,configurable:!0}),"t$1");const vn=/^[A-Z]:\//i,M=$n((r="")=>r&&r.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var bn=Object.defineProperty,b=H((r,a)=>bn(r,"name",{value:a,configurable:!0}),"r");const yn=/^[/\\]{2}/,wn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ye=/^[A-Z]:$/i,$e=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,_n=/^[/\\]|^[a-z]:[/\\]/i,On=/\/$/,En=b(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),we=b((r,a)=>{let i="",f=0,d=-1,h=0,$;for(let m=0;m<=r.length;++m){if(m<r.length)$=r[m];else{if($==="/")break;$="/"}if($==="/"){if(!(d===m-1||h===1))if(h===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const y=i.lastIndexOf("/");y===-1?(i="",f=0):(i=i.slice(0,y),f=i.length-1-i.lastIndexOf("/")),d=m,h=0;continue}else if(i.length>0){i="",f=0,d=m,h=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${r.slice(d+1,m)}`:i=r.slice(d+1,m),f=m-d-1;d=m,h=0}else $==="."&&h!==-1?++h:h=-1}return i},"normalizeString"),T=b(r=>wn.test(r),"isAbsolute"),je=b(function(r){if(r.length===0)return".";r=M(r);const a=yn.exec(r),i=T(r),f=r.at(-1)==="/";return r=we(r,!i),r.length===0?i?"/":f?"./":".":(f&&(r+="/"),ye.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!T(r)?`/${r}`:r)},"normalize"),kn=b((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const f=a.at(-1)==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return je(a)},"join"),G=b(function(...r){r=r.map(f=>M(f));let a="",i=!1;for(let f=r.length-1;f>=-1&&!i;f--){const d=f>=0?r[f]:En();!d||d.length===0||(a=`${d}/${a}`,i=T(d))}return a=we(a,!i),i&&!T(a)?`/${a}`:a.length>0?a:"."},"resolve");b(function(r){return M(r)},"toNamespacedPath");const Rn=b(function(r){return jn.exec(M(r))?.[1]??""},"extname");b(function(r,a){const i=G(r).replace($e,"$1").split("/"),f=G(a).replace($e,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const h of d){if(f[0]!==h)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const _e=b(r=>{const a=M(r).replace(On,"").split("/").slice(0,-1);return a.length===1&&ye.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(T(r)?"/":".")},"dirname");b(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return M(r.root?G(...a):a.join("/"))},"format");const Mn=b((r,a)=>{const i=M(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");b(function(r){const a=_n.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Mn(r),f=Rn(i);return{base:i,dir:_e(r),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");b((r,a)=>mn(a,je(r)),"matchesGlob");var An=Object.defineProperty,Nn=_((r,a)=>An(r,"name",{value:a,configurable:!0}),"e");let J=class extends an{static{_(this,"p")}static{Nn(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",f){super(a,i,f),this.name="UpdateNotifierError"}};var Sn=Object.defineProperty,Y=_((r,a)=>Sn(r,"name",{value:a,configurable:!0}),"n");const Pn="last-update-check.json",Oe=Y(r=>{const a=sn(r);if(a===void 0)throw new J("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return kn(a,Pn)},"getConfigFile"),zn=Y(r=>{const a=Oe(r);try{if(!be(a))return;const{lastUpdateCheck:i}=JSON.parse(nn(a,"utf8"));return i}catch{return}},"getLastUpdate"),Cn=Y(r=>{const a=Oe(r),i=_e(a);be(i)||rn(i,{recursive:!0}),on(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var In=Object.defineProperty,Un=_((r,a)=>In(r,"name",{value:a,configurable:!0}),"g$1");const Tn=Un(async(r,a,i)=>{const f=i.replace("__NAME__",r);return await new Promise((d,h)=>{cn(f,$=>{let m="";$.on("data",y=>m+=String(y)),$.on("end",()=>{try{const y=JSON.parse(m)[a];y||h(new J("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d(y)}catch{h(new J("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",$=>{h($)})})},"getDistributionVersion");var Bn=Object.defineProperty,Dn=_((r,a)=>Bn(r,"name",{value:a,configurable:!0}),"i");const Vn=Dn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:f,registryUrl:d="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:h=1e3*60*60*24})=>{const $=zn(f.name);if(r||!$||$<Date.now()-h){const m=await Tn(f.name,i,d);if(Cn(f.name),fn(m,f.version))return m;a&&console.error(`Latest version (${m}) not newer than current version (${f.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${String(h)}ms but only ${String(Date.now()-$)}ms since last check.`)},"hasNewVersion");export{Vn as default};
@@ -0,0 +1,4 @@
1
+ var Dt=Object.defineProperty;var O=(t,e)=>Dt(t,"name",{value:e,configurable:!0});import{createRequire as Rt}from"node:module";import{VERBOSITY_DEBUG as F,POSITIONALS_KEY as oe,VERBOSITY_QUIET as Wt,VERBOSITY_VERBOSE as Ft,VERBOSITY_NORMAL as je}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as C}from"./cerebro-error-BnJTixb2.js";import{d as G,h as Ce,e as X,o as Le,a as qt,i as Gt,f as Ht}from"./runtime-process-DKHFvYkv.js";import{distance as Kt}from"fastest-levenshtein";const Bt=Rt(import.meta.url),J=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zt=O(t=>{if(typeof J<"u"&&J.versions&&J.versions.node){const[e,n]=J.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return J.getBuiltinModule(t)}return Bt(t)},"__cjs_getBuiltinModule"),{createRequire:Yt}=zt("node:module"),ae=[{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}];var Jt=Object.defineProperty,Qt=O((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"t$9");let B=class extends C{static{O(this,"a")}static{Qt(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"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(", ")}`)}};var Zt=Object.defineProperty,Xt=O((t,e)=>Zt(t,"name",{value:e,configurable:!0}),"e$7");let nt=class extends C{static{O(this,"o")}static{Xt(this,"ConflictingOptionsError")}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}`}};var en=Object.defineProperty,tn=O((t,e)=>en(t,"name",{value:e,configurable:!0}),"e$6");let nn=class extends C{static{O(this,"o")}static{tn(this,"PluginError")}pluginName;constructor(e,n,i){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:i,pluginName:e}),this.name="PluginError",this.pluginName=e,i&&(this.cause=i)}};var an=Object.defineProperty,Ie=O((t,e)=>an(t,"name",{value:e,configurable:!0}),"d$7");let on=class{static{O(this,"p")}static{Ie(this,"PluginManager")}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`);G().CEREBRO_OUTPUT_LEVEL===String(F)&&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 i of n)if(typeof i.init=="function"){this.logger.debug(`initializing plugin: ${i.name}`);try{await i.init(e)}catch(r){const a=new nn(i.name,`Failed to initialize: ${r instanceof Error?r.message:String(r)}`,r instanceof Error?r:void 0);throw this.logger.error(a.message),a}}this.initialized=!0}async executeLifecycle(e,n,i){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const r=this.getDependencyOrder();for(const a of r){const c=a[e];if(typeof c=="function"){this.logger.debug(`executing ${e} hook for plugin: ${a.name}`);try{await(e==="afterCommand"?c(n,i):c(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${a.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const i=this.getDependencyOrder();for(const r of i)if(typeof r.onError=="function"){this.logger.debug(`executing error handler for plugin: ${r.name}`);try{await r.onError(e,n)}catch(a){this.logger.error(`Error in error handler for plugin "${r.name}":`,a)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,r=Ie(a=>{if(n.has(a))return;if(i.has(a))throw new Error(`Circular dependency detected involving plugin "${a}"`);const c=this.plugins.get(a);if(!c)throw new Error(`Plugin "${a}" not found`);if(i.add(a),c.dependencies)for(const s of c.dependencies)r(s);i.delete(a),n.add(a),e.push(c)},"visit");for(const a of this.plugins.keys())r(a);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`)}}};var rn=Object.defineProperty,sn=O((t,e)=>rn(t,"name",{value:e,configurable:!0}),"n$c");const te=sn(t=>t.type?.name==="Boolean","optionIsBoolean");var ln=Object.defineProperty,at=O((t,e)=>ln(t,"name",{value:e,configurable:!0}),"p$a");const cn=at(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},"getTypeLabel"),Se=at(t=>(te(t)||(t.typeLabel=t.typeLabel??cn(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var un=Object.defineProperty,it=O((t,e)=>un(t,"name",{value:e,configurable:!0}),"e$4");const pn=new RegExp(/^-([^\d-])$/),fn=new RegExp(/^--(\S+)/),hn=new RegExp(/^-([^\d-]{2,})$/),dn=it(t=>pn.test(t)||fn.test(t)||hn.test(t),"isOption"),mn=it((t,e)=>{const n=e[0]&&dn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}},"commandLineCommands");var gn=Object.defineProperty,ot=O((t,e)=>gn(t,"name",{value:e,configurable:!0}),"i$b"),vn=Object.defineProperty,rt=ot((t,e)=>vn(t,"name",{value:e,configurable:!0}),"i"),wn=Object.defineProperty,st=rt((t,e)=>wn(t,"name",{value:e,configurable:!0}),"s"),yn=Object.defineProperty,lt=st((t,e)=>yn(t,"name",{value:e,configurable:!0}),"i"),bn=Object.defineProperty,ct=lt((t,e)=>bn(t,"name",{value:e,configurable:!0}),"t");ct(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let le=class extends Error{static{O(this,"v")}static{ot(this,"g")}static{rt(this,"p")}static{st(this,"V")}static{lt(this,"VisulimaError")}static{ct(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:r,name:a,stack:c,title:s}){super(r,{cause:e}),this.title=s,this.name=a,this.stack=c??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var $n=Object.defineProperty,ut=O((t,e)=>$n(t,"name",{value:e,configurable:!0}),"o$b"),On=Object.defineProperty,pt=ut((t,e)=>On(t,"name",{value:e,configurable:!0}),"o"),Pn=Object.defineProperty,En=pt((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"i");let An=class ft extends le{static{O(this,"a")}static{ut(this,"a")}static{pt(this,"t")}static{En(this,"AlreadySetError")}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,ft.prototype)}};var Cn=Object.defineProperty,ht=O((t,e)=>Cn(t,"name",{value:e,configurable:!0}),"t$7"),Nn=Object.defineProperty,dt=ht((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"e"),xn=Object.defineProperty,kn=dt((t,e)=>xn(t,"name",{value:e,configurable:!0}),"e");let Me=class mt extends le{static{O(this,"n")}static{ht(this,"n")}static{dt(this,"o")}static{kn(this,"UnknownOptionError")}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,mt.prototype)}};var _n=Object.defineProperty,gt=O((t,e)=>_n(t,"name",{value:e,configurable:!0}),"a$a"),jn=Object.defineProperty,vt=gt((t,e)=>jn(t,"name",{value:e,configurable:!0}),"a"),Ln=Object.defineProperty,In=vt((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"o");let Sn=class wt extends le{static{O(this,"n")}static{gt(this,"o")}static{vt(this,"e")}static{In(this,"UnknownValueError")}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,wt.prototype)}};var Mn=Object.defineProperty,yt=O((t,e)=>Mn(t,"name",{value:e,configurable:!0}),"i$8"),Un=Object.defineProperty,bt=yt((t,e)=>Un(t,"name",{value:e,configurable:!0}),"i"),Tn=Object.defineProperty,Vn=bt((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"i");let j=class $t extends le{static{O(this,"a")}static{yt(this,"o")}static{bt(this,"e")}static{Vn(this,"InvalidDefinitionsError")}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,$t.prototype)}};var Dn=Object.defineProperty,Rn=O((t,e)=>Dn(t,"name",{value:e,configurable:!0}),"z$1"),Bn=Object.defineProperty,K=Rn((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"S"),zn=Object.defineProperty,ce=K((t,e)=>zn(t,"name",{value:e,configurable:!0}),"o");const Ue=ce(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Te=ce(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Ve=ce(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Wn=ce((t,e)=>Array.isArray(t)?Ue(e)?t.map(Boolean):Te(e)?t.map(Number):Ve(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Ue(e)?!!t:Te(e)?Number(t):Ve(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var Fn=Object.defineProperty,qn=K((t,e)=>Fn(t,"name",{value:e,configurable:!0}),"e");const _=qn((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var Gn=Object.defineProperty,D=K((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"h$1");const Hn=/-([a-z])/g,Kn=/^\d+$/,ve=D(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Yn=D(t=>t.codePointAt(0)===95,"isSpecialKey"),De=D((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),Re=D(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Be=D((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),Jn=D((t,e,n,i,r)=>{let a=e.get(t)??n.get(t);if(!a&&i){const c=t.toLowerCase();a=i.get(c)??r?.get(c)}return a},"getDefinition"),Qn=D((t,e,n,i)=>{const r=n.debug??!1;_(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(r,"Starting argument resolution","resolver"),_(r,"Tokens:","resolver",t),_(r,"Definitions:","resolver",e),_(r,"Processing tokens...","resolver");const a=new Map,c=new Map,s=n.caseInsensitive?new Map:void 0,m=n.caseInsensitive?new Map:void 0,o=n.camelCase?new Map:void 0,u=n.camelCase?new Map:void 0;for(const f of e)if(a.set(f.name,f),f.alias&&c.set(f.alias,f),n.caseInsensitive&&s&&(s.set(f.name.toLowerCase(),f),f.alias&&m&&m.set(f.alias.toLowerCase(),f)),n.camelCase&&o&&u){const h=f.name.replaceAll(Hn,(v,w)=>w.toUpperCase());o.set(f.name,h),u.set(h,f.name)}const d={},l={},g=[],p=new Set;let b=!1;const $=e.find(f=>f.defaultOption),y=e.some(f=>f.group),E=e.some(f=>f.type===Number);for(let f=0;f<t.length;f++){const h=t[f];if(h.kind==="option-terminator"){d._unknown=i.slice(h.index),b=!0;break}if(h.kind==="option"&&h.name){let v=Jn(h.name,a,c,s,m);if(!v&&h.value===void 0&&E&&Kn.test(h.name)){const A=e.find(S=>S.type===Number);A&&(v=A,h.value=h.name,h.name=A.name)}const w=v?v.name:h.name,P=v?.multiple,k=v?.lazyMultiple;if(l[w]!==void 0&&!P&&!k&&!n.partial)throw new An(w);if(!v&&n.partial){const A=h.rawName??`--${h.name}${h.value!==void 0&&h.inlineValue?`=${h.value}`:""}`;g.push({index:h.index,value:A});continue}if(!v&&n.stopAtFirstUnknown){d._unknown=i.slice(h.index);break}if(!v&&!n.partial)throw new Me(h.name);if(h.value===void 0){const A=t[f+1],S=A?.kind==="option"&&!("name"in A)&&A.value!==void 0,I=A&&v&&!(v.type&&ve(v.type))&&(A.kind==="positional"||S),Vt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(I&&(!v?.defaultOption||Vt))if(P){let M=f+1;const ge=[];for(;M<t.length&&(t[M].kind==="positional"||t[M].kind==="option"&&!("name"in t[M])&&t[M].value!==void 0);)ge.push(t[M].value),p.add(t[M].index),M++;l[w]=l[w]===void 0?ge:De(l[w],ge),f=M-1}else k?(Be(l,w,A.value,!0),p.add(A.index),f++):(l[w]=A.value,p.add(A.index),f++);else v?.type&&ve(v.type)?Be(l,w,!0,P):l[w]=P?[]:null}else{let{value:A}=h;if(v?.type&&ve(v.type))switch(A){case"":{if(n.partial)l._unknown??=[],l._unknown.push(`${h.rawName??`--${h.name}`}${h.value?`=${h.value}`:""}`),A=!0;else throw new Me(h.name);break}case"false":{A=!1;break}case"true":{A=!0;break}default:A=!0}const S=[A];if(P){let I=f+1;for(;I<t.length&&t[I].kind==="positional";)S.push(t[I].value),p.add(t[I].index),I++;f=I-1}l[w]===void 0?l[w]=P||k?S:A:P||k?l[w]=De(l[w],S):l[w]=A}}else if(h.kind==="positional"&&n.stopAtFirstUnknown&&!p.has(h.index)&&!$){_(r,`Found unconsumed positional token at index ${String(h.index)}, stopping processing`,"resolver"),d._unknown=i.slice(h.index);break}}for(const[f,h]of Object.entries(l)){const v=a.get(f);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(h)&&(l[f]=[h])}let N=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const f of t)if(f.kind==="option"&&!a.has(f.name??"")&&!c.has(f.name??"")&&(!n.caseInsensitive||!s?.has(f.name?.toLowerCase()??"")&&!m?.has(f.name?.toLowerCase()??""))){N=f.index;break}}if($){const f=[],h=[];for(const v of t)v.kind==="positional"&&!p.has(v.index)&&v.index<N&&(f.push(v.value),h.push(v));if(f.length>0){const v=l[$.name],w=$.multiple??$.lazyMultiple;v===void 0?w?(h.forEach(P=>p.add(P.index)),l[$.name]=f):(p.add(h[0].index),l[$.name]=f[0]):w&&(h.forEach(P=>p.add(P.index)),l[$.name]=Array.isArray(v)?[...f,...v]:[...f,v])}}if(!n.partial){for(const f of t)if(f.kind==="positional"&&!p.has(f.index))throw new Sn(i[f.index])}if(n.partial&&!n.stopAtFirstUnknown){const f=[...g];if(l._unknown){const h=new Map;for(const[v,w]of i.entries())h.set(w,v);for(const v of l._unknown){const w=h.get(v);w!==void 0&&f.push({index:w,value:v})}}for(const h of t)h.kind==="positional"&&!p.has(h.index)&&f.push({index:h.index,value:i[h.index]});f.length>0&&(f.sort((h,v)=>h.index-v.index),d._unknown=f.map(h=>h.value))}if(n.stopAtFirstUnknown&&!b){const f=t.findIndex(w=>w.kind==="option"&&!a.has(w.name??"")&&!c.has(w.name??"")&&(!n.caseInsensitive||!s?.has(w.name?.toLowerCase()??"")&&!m?.has(w.name?.toLowerCase()??""))),h=t.findIndex(w=>w.kind==="positional"&&!p.has(w.index));let v=-1;if(f!==-1&&h!==-1?v=Math.min(f,h):f!==-1?v=f:h!==-1&&(v=h),v>=0){const w=t[v].index;d._unknown=i.slice(w)}}else g.length>0&&!n.partial&&(d._unknown=g.map(f=>f.value));for(const[f,h]of Object.entries(l)){const v=n.camelCase?o?.get(f)??f:f,w=a.get(f);d[v]=w?.type?Wn(h,w.type):h===void 0?null:h}for(const f of e){const h=n.camelCase?o?.get(f.name)??f.name:f.name;!(h in d)&&f.defaultValue!==void 0&&(f.multiple??f.lazyMultiple?d[h]=Array.isArray(f.defaultValue)?[...f.defaultValue]:[f.defaultValue]:d[h]=f.defaultValue)}if(y){const f={},h={},v={};for(const P of e)if(P.group){const k=Array.isArray(P.group)?P.group:[P.group];for(const A of k)Re(A)||(f[A]??={})}for(const P of Object.keys(d))if(!Yn(P)){h[P]=d[P];let k=P;n.camelCase&&(k=u?.get(P)??P);const A=a.get(k);if(A?.group){const S=Array.isArray(A.group)?A.group:[A.group];for(const I of S)Re(I)||f[I]&&(f[I][P]=d[P])}else v[P]=d[P]}const w={_all:h};for(const[P,k]of Object.entries(f))w[P]=k;Object.keys(v).length>0&&(w._none=v),d._unknown&&(w._unknown=d._unknown),Object.keys(d).forEach(P=>delete d[P]),Object.assign(d,w)}return _(r,"Final parsed result:","resolver",d),d},"resolveArgs");var Zn=Object.defineProperty,R=K((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"l");const V="-".codePointAt(0),T="=",Xn=T.codePointAt(0),ea="--",ta="-",na="--",Ot=R(t=>t.length>2&&t.startsWith(na),"hasLongOptionPrefix"),aa=R(t=>Ot(t)&&!t.includes(T,3),"isLongOption"),ia=R(t=>Ot(t)&&t.includes(T,3),"isLongOptionAndValue"),oa=R(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==V,"hasOptionValue"),ra=R(t=>{if(t.length!==2||t.codePointAt(0)!==V||t.codePointAt(1)===V)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),sa=R(t=>!(t.length<=2||t.codePointAt(0)!==V||t.codePointAt(1)===V),"isShortOptionGroup"),la=R(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const a=n.shift();if(a===void 0)break;const c=n[0];if(r>0?r--:i++,a===ea){e.push({index:i,kind:"option-terminator"});const s=n.map((m,o)=>({index:i+o+1,kind:"positional",value:m}));e.push(...s),i+=n.length;break}if(ra(a)){const s=a.charAt(1);let m;r?(e.push({index:i,kind:"option",name:s,rawName:a,value:m}),r===1&&oa(c)&&(m=n.shift(),e.push({index:i,kind:"option",value:m}))):e.push({index:i,kind:"option",name:s,rawName:a,value:m}),m!==void 0&&++i;continue}if(sa(a)&&!a.includes(T)){const s=[];let m="",o=!1;for(let u=1;u<a.length;u++){const d=a.charAt(u);o?m+=d:d.codePointAt(0)===Xn?o=!0:s.push(`${ta}${d}`)}if(o)if(s.length>0){const u=s.pop();s.push(`${u}=${m}`)}else s.push(m);n.unshift(...s),r=s.length;continue}if(aa(a)){const s=a.slice(2);e.push({index:i,kind:"option",name:s,rawName:a});continue}if(ia(a)){const s=a.indexOf(T),m=a.slice(2,s),o=a.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:m,rawName:a,value:o});continue}if(a.length>2&&a.codePointAt(0)===V&&a.codePointAt(1)!==V&&a.includes(T)){const s=a.indexOf(T),m=a.charAt(1),o=a.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:m,rawName:a,value:o});continue}e.push({index:i,kind:"positional",value:a})}return e},"parseArgsTokens");var ca=Object.defineProperty,xe=K((t,e)=>ca(t,"name",{value:e,configurable:!0}),"d");const ua=/\d/,pa=xe(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),fa=xe(t=>typeof t=="function","isValidCustomTypeFunction"),ha=xe((t,e,n)=>{const i=n?.debug??!1;_(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,a=new Set,c=new Set,s=new Set;let m=0;for(const o of t){if(_(i,"Checking definition:","validation",o),!o.name)throw _(i,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof o.name!="string")throw new j("Invalid option definition: name must be a string");if(o.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const u=e?o.name.toLowerCase():"";if(r.has(o.name)||e&&c.has(u))throw new j(`Invalid option definition: duplicate name '${o.name}'`);if(a.has(o.name)||e&&s.has(u))throw new j(`Invalid option definition: name '${o.name}' conflicts with an existing alias`);if(r.add(o.name),e&&c.add(u),o.alias!==void 0){if(typeof o.alias!="string")throw new j("Invalid option definition: alias must be a string");if(o.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(ua.test(o.alias))throw new j("Invalid option definition: alias cannot be numeric");if(o.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const d=e?o.alias.toLowerCase():"";if(a.has(o.alias)||e&&s.has(d))throw new j(`Invalid option definition: duplicate alias '${o.alias}'`);if(r.has(o.alias)||e&&c.has(d))throw new j(`Invalid option definition: alias '${o.alias}' conflicts with an existing option name`);a.add(o.alias),e&&s.add(d)}if(o.defaultOption&&(m++,o.type!==void 0&&pa(o.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(o.type!==void 0&&!(o.type===Boolean||o.type===Number||o.type===String||typeof o.type=="function"&&fa(o.type)))throw new j("Invalid option definition: invalid type")}if(m>1)throw _(i,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");_(i,"Validation completed successfully","validation")},"validateDefinitions");var da=Object.defineProperty,ma=K((t,e)=>da(t,"name",{value:e,configurable:!0}),"O");const ga=ma((t,e={})=>{const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",r),ha(r,i.caseInsensitive,n?i:void 0);let{argv:a}=i;if(!a&&(a=process.argv.slice(2),process.execArgv.length>0)){const o=new Set(process.execArgv);a=a.filter(u=>!o.has(u))}_(n,"Using argv:","index",a);let c=a;i.caseInsensitive&&(c=a.map(o=>{if(o.startsWith("--")){const u=o.indexOf("="),d=(u===-1?o.slice(2):o.slice(2,u)).toLowerCase();return u===-1?`--${d}`:`--${d}${o.slice(u)}`}if(o.startsWith("-")&&!o.startsWith("--")&&o.length>1){const u=o.slice(1).split("=",2),d=u[0],l=u[1];if(!d)return o;const g=d.toLowerCase();return l===void 0?`-${g}`:`-${g}=${l}`}return o}));const s=la(c.map(String));_(n,"Tokenized arguments:","index",s);const m=Qn(s,r,i,a);return _(n,"Command-line-args parsing completed","index"),m},"commandLineArgs");var va=Object.defineProperty,wa=O((t,e)=>va(t,"name",{value:e,configurable:!0}),"n$8");let ya=class{static{O(this,"a")}static{wa(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var ba=Object.defineProperty,$a=O((t,e)=>ba(t,"name",{value:e,configurable:!0}),"n$7");let we=class extends C{static{O(this,"i")}static{$a(this,"CommandLoaderError")}commandName;constructor(e,n,i){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.",i!==void 0&&(this.cause=i)}};var Oa=Object.defineProperty,Pa=O((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"f$5");const Ea=/^-{1,2}(\w+)(=(.+))?$/,Pt=Pa((t,e,n,i)=>{const r=Ea.exec(t);if(r===null)return{};const a=r[1];if(!a)return{};const c=n&&i?n.get(a)??i.get(a):e.find(s=>s.name===a||s.alias===a);return c!==void 0?{argName:c.name,argValue:r[3],option:c}:{}},"getParameterOption");var Aa=Object.defineProperty,Ne=O((t,e)=>Aa(t,"name",{value:e,configurable:!0}),"e$3");const ze=Ne((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)},"convertType"),Ca=new Set(["0","1","false","true"]),Na=Ne((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=Ne((a,c)=>{const{argName:s,argValue:m,option:o}=Pt(c,e,n,i),{lastOption:u}=a;return o&&te(o)&&m&&s?a.partial[s]=ze(m,o):a.lastName&&u&&te(u)&&Ca.has(c)&&(a.partial[a.lastName]=ze(c,u)),{lastName:s,lastOption:o,partial:a.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var xa=Object.defineProperty,We=O((t,e)=>xa(t,"name",{value:e,configurable:!0}),"s$8");const ka=new Set(["0","1","false","true"]),_a=We((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=We((a,c)=>{const{argValue:s,option:m}=Pt(c,e,n,i),{lastOption:o}=a;if(o&&te(o)&&ka.has(c)){const{args:u}=a;return{args:u.slice(0,-1)}}return m&&te(m)&&s?{args:a.args}:{args:[...a.args,c],lastOption:m}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var ja=Object.defineProperty,La=O((t,e)=>ja(t,"name",{value:e,configurable:!0}),"o$8");const Fe=La(t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Ia=Object.defineProperty,ue=O((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"o$7");const Sa=ue(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),Ma=ue((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Sa(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)}},"transformEnvValue"),Ua=/_./g,Ta=/^[A-Z]/,Va=ue(t=>t.toLowerCase().replaceAll(Ua,e=>e[1]?.toUpperCase()??e).replace(Ta,e=>e.toLowerCase()),"toCamelCase"),Da=ue(t=>{if(!t||t.length===0)return{};const e={},n=G();for(const i of t){const r=n[i.name],a=Ma(i,r),c=a===void 0?i.defaultValue:a,s=Va(i.name);e[s]=c}return e},"processEnvVariables");var Ra=Object.defineProperty,ne=O((t,e)=>Ra(t,"name",{value:e,configurable:!0}),"a$5");const Ba=ne(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const r=Array.isArray(i.alias)?i.alias:[i.alias];for(const a of r)n.set(a,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),za=ne(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new we(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new we(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new we(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),Wa=ne((t,e,n,i)=>{const r=new ya(t.name,t),{_all:a,_unknown:c,positionals:s}=e,m=Object.keys(n).length>0?{...a,...n}:a;oe in m&&delete m[oe],r.argument=s?.[oe]??[],r.rawUnknown=[...c??[]];const o=Object.keys(i).length>0;return r.options=o?{...m,...i}:m,r.env=Da(t.env),r},"prepareToolbox"),Fa=ne((t,e,n)=>{const i=t.options??[],r=i.length>0;let a=Fe(r?[...i,...n]:n);if(a.length>0){for(const o of a)if(o.multiple&&o.lazyMultiple)throw new Error(`Argument "${o.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(a=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:oe,type:t.argument.type,typeLabel:t.argument.typeLabel},...a]);let c,s;if(r){const{optionMapByAlias:o,optionMapByName:u}=Ba(i);c=_a(e,i,u,o),s=Na(e,i,u,o)}else c=e,s={};const m=ga(a,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:a,booleanValues:s,parsedArgs:m}},"processCommandArgs"),z=ne(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await za(t))(e),"executeCommand");var qa=Object.defineProperty,Ga=O((t,e)=>qa(t,"name",{value:e,configurable:!0}),"n$6");let Ha=class extends C{static{O(this,"s")}static{Ga(this,"CommandValidationError")}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(", ")}`}};var Ka=Object.defineProperty,Ya=O((t,e)=>Ka(t,"name",{value:e,configurable:!0}),"t$5");const qe=Ya((t,e,n=!1)=>{const i=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}i.push(r)}return i},"listMissingArguments");var Ja=Object.defineProperty,Et=O((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"n$5");const Qa=Et((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Kt(t,e)<=t.length/3,"isSimilar"),q=Et((t,e)=>{const n=t.toLowerCase();return e.filter(i=>Qa(i.toLowerCase(),n))},"findAlternatives");var Za=Object.defineProperty,pe=O((t,e)=>Za(t,"name",{value:e,configurable:!0}),"a$4");const Xa=pe((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let a=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const c=q(i.replace("--",""),(e.options??[]).map(s=>s.name));if(c.length>0){const[s,...m]=c.map(o=>`--${o}`);a+=m.length>0?`, did you mean ${s??""} or ${m.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(a)}),n.length>0)throw new Error(n.join(`
2
+ `))},"validateUnknownOptions"),ei=pe((t,e,n)=>{const i=n.__requiredOptions__,r=i?qe(i,e,!0):qe(t,e,!1);if(r.length>0)throw new Ha(n.name,r.map(a=>a.name));e._unknown&&e._unknown.length>0&&!n.argument&&Xa(e,n)},"validateRequiredOptions"),ti=pe((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(a=>Array.isArray(a.conflicts)?a.conflicts.some(c=>e[c]!==void 0)&&e[a.name]!==void 0:e[a.conflicts]!==void 0&&e[a.name]!==void 0);if(r)throw new nt(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),ni=pe(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const a=e.get(r.name)??[];a.push(r),e.set(r.name,a)}if(typeof r.alias=="string"&&r.alias.length>0){const a=n.get(r.alias)??[];a.push(r),n.set(r.alias,a)}else if(Array.isArray(r.alias)){for(const a of r.alias)if(a.length>0){const c=n.get(a)??[];c.push(r),n.set(a,c)}}}const i=[];for(const[r,a]of e)a.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(a)}`);for(const[r,a]of n)a.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${a.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
3
+ `))},"validateDuplicateOptions");var ai=Object.defineProperty,ke=O((t,e)=>ai(t,"name",{value:e,configurable:!0}),"s$4");const ii=ke((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let r=1;r<=e.length;r+=1){const a=e[r-1];if(a===void 0||a.startsWith("-"))break;n.push(a);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:r})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),Q=ke(t=>t.join(" "),"getCommandPathKey"),oi=ke((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var ri=Object.defineProperty,si=O((t,e)=>ri(t,"name",{value:e,configurable:!0}),"p$4"),li=Object.defineProperty,At=si((t,e)=>li(t,"name",{value:e,configurable:!0}),"e"),ci=Object.defineProperty,ui=At((t,e)=>ci(t,"name",{value:e,configurable:!0}),"E");const Ct=String.raw,Ge=Ct`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,pi=ui(()=>new RegExp(Ct`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${Ge}(?:\u200D${Ge})*`,"gu"),"default");var fi=Object.defineProperty,hi=At((t,e)=>fi(t,"name",{value:e,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const H=pi(),di=/[-_./\s]+/g,ee=/(\u001B\[[0-9;]*[a-z])/i,He=new RegExp("\\p{Script=Arabic}","u"),mi=new RegExp("\\p{Script=Bengali}","u"),W=new RegExp("\\p{Script=Cyrillic}","u"),gi=new RegExp("\\p{Script=Devanagari}","u"),vi=new RegExp("\\p{Script=Ethiopic}","u"),ye=new RegExp("\\p{Script=Greek}","u"),Ke=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),wi=new RegExp("\\p{Script=Gujarati}","u"),yi=new RegExp("\\p{Script=Gurmukhi}","u"),Ye=new RegExp("\\p{Script=Hangul}","u"),Je=new RegExp("\\p{Script=Hebrew}","u"),bi=new RegExp("\\p{Script=Hiragana}","u"),Qe=new RegExp("\\p{Script=Han}","u"),$i=new RegExp("\\p{Script=Kannada}","u"),Oi=new RegExp("\\p{Script=Katakana}","u"),Pi=new RegExp("\\p{Script=Khmer}","u"),Ei=new RegExp("\\p{Script=Lao}","u"),L=new RegExp("\\p{Script=Latin}","u"),Ai=new RegExp("\\p{Script=Malayalam}","u"),Ci=new RegExp("\\p{Script=Myanmar}","u"),Ni=new RegExp("\\p{Script=Oriya}","u"),xi=new RegExp("\\p{Script=Sinhala}","u"),ki=new RegExp("\\p{Script=Tamil}","u"),_i=new RegExp("\\p{Script=Telugu}","u"),ji=new RegExp("\\p{Script=Thai}","u"),Li=new RegExp("\\p{Script=Tibetan}","u"),Ze=/[\u02BB\u02BC\u0027]/u,Ii=hi(t=>t.replace(H,""),"stripEmoji");var Si=Object.defineProperty,Nt=O((t,e)=>Si(t,"name",{value:e,configurable:!0}),"i$5"),Mi=Object.defineProperty,xt=Nt((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"r"),Ui=Object.defineProperty,Ti=xt((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"c");let kt=class{static{O(this,"l")}static{Nt(this,"y")}static{xt(this,"s")}static{Ti(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(i=>i!==e);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Vi=Object.defineProperty,Di=O((t,e)=>Vi(t,"name",{value:e,configurable:!0}),"r$5"),Ri=Object.defineProperty,Bi=Di((t,e)=>Ri(t,"name",{value:e,configurable:!0}),"a"),zi=Object.defineProperty,Wi=Bi((t,e)=>zi(t,"name",{value:e,configurable:!0}),"s");const Fi=Wi((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var qi=Object.defineProperty,Gi=O((t,e)=>qi(t,"name",{value:e,configurable:!0}),"I"),Hi=Object.defineProperty,fe=Gi((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"W");const Ki=Yt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yi=fe(t=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[e,n]=Z.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Z.getBuiltinModule(t)}return Ki(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ji}=Yi("node:util");var Qi=Object.defineProperty,Zi=fe((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"g");const be=new kt(1e3),Xi=/[.*+?^${}()|[\]\\]/g,eo=Zi(t=>{const e=t.join("");if(be.has(e))return be.get(e);const n=t.map(r=>r.replaceAll(Xi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return be.set(e,i),i},"getSeparatorsRegex");var to=Object.defineProperty,no=fe((t,e)=>to(t,"name",{value:e,configurable:!0}),"t");const ao=no(t=>{const e=[];let n=0,i;for(H.lastIndex=0;(i=H.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=H.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var io=Object.defineProperty,x=fe((t,e)=>io(t,"name",{value:e,configurable:!0}),"u");const oo=/[ČŠŽĐ]/i,_t=new Uint8Array(128),jt=new Uint8Array(128),Lt=new Uint8Array(128);for(let t=0;t<128;t++)_t[t]=t>=65&&t<=90?1:0,jt[t]=t>=97&&t<=122?1:0,Lt[t]=t>=48&&t<=57?1:0;const $e=x(t=>_t[t],"isUpper"),Xe=x(t=>jt[t],"isLower"),Oe=x(t=>Lt[t],"isDigit"),U=x((t,e,n,i,r)=>{if(t.length===0)return[];let a=!1;const c=Object.values(e);for(const g of c)if(g(t[0])){a=!0;break}if(!a&&!n)return[t];const s=[...t],m=[];let o=s[0],u="other";const d=Object.entries(e);for(const g of d){const[p,b]=g;if(b(s[0])){u=p;break}}let l=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let g=1;g<s.length;g++){const p=s[g];let b="other";for(const E of d){const[N,f]=E;if(f(p)){b=N;break}}const $=n&&i?p===p.toLocaleUpperCase(i):!1;let y=!1;r?y=r(u,b,l,$,p,g,s):(u!==b&&u!=="other"&&b!=="other"&&(y=!0),n&&b!=="other"&&!l&&$&&(y=!0)),y?(m.push(o),o=p):o+=p,u=b,n&&(l=$)}return o&&o.length>0&&m.push(o),m.length>0?m:[t]},"handleScriptTransitions"),ro=x((t,e,n,i)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return i.push(r),e+r.length;return e},"detectAndProcessAcronym"),It=x((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],r=t.length;for(let a=1;a<r;a++){const c=ro(t,n,e,i);if(c!==n){n=c,a=n-1;continue}const s=t.codePointAt(a-1),m=t.codePointAt(a),o=s&&s<128&&$e(s),u=m&&m<128&&$e(m),d=s&&s<128&&Xe(s),l=s&&s<128&&Oe(s),g=m&&m<128&&Oe(m);if(d&&u){i.push(t.slice(n,a)),n=a;continue}if(l&&!g||!l&&g){i.push(t.slice(n,a)),n=a;continue}if(g&&!l){let p=!1,b=!1;if(a+1<r){const $=t.codePointAt(a+1);p=$&&$<128&&$e($),b=$&&$<128&&Oe($)}if(!b&&p){i.push(t.slice(n,a),t.slice(a,a+1)),n=a+1;continue}}if(a+1<r){const p=t.codePointAt(a+1),b=p&&p<128&&Xe(p);if(o&&u&&b){const $=t.slice(n,a+1);e.has($)||(i.push(t.slice(n,a)),n=a)}}}return n<r&&i.push(t.slice(n)),i.filter(a=>a!=="")},"splitCamelCaseFast"),St=x((t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const o=[...t],u=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e),p=g,b=g?0:-1;for(let $=1;$<u;$++){const y=o[$],E=y===y.toLocaleUpperCase(e);if(E===g)l+=y;else if(E)l&&l.length>0&&(d.push(l),l=y),p=!0,b=$;else{if(p&&$-b>1){const N=o[$-1],f=l.slice(0,-1);f&&f.length>0&&d.push(f),l=N+y}else l+=y;p=!1,b=-1}g=E}return l&&l.length>0&&d.push(l),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!L.test(t))return[t];const o=[...t],u=o.length,d=[];let l=o[0];const g=o[0];let p;W.test(g)?p=1:L.test(g)?p=2:p=0;let b=g===g.toLocaleUpperCase(e);for(let y=1;y<u;y++){const E=o[y];let N;W.test(E)?N=1:L.test(E)?N=2:N=0;const f=E===E.toLocaleUpperCase(e);p!==N&&(p===1||p===2)&&(N===1||N===2)||N===p&&!b&&f?(d.push(l),l=E):l+=E,p=N,b=f}l&&l.length>0&&d.push(l);const $=[];for(let y=0;y<d.length;y++)y<d.length-1&&d[y].length===1&&L.test(d[y])&&W.test(d[y+1][0])?($.push(d[y]+d[y+1]),y+=1):$.push(d[y]);return $}if(e.startsWith("el")){if(!ye.test(t)&&!L.test(t))return[t];const o=[];Ke.lastIndex=0;let u;for(;(u=Ke.exec(t))!==null;)o.push(u[0]);o.length===0&&o.push(t);const d=[];if(o.length===1){const l=o[0];if(!l||!ye.test(l[0])||l.length===1)return[l??t]}for(const l of o){if(!l)continue;if(!ye.test(l[0])||l.length===1){d.push(l);continue}const g=l.length;let p=l[0],b=l[0]===l[0].toLocaleUpperCase(e);for(let $=1;$<g;$++){const y=l[$],E=y===y.toLocaleUpperCase(e);!b&&E?(d.push(p),p=y):p+=y,b=E}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const o=e.startsWith("ja"),u=o?{hiragana:x(l=>bi.test(l),"hiragana"),kanji:x(l=>Qe.test(l),"kanji"),katakana:x(l=>Oi.test(l),"katakana"),latin:x(l=>L.test(l),"latin")}:{hangul:x(l=>Ye.test(l),"hangul"),latin:x(l=>L.test(l),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(o){const l=U(t,u,!1,e,(p,b)=>p==="hiragana"&&b==="katakana"||p==="katakana"&&b==="hiragana"||p==="hiragana"&&b==="latin"||p==="katakana"&&b==="latin"||p==="kanji"&&b==="latin"||p==="latin"&&(b==="hiragana"||b==="katakana"||b==="kanji")),g=[];for(const p of l){const b=p;b.length===1&&d.has(b)&&g.length>0?g[g.length-1]=g.at(-1)+b:g.push(b)}return g.length>0?g:[t]}return U(t,u,!1,e,(l,g)=>l==="hangul"&&g==="latin"||l==="latin"&&g==="hangul")}if(e.startsWith("sl")){const o=[...t],u=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const b=o[p],$=b===b.toLocaleUpperCase(e),y=oo.test(b),E=p<u-1&&o[p+1]===o[p+1].toLocaleUpperCase(e);!g&&$||y&&E?(d.push(l),l=b,y&&E&&(d.push(l),l="")):l+=b,g=$}return l&&l.length>0&&d.push(l),d}if(e.startsWith("zh"))return U(t,{han:x(o=>Qe.test(o),"han"),latin:x(o=>L.test(o),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const o=x(u=>Je.test(u)||He.test(u),"isRtlChar");return U(t,{latin:x(u=>L.test(u),"latin"),rtl:x(u=>o(u),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const o=x(u=>gi.test(u)||mi.test(u)||wi.test(u)||yi.test(u)||$i.test(u)||ki.test(u)||_i.test(u)||Ai.test(u)||xi.test(u)||ji.test(u)||Ei.test(u)||Li.test(u)||Ci.test(u)||vi.test(u)||Pi.test(u)||Ni.test(u),"isIndicChar");return U(t,{indic:x(u=>o(u),"indic"),latin:x(u=>L.test(u),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return U(t,{cyrillic:x(o=>W.test(o),"cyrillic"),latin:x(o=>L.test(o),"latin")},!0,e);if(["ar","fa","he"].includes(e))return U(t,{latin:x(o=>L.test(o),"latin"),rtl:x(o=>Je.test(o)||He.test(o),"rtl")},!1,e);if(e.startsWith("ko"))return U(t,{hangul:x(o=>Ye.test(o),"hangul"),latin:x(o=>L.test(o),"latin")},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!L.test(t))return[t];const o=[...t],u=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const b=o[p],$=b===b.toLocaleUpperCase(e);if(Ze.test(b)||Ze.test(o[p-1])){l+=b;continue}!g&&$?(d.push(l),l=b):l+=b,g=$}return l&&l.length>0&&d.push(l),d}const r=[...t],a=r.length,c=[];let s=r[0],m=r[0]===r[0].toLocaleUpperCase(e);for(const o of n)if(t.startsWith(o)){c.push(o),s=r[o.length],m=s===s.toLocaleUpperCase(e);break}for(let o=1;o<a;o++){const u=r[o],d=u===u.toLocaleUpperCase(e);let l=0;for(const g of n)if(t.startsWith(g,o)){c.push(s,g),l=g.length,s="";const p=g.at(-1);p&&(m=p===p.toLocaleUpperCase(e));break}if(l>0){o+=l-1;continue}!m&&d?(c.push(s),s=u):s+=u,m=d}return s&&c.push(s),c},"splitCamelCaseLocale"),so=x((t,e,n)=>{const i=[],r=ee.test(t)?t.split(ee).filter(Boolean):[t];for(const a of r){const c=a;if(ee.test(c))i.push(c);else{const s=H.test(c)?ao(c).filter(Boolean):[c];for(const m of s)if(H.test(m))i.push(m);else if(e){const o=e.toLowerCase().split("-")[0];i.push(...St(m,o,n))}else i.push(...It(m,n))}}return i},"processTextWithAnsiEmoji"),lo=x((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:a,normalize:c=!1,separators:s,stripAnsi:m=!1,stripEmoji:o=!1}=e,u=new Set([...r].toSorted((y,E)=>E.length-y.length));let d=t;m&&(d=Ji(d)),o&&(d=Ii(d));let l;Array.isArray(s)?l=eo(s):s instanceof RegExp?l=s:l=di;const g=[];let p=d;const b=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;p.length>0;){const y=b.exec(p);if(!y){p===".."?g.push(".."):p==="."?g.push("."):p.length>0&&g.push(p);break}const E=y.index,N=y[0],f=N.length,h=p.slice(0,E),v=p.slice(E+f);if(N.startsWith("../"))g.push(".."),p=p.slice(E+3);else if(N.startsWith("./"))g.push("."),p=p.slice(E+2);else if(E===0&&N==="..")g.push(".."),p=p.slice(2);else if(E===0&&N===".")g.push("."),p=p.slice(1);else{h.length>0&&g.push(h);let w=0;for(;(w=N.indexOf("../",w))!==-1;)g.push(".."),w+=3;for(w=0;(w=N.indexOf("./",w))!==-1;)(w===0||N[w-1]!==".")&&g.push("."),w+=2;let P=v;for(;P.startsWith("../");)g.push(".."),P=P.slice(3);for(;P.startsWith("./");)g.push("."),P=P.slice(2);if(P===".."){g.push("..");break}else if(P==="."){g.push(".");break}else p=P}b.lastIndex=0}if(g.length===0){const y=d.split(l).filter(Boolean);g.push(...y)}let $=[];for(const y of g)n||i?$.push(...so(y,a,u)):a?$.push(...St(y,a,u)):$.push(...It(y,u));return c&&($=$.map(y=>u.has(y)?y:a&&y===y.toLocaleUpperCase(a)?y[0]+y.slice(1).toLocaleLowerCase(a):y.toUpperCase()===y&&!u.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),$},"splitByCase");var co=Object.defineProperty,uo=O((t,e)=>co(t,"name",{value:e,configurable:!0}),"r$4"),po=Object.defineProperty,fo=uo((t,e)=>po(t,"name",{value:e,configurable:!0}),"o"),ho=Object.defineProperty,mo=fo((t,e)=>ho(t,"name",{value:e,configurable:!0}),"s");const go=mo((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var vo=Object.defineProperty,wo=O((t,e)=>vo(t,"name",{value:e,configurable:!0}),"r$3"),yo=Object.defineProperty,bo=wo((t,e)=>yo(t,"name",{value:e,configurable:!0}),"r"),$o=Object.defineProperty,Oo=bo((t,e)=>$o(t,"name",{value:e,configurable:!0}),"n");const Po=Oo((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var Eo=Object.defineProperty,Ao=O((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"i$3"),Co=Object.defineProperty,No=Ao((t,e)=>Co(t,"name",{value:e,configurable:!0}),"f"),xo=Object.defineProperty,ko=No((t,e)=>xo(t,"name",{value:e,configurable:!0}),"l");const _o=ko((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",a="";for(let c=0;c<n;c++){const s=t[c];if(ee.test(s)){r?(i.push(r+a+s),r="",a=""):(i.length>0&&i.push(e),r=s);continue}r?(a&&(a+=e),a+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var jo=Object.defineProperty,Lo=O((t,e)=>jo(t,"name",{value:e,configurable:!0}),"r$2"),Io=Object.defineProperty,So=Lo((t,e)=>Io(t,"name",{value:e,configurable:!0}),"a"),Mo=Object.defineProperty,Uo=So((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"e");const To=/(?<![a-zß])SS(?![a-z])/g,Vo=Uo(t=>t.replaceAll(To,"ß"),"normalizeGermanEszett");var Do=Object.defineProperty,Ro=O((t,e)=>Do(t,"name",{value:e,configurable:!0}),"c$2"),Bo=Object.defineProperty,zo=Ro((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"c"),Wo=Object.defineProperty,Fo=zo((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"o");const qo=new kt(1e3),Mt=Fo((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??qo;let r;if(n&&(r=Po(t,e)),n&&r&&i.has(r))return i.get(r);let a=!0;const c=_o(lo(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=>{if(e?.handleAnsi&&ee.test(s))return s;const m=e?.locale?.startsWith("de")?Vo(s):s,o=e?.locale?m.toLocaleLowerCase(e.locale):m.toLowerCase();return a?(a=!1,Fi(o,e)):go(o,e)}),"");return n&&r&&i.set(r,c),c},"camelCase");var Go=Object.defineProperty,he=O((t,e)=>Go(t,"name",{value:e,configurable:!0}),"a$2");const Ho=he(t=>{t.options?.forEach(e=>{e.__camelCaseName__=Mt(e.name)})},"processOptionNames"),Ko=he(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const r=i.name.replace("no-","");if(!e.has(r)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const a={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(a),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Yo=he((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const a of e.options)if(a.name.startsWith("no-")){const c=Mt(a.name);i.set(c,a)}const r=Object.keys(n).filter(a=>i.has(a));if(r.length!==0)for(const a of r){const c=a.charAt(2);if(!c)continue;const s=c.toLowerCase()+a.slice(3),m=i.get(a);m&&(m.__negated__=!0),n[s]=!n[a],Reflect.deleteProperty(n,a)}},"mapNegatableOptions"),Jo=he((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:i}=t;for(const r of Object.keys(i)){const a=n.get(r);if(a?.implies){const{implies:c}=a;for(const[s,m]of Object.entries(c))i[s]===void 0&&(i[s]=m)}}},"mapImpliedOptions");var Qo=Object.defineProperty,de=O((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"e$2");const Zo=de(()=>!!process.versions.electron,"isElectronApp"),Xo=de(()=>Zo()&&!process.defaultApp,"isBundledElectronApp"),er=de(()=>Xo()?0:1,"getProcessArgvBinIndex"),tr=de(t=>t.slice(er()+1),"hideBin");var nr=Object.defineProperty,Ut=O((t,e)=>nr(t,"name",{value:e,configurable:!0}),"e$1");const ar=" ",ir=Ut((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),or=Ut(t=>{if(typeof t=="string")return t.split(ar);const e=Ce();return ir(t,e)?tr(t):t},"parseRawCommand");var rr=Object.defineProperty,Pe=O((t,e)=>rr(t,"name",{value:e,configurable:!0}),"r");const sr=Pe(t=>{const e=Pe(a=>{t.error(`Uncaught exception: ${a.message||a}`),a.stack&&t.error(a.stack),X(1)},"uncaughtExceptionHandler"),n=Pe((a,c)=>{if(a instanceof Error)t.error(`Promise rejection: ${a.message||a}`),a.stack&&t.error(a.stack);else{let s;if(typeof a=="string")s=a;else try{s=JSON.stringify(a)}catch{s=String(a)}t.error(`Promise rejection: ${s}`)}X(1)},"unhandledRejectionHandler"),i=Le("uncaughtException",e),r=Le("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var lr=Object.defineProperty,Y=O((t,e)=>lr(t,"name",{value:e,configurable:!0}),"e");const se=100,Tt=/^[a-z][\w-]*$/i,_e=Y((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new C(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),et=Y((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new C(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");Y((t,e)=>{if(typeof t!="function")throw new C(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Ee=Y((t,e)=>{if(typeof t!="object"||t===null)throw new C(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),ie=Y(t=>{const e=_e(t,"Command name");if(e.length>se)throw new C(`Command name is too long (maximum ${String(se)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new C(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Tt.test(e))throw new C(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");Y(t=>{const e=_e(t,"Plugin name");if(e.length>se)throw new C(`Plugin name is too long (maximum ${String(se)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new C(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!Tt.test(e))throw new C(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var cr=Object.defineProperty,me=O((t,e)=>cr(t,"name",{value:e,configurable:!0}),"s");const ur=new Set([`
4
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),pr=/^[A-Z]:/i,fr=me(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);for(const e of t)if(ur.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),tt=me(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(e=>fr(e))},"sanitizeArguments");me(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||pr.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Lr{static{O(this,"RateLimiter")}static{me(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),i=this.attempts.get(e);return!i||n>i.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):i.count>=this.maxAttempts?!1:(i.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,i]of this.attempts.entries())e>i.resetTime&&this.attempts.delete(n)}}var hr=Object.defineProperty,re=O((t,e)=>hr(t,"name",{value:e,configurable:!0}),"v");const dr=/^-([^\d-])$/,mr=/^--(\S+)/,gr=/^-([^\d-]{2,})$/,Ae=re(t=>dr.test(t)||mr.test(t)||gr.test(t),"isOption");class Ir{static{O(this,"Cli")}static{re(this,"Cli")}#t;#e;#o;#c;#v;#u;#w;#r;#n;#a;#p;#s;#l;#f=!1;#y;#b=!1;#h;#d;#m;#g=[];#A(){return this.#h===void 0&&(this.#h=[...this.#a.keys()]),this.#h}#$(){return this.#d===void 0&&(this.#d=[...this.#n.keys()]),this.#d}#i(){return this.#m===void 0&&(this.#m=[...this.#A(),...this.#$()]),this.#m}#O(){return this.#g.length===0?ae:[...ae,...this.#g]}#C(){this.#h=void 0,this.#d=void 0,this.#m=void 0}#P(){if(this.#o===void 0){const e=or(this.#e.argv);this.#o=tt(e),this.#N()}return this.#o}#N(){if(!this.#o)return;const e=G();let n=!1;for(const i of this.#o){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Wt),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Ft),n=!0;break}if(i==="--debug"||i==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(F),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(F):String(je))}#x(){this.#b||(this.#y=sr(this.#t),this.#b=!0)}#E(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:a,booleanValues:c,parsedArgs:s}=Fa(e,n,this.#O()),m=Object.keys(c).length>0;let o=s;m&&(o={...s,_all:{...s._all,...c}}),ei(a,o,e);const u=Wa(e,s,c,i);u.runtime=this,u.argv=this.#P();const d=e.options&&e.options.length>0;if(d&&e.options){const l=e.options.filter(g=>g.name.startsWith("no-"));for(const g of l){const p=g.name.replace("no-",""),b=`--${g.name}`,$=`--${p}`,y=n.includes(b),E=n.includes($);if(y&&E)throw new nt(p,g.name)}}return d&&(Yo(u,e),Jo(u,e)),ti(a,u.options,e),G().CEREBRO_OUTPUT_LEVEL===String(F)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(u.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(u.argument,null,2))),{arguments_:a,booleanValues:c,commandArgs:o,parsedArgs:s,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new C("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#v=e.trim();const i=n.argv??Ce(),r=n.cwd??qt();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new C("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 C("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new C("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new C("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const a=G();if(a.CEREBRO_OUTPUT_LEVEL=String(je),typeof this.#e.logger=="object"){const c=["debug","error","info","log","warn"],s=[],m=this.#e.logger;for(const o of c)typeof m[o]!="function"&&s.push(o);if(s.length>0)throw new C(`Logger object is missing required methods: ${s.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:s});this.#t=this.#e.logger}else this.#t={...console,debug:re((...c)=>{a.CEREBRO_OUTPUT_LEVEL===String(F)&&console.debug(...c)},"debug")};this.#u=this.#e.packageVersion,this.#w=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#a=new Map,this.#p=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#v}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Ee(e,"Command"),ie(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new C(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new C(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ie(e.alias):et(e.alias,"Command alias").forEach(c=>ie(c))),e.argument&&Ee(e.argument,"Command argument"),e.options&&Ee(e.options,"Command options"),e.commandPath&&(et(e.commandPath,"Command commandPath"),e.commandPath.forEach(c=>{ie(c)}));const r=oi(e.name,e.commandPath),a=Q(r);if(this.#a.has(a))throw new C(`Command with path "${a}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});if(this.#n.has(e.name)&&!e.commandPath)throw new C(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const c of e.options)Se(c);if(ni(e),Ko(e),Ho(e),e.options&&(e.__conflictingOptions__=e.options.filter(c=>c.conflicts!==void 0),e.__requiredOptions__=e.options.filter(c=>c.required===!0)),this.#n.set(e.name,e),this.#a.set(a,r),this.#p.set(a,e),this.#C(),e.alias!==void 0){const c=typeof e.alias=="string"?[e.alias]:e.alias;for(const s of c){if(G().CEREBRO_OUTPUT_LEVEL===String(F)&&this.#t.debug("adding alias",s),this.#n.has(s))throw new C(`Command alias "${s}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:s,commandName:e.name});this.#n.set(s,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ae.map(a=>a.name)),r=new Set(ae.map(a=>a.alias).filter(Boolean));if(i.has(n.name))throw new C(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new C(`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.#g.map(a=>a.name)).has(n.name))throw new C(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Se(n),this.#g.push(n),this}getGlobalOptions(){return this.#O()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#r?this.#r:(this.#r=new on(this.#t),this.#r.register({description:"Attaches the logger to the toolbox",execute:re(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#r)}getCliName(){return this.#v}getPackageVersion(){return this.#u}getPackageName(){return this.#w}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:h}=await import("../commands/help-command.js");this.addCommand(new h(this.#n))}const a=this.#$(),c=this.#a;this.#x();const s=this.#P();let m,o=[...s];const u=Gt(),d=Ht(),l=Ce();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const g=ii(c,[...s]);if(g.commandPath)m=g.commandPath,o=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!Ae(s[0])&&!Ae(s[1])){const v=[];let w=0;for(;w<s.length;){const k=s[w];if(!k||Ae(k))break;v.push(k),w+=1}const P=Q(v);if(v[0]&&!a.includes(v[0])){const k=this.#i(),A=q(P,k);throw new B(P,A)}}let h;try{h=mn([null,...a],[...s])}catch(v){if(v instanceof Error&&v.name==="INVALID_COMMAND"&&"command"in v){const w=v.command,P=this.#i(),k=q(w,P);throw new B(w,k)}throw v}h.command&&(m=[h.command],o=h.argv)}if(!m)if(this.#s)m=[this.#s];else{const h=this.#i();throw new B("",h)}const p=Q(m),b=this.#a.get(p);let $;if(b){if($=this.#p.get(p),!$||Q(b)!==p){const h=this.#i(),v=q(p,h);throw new B(p,v)}}else{const h=m.at(-1);if($=h?this.#n.get(h):void 0,!$){const v=this.#i(),w=q(p,v);throw new B(p,w)}}if(typeof $.execute!="function"&&typeof $.loader!="function")return this.#t.error(`Command "${$.name}" has no function to execute.`),i?X(1):void 0;const y=o;let E,N;try{({commandArgs:E,toolbox:N}=this.#E($,y,r,p))}catch(h){if(this.#t.error(h),i)return X(1);throw h}const f=this.getPluginManager();try{!this.#f&&f.hasPlugins()&&(await f.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await f.executeLifecycle("execute",N),await f.executeLifecycle("beforeCommand",N);let h;const v=E.global;if(v?.help){const w=this.#n.get("help");if(!w)throw new C("Help command not found","COMMAND_NOT_FOUND");h=await z(w,N,E)}else if(v?.version??v?.V){const w=this.#n.get("version");if(!w)throw new C("Version command not found","COMMAND_NOT_FOUND");h=await z(w,N,E)}else h=await z($,N,E);return await f.executeLifecycle("afterCommand",N,h),i?X(0):void 0}catch(h){throw await f.executeErrorHandlers(h,N),h}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;_e(e,"Command name");const a=e.split(" ").filter(Boolean),c=Q(a),s=this.#a.get(c)?this.#p.get(c):this.#n.get(e);if(!s){const l=this.#i(),g=q(c||e,l);throw new B(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new C(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const m=[...tt(i)];this.#t.debug(`running command '${e}' programmatically with args: ${m.join(", ")}`);const{commandArgs:o,toolbox:u}=this.#E(s,m,r,c||e),d=this.getPluginManager();try{!this.#f&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await d.executeLifecycle("execute",u),await d.executeLifecycle("beforeCommand",u);let l;const g=o.global;if(g?.help){const p=this.#n.get("help");if(!p)throw new C("Help command not found","COMMAND_NOT_FOUND");l=await z(p,u,o)}else if(g?.version??g?.V){const p=this.#n.get("version");if(!p)throw new C("Version command not found","COMMAND_NOT_FOUND");l=await z(p,u,o)}else l=await z(s,u,o);return await d.executeLifecycle("afterCommand",u,l),l}catch(l){throw await d.executeErrorHandlers(l,u),l}}}export{Ir as Cli};
@@ -0,0 +1,76 @@
1
+ var U=Object.defineProperty;var s=(e,r)=>U(e,"name",{value:r,configurable:!0});import{createRequire as q}from"node:module";import{k as Dr,N as Jr,Q as Lr,G as Fr}from"./renderError-B_XyYPKJ-B65kP-Ou.js";import{p as Mr,V as Vr}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";const z=q(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=s(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[r,t]=g.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return g.getBuiltinModule(e)}return z(e)},"__cjs_getBuiltinModule"),{createRequire:K}=B("node:module");var Y=Object.defineProperty,H=s((e,r)=>Y(e,"name",{value:r,configurable:!0}),"s$7"),X=Object.defineProperty,W=H((e,r)=>X(e,"name",{value:r,configurable:!0}),"o"),G=Object.defineProperty,x=W((e,r)=>G(e,"name",{value:r,configurable:!0}),"l");const A=x((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},"binarySearch"),Q=/\n|\r(?!\n)/,Z=x(e=>e.split(Q).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),"getLineStartIndexes"),jr=x((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=Z(e),i=A(r,a);return{column:r-a[i]+1,line:i+1}}const o=A(r,e);return{column:r-e[o]+1,line:o+1}},"indexToLineColumn");var ee=Object.defineProperty,re=s((e,r)=>ee(e,"name",{value:r,configurable:!0}),"t$5"),te=Object.defineProperty,ne=re((e,r)=>te(e,"name",{value:r,configurable:!0}),"i"),oe=Object.defineProperty,ae=ne((e,r)=>oe(e,"name",{value:r,configurable:!0}),"t");const Or=ae(({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}`,"aiPrompt");var ie=Object.defineProperty,se=s((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o$5"),ue=Object.defineProperty,ce=se((e,r)=>ue(e,"name",{value:r,configurable:!0}),"i"),le=Object.defineProperty,C=ce((e,r)=>le(e,"name",{value:r,configurable:!0}),"i");const T=C((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()},"between"),Pr=C(e=>{const r=T("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>.',`"${e}"`].join("</br></br>");const t=T("LINKS","ENDLINKS",e).split(`
33
+ `).map(n=>JSON.parse(n));return`${r.replaceAll(/"([^"]*)"(?:\s|\.)/g,"<code>$1</code> ")}
34
+
35
+ ## Links
36
+
37
+ ${t.map(n=>`- <a href="${n.url}" target="_blank" rel="noopener noreferrer">${n.title}</a>`).join(`
38
+ `)}
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.`},"aiSolutionResponse");var fe=Object.defineProperty,pe=s((e,r)=>fe(e,"name",{value:r,configurable:!0}),"i$4"),me=Object.defineProperty,de=pe((e,r)=>me(e,"name",{value:r,configurable:!0}),"r"),be=Object.defineProperty,ge=de((e,r)=>be(e,"name",{value:r,configurable:!0}),"n");const Er={handle:ge(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),"handle"),name:"errorHint",priority:1};var ye=Object.defineProperty,ve=s((e,r)=>ye(e,"name",{value:r,configurable:!0}),"m$1"),he=Object.defineProperty,$e=ve((e,r)=>he(e,"name",{value:r,configurable:!0}),"m"),je=Object.defineProperty,u=$e((e,r)=>je(e,"name",{value:r,configurable:!0}),"t");const Oe=u(e=>`\`\`\`
43
+ ${e.trim()}
44
+ \`\`\``,"code"),$=u(e=>`\`\`\`bash
45
+ ${e.trim()}
46
+ \`\`\``,"bash"),j=u(e=>`\`\`\`ts
47
+ ${e.trim()}
48
+ \`\`\``,"ts"),Pe=u(e=>`\`\`\`js
49
+ ${e.trim()}
50
+ \`\`\``,"js"),p=u((e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},"has"),Ee=[{name:"esm-cjs-interop",test:u(e=>{const{message:r}=e;if(p(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:",$(`node -v
51
+ cat package.json | jq .type`),"","Example dynamic import in CJS:",Pe("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
52
+ `),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:u(e=>{const{message:r}=e;if(p(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:",j(`export default function Component() {}
53
+ // import Component from './file'`),"","Named export example:",j(`export function Component() {}
54
+ // import { Component } from './file'`)].join(`
55
+ `),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:u(e=>{const{message:r}=e;if(p(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:",$(`lsof -i :3000
56
+ kill -9 <PID>`),"","On Windows (PowerShell):",$(`netstat -ano | findstr :3000
57
+ taskkill /PID <PID> /F`)].join(`
58
+ `),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:u((e,r)=>{const{message:t}=e;if(p(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:",Oe(`${r.file}:${String(r.line)}`)].join(`
59
+ `),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:u(e=>{const{message:r}=e;if(p(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:",j(`{
60
+ "compilerOptions": {
61
+ "baseUrl": ".",
62
+ "paths": { "@/*": ["src/*"] }
63
+ }
64
+ }`)].join(`
65
+ `),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:u(e=>{const{message:r}=e;if(p(r,"enotfound","getaddrinfo enotfound","dns","fetch failed","ecconnrefused","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.","",$(`ping <host>
66
+ nslookup <host>
67
+ curl -v http://<host>:<port>`)].join(`
68
+ `),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:u(e=>{const{message:r}=e;if(p(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.","",j("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
69
+ `),title:"Accessing property of undefined"}},"test")}],Sr={handle:u((e,r)=>{try{const t=Ee.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)}},"handle"),name:"ruleBasedHints",priority:0};var Se=Object.defineProperty,_=s((e,r)=>Se(e,"name",{value:r,configurable:!0}),"t$3"),we=Object.defineProperty,D=_((e,r)=>we(e,"name",{value:r,configurable:!0}),"t"),xe=Object.defineProperty,ke=D((e,r)=>xe(e,"name",{value:r,configurable:!0}),"s");let m=class extends Error{static{s(this,"i")}static{_(this,"c")}static{D(this,"e")}static{ke(this,"NonError")}constructor(r){super(r),this.name="NonError"}};var Ne=Object.defineProperty,Ae=s((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"a$2"),Te=Object.defineProperty,Ie=Ae((e,r)=>Te(e,"name",{value:r,configurable:!0}),"a"),Ce=Object.defineProperty,_e=Ie((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"e");const xr=_e(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace");var De=Object.defineProperty,Je=s((e,r)=>De(e,"name",{value:r,configurable:!0}),"E$1"),Le=Object.defineProperty,Fe=Je((e,r)=>Le(e,"name",{value:r,configurable:!0}),"E"),Re=Object.defineProperty,P=Fe((e,r)=>Re(e,"name",{value:r,configurable:!0}),"n");const v=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&v.set("AggregateError",AggregateError);const kr=P((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)},"addKnownErrorConstructor");P(()=>new Map(v),"getKnownErrorConstructors");const J=P(e=>v.get(e),"getErrorConstructor"),E=P(e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(J(e.name)!==void 0||e.name==="Error"),"isErrorLike");var Me=Object.defineProperty,Ve=s((e,r)=>Me(e,"name",{value:r,configurable:!0}),"O$1"),Ue=Object.defineProperty,qe=Ve((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"O"),ze=Object.defineProperty,l=qe((e,r)=>ze(e,"name",{value:r,configurable:!0}),"s");const L=l(e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},"isPlainObject"),Be={maxDepth:Number.POSITIVE_INFINITY},F=l((e,r,t=0)=>E(e)?k(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new m(JSON.stringify(e)):new m(JSON.stringify(e)),"deserializePlainObject"),Ke=l((e,r,t,n,o)=>{const a=r.map(i=>h(i,n,o+1));return new e(a,t)},"reconstructAggregateError"),k=l((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new m(JSON.stringify(e));const{cause:n,errors:o,message:a,name:i,stack:c,...b}=e,N=J(i)??Error,f=i==="AggregateError"&&Array.isArray(o)?Ke(N,o,a,r,t):new N(a);return!f.name&&i&&(f.name=i),a!==void 0&&(f.message=a),c&&(f.stack=c),Ye(f,b,n,i,r,t),n!==void 0&&(f.cause=h(n,r,t+1)),He(f,e),f},"reconstructError"),h=l((e,r,t)=>{if(L(e)){if(E(e))return F(e,r,t);const n={};for(const[o,a]of Object.entries(e))n[o]=h(a,r,t+1);return n}return Array.isArray(e)?e.map(n=>h(n,r,t)):e},"deserializeValue"),Ye=l((e,r,t,n,o,a)=>{const i=e;for(const[c,b]of Object.entries(r))if(!(c==="cause"&&t!==void 0)){if(c==="errors"&&n==="AggregateError")continue;i[c]=h(b,o,a+1)}},"restoreErrorProperties"),He=l((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})}},"makePropertiesEnumerable"),I=l(e=>new m(JSON.stringify(e)),"handlePrimitive"),Xe=l(e=>new m(JSON.stringify(e)),"handleArray"),We=l((e,r)=>E(e)?k(e,r,0):F(e,r),"handlePlainObject"),Nr=l((e,r={})=>{const t={...Be,...r};return e instanceof Error?e:e===null?I(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?I(e):Array.isArray(e)?Xe(e):E(e)?k(e,t,0):L(e)?We(e,t):new m(JSON.stringify(e))},"deserialize");var Ge=Object.defineProperty,Qe=s((e,r)=>Ge(e,"name",{value:r,configurable:!0}),"a"),Ze=Object.defineProperty,R=Qe((e,r)=>Ze(e,"name",{value:r,configurable:!0}),"n");const er=K(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rr=R(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[r,t]=y.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return y.getBuiltinModule(e)}return er(e)},"__cjs_getBuiltinModule"),{inspect:tr}=rr("node:util");var nr=Object.defineProperty,or=R((e,r)=>nr(e,"name",{value:r,configurable:!0}),"s");const Ar=or(e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${tr(e)}`);break}if(t.push(n),r.add(n),typeof n!="object"||!("cause"in n))break;n=n.cause}return t},"getErrorCauses");var ar=Object.defineProperty,ir=s((e,r)=>ar(e,"name",{value:r,configurable:!0}),"o"),sr=Object.defineProperty,ur=ir((e,r)=>sr(e,"name",{value:r,configurable:!0}),"n"),cr=Object.defineProperty,M=ur((e,r)=>cr(e,"name",{value:r,configurable:!0}),"s");const lr=M(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}`},"formatStackFrameLine"),Tr=M((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(lr(n));return t.join(`
76
+ `)},"formatStacktrace");var fr=Object.defineProperty,pr=s((e,r)=>fr(e,"name",{value:r,configurable:!0}),"f"),mr=Object.defineProperty,dr=pr((e,r)=>mr(e,"name",{value:r,configurable:!0}),"b");const br=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}});var gr=Object.defineProperty,d=dr((e,r)=>gr(e,"name",{value:r,configurable:!0}),"i");const yr=d(e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},"isPlainObject"),S=new WeakSet,V=d(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)&&V(n.value))}},"makePropertiesEnumerable"),vr=d(e=>{S.add(e);const r=e.toJSON();return S.delete(e),Object.isExtensible(r)&&V(r),r},"toJSON"),w=d((e,r,t,n)=>{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,O(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(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(yr(e)){if(n.maxDepth!==void 0&&n.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=n.maxDepth)return{};t+=1;const o={};for(const a in e)o[a]=w(e[a],r,t,n);return o}try{return e}catch{return"[Not Available]"}},"serializeValue"),O=d((e,r,t,n)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!S.has(e))return vr(e);const o=Object.create(br);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,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 i=[];for(const c of e.errors){if(!(c instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(c))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;i.push(O(c,r,t,n))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:i,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:O(a,r,t,n),writable:!0});else{const i=w(a,t,n,r);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:i,writable:!0})}for(const i in e){if(i==="name"||i==="message"||i==="stack"||i==="cause"||i==="errors")continue;const c=e[i],b=w(c,t,n,r);Object.defineProperty(o,i,{configurable:!0,enumerable:!0,value:b,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const i of r.exclude)try{delete o[i]}catch{}return o},"_serialize"),Ir=d((e,r={})=>O(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0),"serialize");export{Dr as CODE_FRAME_POINTER,m as NonError,Mr as VisulimaError,kr as addKnownErrorConstructor,Or as aiPrompt,Pr as aiSolutionResponse,xr as captureRawStackTrace,Jr as codeFrame,Nr as deserializeError,Er as errorHintFinder,lr as formatStackFrameLine,Tr as formatStacktrace,Ar as getErrorCauses,jr as indexToLineColumn,E as isErrorLike,Vr as isVisulimaError,Lr as parseStacktrace,Fr as renderError,Sr as ruleBasedFinder,Ir as serializeError};
@@ -0,0 +1,6 @@
1
+ var v=Object.defineProperty;var s=(r,e)=>v(r,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";import{createTable as p}from"@visulima/tabular";import{NO_BORDER as u}from"@visulima/tabular/style";import A from"@visulima/colorize/template";import{d as R}from"./runtime-process-DKHFvYkv.js";import{bold as _}from"@visulima/colorize";const O=w(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=s(r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,t]=c.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return c.getBuiltinModule(r)}return O(r)},"__cjs_getBuiltinModule"),j=$("node:os");var E=Object.defineProperty,L=s((r,e)=>E(r,"name",{value:e,configurable:!0}),"s");const f=new Map,N=500,o=L(r=>{if(!r||r==="")return"";const e=f.get(r);if(e!==void 0)return e;const t=A(Object.assign([],{raw:[r]}));if(f.size>=N){const i=f.keys().next().value;i!==void 0&&f.delete(i)}return f.set(r,t),t},"templateFormat");var S=Object.defineProperty,W=s((r,e)=>S(r,"name",{value:e,configurable:!0}),"t$1");const g=W(()=>{const r=R().CEREBRO_TERMINAL_WIDTH;if(r===void 0)return;const e=Number.parseInt(r,10);if(!(Number.isNaN(e)||e<=0))return e},"getTerminalWidth");var T=Object.defineProperty,P=s((r,e)=>T(r,"name",{value:e,configurable:!0}),"t");class y{static{s(this,"n")}static{P(this,"BaseSection")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(j.EOL)}header(e){this.add(_(e)),this.lines.push("")}}var M=Object.defineProperty,B=s((r,e)=>M(r,"name",{value:e,configurable:!0}),"f");class C extends y{static{s(this,"l")}static{B(this,"ContentSection")}constructor(e){if(super(),e.header&&this.header(o(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(t=>typeof t=="string"))e.content.forEach(t=>{Array.isArray(t)?t.forEach(i=>{this.add(o(i))}):this.add(o(t))});else if(typeof e.content=="string")this.add(o(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const t=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return t.addRow([o(e)]),t.toString()}if(Array.isArray(e)&&e.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(i=>typeof i=="string"))){const t=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return e.forEach(i=>{Array.isArray(i)?t.addRow(i.map(n=>o(n))):t.addRow([o(i)])}),t.toString()}if(typeof e=="object"){const t=e;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
2
+ ${JSON.stringify(e)}`);const i=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(n=>{Array.isArray(n)?i.addRow(n.map(l=>o(l))):i.addRow([o(n)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
+
4
+ ${JSON.stringify(e)}`)}}var H=Object.defineProperty,I=s((r,e)=>H(r,"name",{value:e,configurable:!0}),"m");class q extends y{static{s(this,"O")}static{I(this,"OptionListSection")}constructor(e){super();let t=e.optionList??[];const i=Array.isArray(e.hide)?e.hide:[e.hide].filter(a=>typeof a=="string"),n=Array.isArray(e.group)?e.group:[e.group].filter(a=>typeof a=="string");i.length>0&&(t=t.filter(a=>!i.includes(a.name))),e.header&&this.header(o(e.header)),n.length>0&&(t=t.filter(a=>{const d=a,m=n.includes("_none")&&!d.group,h=d.group,b=this.intersect(Array.isArray(h)?h:[h],n);return m||b?a:void 0}));const l=p({showHeader:!1,style:{border:u,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:g()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});t.forEach(a=>{const d=a;l.addRow([this.getOptionNames(d,e.reverseNameOrder??!1,e.isArgument??!1),o(d.description)])}),this.add(l.toString()),this.lines.push("")}getOptionNames(e,t,i){if(!e.name)throw new TypeError("Invalid option definition, name is required.");let n=e.type?e.type.name.toLowerCase():"string";const l=e.multiple||e.lazyMultiple?"[]":"";n=o(e.typeLabel??`{underline ${n}${l}}`);let a;if(e.alias)if(e.name){const d=i?e.name:`{yellow --${e.name}}`;a=o(t?`{bold ${d}}, {bold -${e.alias}} ${n}`:`{bold -${e.alias}}, {bold ${d}} ${n}`)}else t?a=o(`{bold -${e.alias}} ${n}`):a=o(`{bold -${e.alias}} ${n}`);else a=o(`{bold ${i?e.name:`{yellow --${e.name}}`}} ${n}`);return a}intersect(e,t){return e.some(i=>t.includes(i))}}var x=Object.defineProperty,z=s((r,e)=>x(r,"name",{value:e,configurable:!0}),"o");const Q=z(r=>(Array.isArray(r)?r:[r]).length===0?"":`
5
+ ${r.map(e=>e.optionList?new q(e).toString():new C(e).toString()).join(`
6
+ `)}`,"commandLineUsage");export{o as f,Q as p};
@@ -0,0 +1,93 @@
1
+ type ColorizeMethod = (value: string) => string;
2
+ type CodeFrameOptions = {
3
+ color?: {
4
+ gutter?: ColorizeMethod;
5
+ marker?: ColorizeMethod;
6
+ message?: ColorizeMethod;
7
+ };
8
+ linesAbove?: number;
9
+ linesBelow?: number;
10
+ message?: string;
11
+ prefix?: string;
12
+ showGutter?: boolean;
13
+ showLineNumbers?: boolean;
14
+ tabWidth?: number | false;
15
+ };
16
+ interface ErrorProperties {
17
+ cause?: unknown;
18
+ hint?: ErrorHint;
19
+ location?: ErrorLocation;
20
+ message?: string;
21
+ name: string;
22
+ stack?: string;
23
+ title?: string;
24
+ }
25
+ interface ErrorLocation {
26
+ column?: number;
27
+ file?: string;
28
+ line?: number;
29
+ }
30
+ /**
31
+ * A message that explains to the user how they can fix the error.
32
+ * @example
33
+ * ```ts
34
+ * const error = new VisulimaError({
35
+ * hint: "Try running `npm install` to install missing dependencies.",
36
+ * location: {
37
+ * file: "src/index.ts",
38
+ * line: 1,
39
+ * column: 1,
40
+ * },
41
+ * message: "Cannot find module 'react'",
42
+ * name: "ModuleNotFoundError",
43
+ * });
44
+ * ```
45
+ *
46
+ * For more complex hints, you can pass an array of strings or a single string in markdown format.
47
+ */
48
+ type ErrorHint = string[] | string;
49
+ declare class VisulimaError extends Error {
50
+ loc: ErrorLocation | undefined;
51
+ title: string | undefined;
52
+ /**
53
+ * A message that explains to the user how they can fix the error.
54
+ */
55
+ hint: ErrorHint | undefined;
56
+ type: string;
57
+ constructor({
58
+ cause,
59
+ hint,
60
+ location,
61
+ message,
62
+ name,
63
+ stack,
64
+ title
65
+ }: ErrorProperties);
66
+ setLocation(location: ErrorLocation): void;
67
+ setName(name: string): void;
68
+ setMessage(message: string): void;
69
+ setHint(hint: ErrorHint): void;
70
+ }
71
+ /**
72
+ * Will return an array of all causes in the error in the order they occurred.
73
+ */
74
+ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
75
+ color: CodeFrameOptions["color"] & {
76
+ fileLine: ColorizeMethod;
77
+ hint: ColorizeMethod;
78
+ method: ColorizeMethod;
79
+ title: ColorizeMethod;
80
+ };
81
+ cwd: string;
82
+ displayShortPath: boolean;
83
+ filterStacktrace: ((line: string) => boolean) | undefined;
84
+ framesMaxLimit: number;
85
+ hideErrorCauseCodeView: boolean;
86
+ hideErrorCodeView: boolean;
87
+ hideErrorErrorsCodeView: boolean;
88
+ hideErrorTitle: boolean;
89
+ hideMessage: boolean;
90
+ indentation: number | " ";
91
+ prefix: string;
92
+ };
93
+ export { Options$1 as O, VisulimaError as V };
@@ -0,0 +1 @@
1
+ var r=Object.defineProperty;var t=(a,e)=>r(a,"name",{value:e,configurable:!0});var n=Object.defineProperty,l=t((a,e)=>n(a,"name",{value:e,configurable:!0}),"t");const d=l((a,e)=>async()=>({default:(await a())[e]}),"lazyNamed");export{d as lazyNamed};