@visulima/cerebro 3.0.0-alpha.3 → 3.0.0-alpha.30

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 (90) hide show
  1. package/CHANGELOG.md +458 -0
  2. package/LICENSE.md +605 -4095
  3. package/README.md +152 -2
  4. package/dist/commands/completion-command.d.ts +6 -5
  5. package/dist/commands/completion-command.js +3 -3
  6. package/dist/commands/help-command.d.ts +10 -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 +501 -95
  12. package/dist/index.js +1 -1
  13. package/dist/logger/create-pail-logger.d.ts +745 -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-BN_nIZ8z.js +4 -0
  17. package/dist/packem_shared/VisulimaError-WfDZ45Qv.js +76 -0
  18. package/dist/packem_shared/constants-DmzZF6_u-BmMwILI_.js +1 -0
  19. package/dist/packem_shared/index-CkkDAMKi.js +6 -0
  20. package/dist/packem_shared/index.d-Br8HpP0A.d.ts +93 -0
  21. package/dist/packem_shared/lazyNamed-DOmefeJM.js +1 -0
  22. package/dist/packem_shared/plugin-manager.d-BSQtHbWS.d.ts +620 -0
  23. package/dist/packem_shared/renderError-DxgI44AK-DFDWFoCr.js +24 -0
  24. package/dist/packem_shared/{runtime-process-G-n-wOub.js → runtime-process-DKHFvYkv.js} +1 -1
  25. package/dist/plugins/error-handler-plugin.d.ts +21 -19
  26. package/dist/plugins/error-handler-plugin.js +1 -1
  27. package/dist/plugins/runtime-version-check-plugin.d.ts +22 -20
  28. package/dist/plugins/runtime-version-check-plugin.js +1 -1
  29. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +21 -8
  30. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
  31. package/dist/util/general/compile-cache.d.ts +41 -0
  32. package/dist/util/general/compile-cache.js +1 -0
  33. package/dist/util/general/heap-tuning.d.ts +18 -0
  34. package/dist/util/general/heap-tuning.js +1 -0
  35. package/package.json +32 -26
  36. package/dist/cli.d.ts +0 -203
  37. package/dist/constants.d.ts +0 -29
  38. package/dist/default-env.d.ts +0 -7
  39. package/dist/default-options.d.ts +0 -3
  40. package/dist/empty-toolbox.d.ts +0 -15
  41. package/dist/errors/cerebro-error.d.ts +0 -10
  42. package/dist/errors/command-not-found-error.d.ts +0 -9
  43. package/dist/errors/command-validation-error.d.ts +0 -10
  44. package/dist/errors/completion-error.d.ts +0 -9
  45. package/dist/errors/conflicting-options-error.d.ts +0 -10
  46. package/dist/errors/plugin-error.d.ts +0 -9
  47. package/dist/errors/update-notifier-error.d.ts +0 -7
  48. package/dist/packem_shared/Cerebro-aPZjbfzf.js +0 -4
  49. package/dist/packem_shared/VisulimaError-BJideSBf.js +0 -76
  50. package/dist/packem_shared/help-command-CIRIXN03.js +0 -1
  51. package/dist/packem_shared/index-DQ3pvLQH.js +0 -6
  52. package/dist/packem_shared/renderError-ZMlMvw1N-eVUSdl6c.js +0 -24
  53. package/dist/plugin-manager.d.ts +0 -53
  54. package/dist/plugins/update-notifier/cache.d.ts +0 -11
  55. package/dist/plugins/update-notifier/get-distribution-version.d.ts +0 -2
  56. package/dist/plugins/update-notifier/has-new-version.d.ts +0 -14
  57. package/dist/types/cli.d.ts +0 -102
  58. package/dist/types/command-line-usage.d.ts +0 -37
  59. package/dist/types/command.d.ts +0 -136
  60. package/dist/types/option-types.d.ts +0 -83
  61. package/dist/types/options.d.ts +0 -4
  62. package/dist/types/plugin.d.ts +0 -53
  63. package/dist/types/toolbox.d.ts +0 -96
  64. package/dist/util/arg-processing/get-boolean-values.d.ts +0 -7
  65. package/dist/util/arg-processing/get-parameter-option.d.ts +0 -7
  66. package/dist/util/arg-processing/map-option-type-label.d.ts +0 -3
  67. package/dist/util/arg-processing/option-is-boolean.d.ts +0 -9
  68. package/dist/util/arg-processing/remove-boolean-values.d.ts +0 -9
  69. package/dist/util/command-line-commands.d.ts +0 -10
  70. package/dist/util/command-line-usage/get-terminal-width.d.ts +0 -7
  71. package/dist/util/command-line-usage/index.d.ts +0 -3
  72. package/dist/util/command-line-usage/section/base-section.d.ts +0 -8
  73. package/dist/util/command-line-usage/section/content-section.d.ts +0 -65
  74. package/dist/util/command-line-usage/section/option-list-section.d.ts +0 -44
  75. package/dist/util/command-processing/command-processor.d.ts +0 -37
  76. package/dist/util/command-processing/command-validation.d.ts +0 -17
  77. package/dist/util/command-processing/nested-command-parser.d.ts +0 -25
  78. package/dist/util/command-processing/option-processor.d.ts +0 -44
  79. package/dist/util/data-processing/list-missing-arguments.d.ts +0 -15
  80. package/dist/util/data-processing/merge-arguments.d.ts +0 -7
  81. package/dist/util/general/find-alternatives.d.ts +0 -8
  82. package/dist/util/general/hide-bin.d.ts +0 -2
  83. package/dist/util/general/parse-raw-command.d.ts +0 -7
  84. package/dist/util/general/register-exception-handler.d.ts +0 -9
  85. package/dist/util/general/runtime-process.d.ts +0 -65
  86. package/dist/util/general/semver-gt.d.ts +0 -2
  87. package/dist/util/general/validate-input.d.ts +0 -24
  88. package/dist/util/process-env-variables.d.ts +0 -9
  89. package/dist/util/security.d.ts +0 -58
  90. 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 tn=Object.defineProperty;var R=(r,a)=>tn(r,"name",{value:a,configurable:!0});import{createRequire as nn}from"node:module";import{findCacheDirSync as un}from"@visulima/find-cache-dir";import{c as cn}from"../packem_shared/cerebro-error-BnJTixb2.js";const rn=nn(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=R(r=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[a,i]=L.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return L.getBuiltinModule(r)}return rn(r)},"__cjs_getBuiltinModule"),{existsSync:je,readFileSync:on,mkdirSync:sn,writeFileSync:an}=_e("node:fs"),{get:ln}=_e("node:https");var fn=Object.defineProperty,Oe=R((r,a)=>fn(r,"name",{value:a,configurable:!0}),"d$1");const be=Oe(r=>{const[a,i]=r.split("-");return{nums:a.split(".").map(l=>Number.parseInt(l,10)||0),pre:i}},"parse"),pn=Oe((r,a)=>{const i=be(r),l=be(a),h=Math.max(i.nums.length,l.nums.length);for(let v=0;v<h;v++){const y=i.nums[v]??0,w=l.nums[v]??0;if(y>w)return!0;if(y<w)return!1}if(i.pre===void 0&&l.pre!==void 0)return!0;if(i.pre!==void 0&&l.pre===void 0||i.pre===void 0&&l.pre===void 0)return!1;const m=i.pre.split("."),x=l.pre.split("."),d=Math.max(m.length,x.length);for(let v=0;v<d;v++){const y=m[v],w=x[v];if(y===void 0)return!1;if(w===void 0)return!0;if(y===w)continue;const A=Number.parseInt(y,10),T=Number.parseInt(w,10),Z=!Number.isNaN(A)&&String(A)===y,C=!Number.isNaN(T)&&String(T)===w;return Z&&C?A>T:Z?!1:C?!0:y>w}return!1},"semverGt");var dn=Object.defineProperty,gn=R((r,a)=>dn(r,"name",{value:a,configurable:!0}),"$e"),hn=Object.defineProperty,ee=gn((r,a)=>hn(r,"name",{value:a,configurable:!0}),"W"),mn=Object.defineProperty,c=ee((r,a)=>mn(r,"name",{value:a,configurable:!0}),"u$1");let ye=c(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),x=c((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!h.call(e,o)&&o!==n&&a(e,o,{get:c(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),d=c(e=>x(a({},"__esModule",{value:!0}),e),"oe"),v={};m(v,{zeptomatch:c(()=>$e,"zeptomatch")});var y=c(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:u}=o;if(u?.length)for(let f=0,g=u.length;f<g;f++)n.push(u[f])}return Array.from(t)},"M"),w=c(e=>{let t="";const n=y(e);for(let s=0,o=n.length;s<o;s++){const u=n[s];if(!u.regex)continue;const f=u.regex.flags;if(t||(t=f),t!==f)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${f}"`)}return t},"se"),A=c((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let u="";if(e.regex&&(u+=o?"(?:$|":"",u+=e.regex.source),e.children?.length){const f=Z(e.children.map(g=>A(g,t,n)).filter(Boolean));if(f?.length){const g=e.children.some(F=>!F.regex||!(F.partial??t)),b=f.length>1||o&&(!u.length||g);u+=b?o?"(?:$|":"(?:":"",u+=f.join("|"),u+=b?")":""}}return e.regex&&(u+=o?")":""),n.set(e,u),u},"O"),T=c((e,t)=>{const n=new Map,s=y(e);for(let o=s.length-1;o>=0;o--){const u=A(s[o],t,n);if(!(o>0))return u}return""},"ie"),Z=c(e=>Array.from(new Set(e)),"ue"),C=c((e,t,n)=>C.compile(e,n).test(t),"R");C.compile=(e,t)=>{const n=t?.partial??!1,s=T(e,n),o=w(e);return new RegExp(`^(?:${s})$`,o)};var Se=C,Ae=c((e,t)=>{const n=Se.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ce=Ae,Ie=c(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Pe=Ie,ne=c(e=>Array.isArray(e),"j"),U=c(e=>typeof e=="function","_"),ze=c(e=>e.length===0,"he"),Te=(()=>{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))})(),Ue=c(e=>typeof e=="number","de"),Be=c(e=>typeof e=="object"&&e!==null,"xe"),Fe=c(e=>e instanceof RegExp,"me"),De=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Le=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),re=c(e=>typeof e=="string","A"),E=c(e=>e===void 0,"f"),qe=c(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"),oe=c((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=N(t)(s),u=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${u}`)},"I"),p=c((e,t)=>ne(e)?We(e,t):re(e)?se(e,t):Ze(e,t),"i"),We=c((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 u=s.index,f=u;for(;f<o.length&&o.charCodeAt(f)in n;)f+=1;if(f>u){if(!E(t)&&!s.options.silent){const g=o.slice(u,f),b=U(t)?t(g,o,`${u}`):t;E(b)||s.output.push(b)}s.index=f}return!0}},"we"),Ze=c((e,t)=>{if(Le(e))return se(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return De(e)&&U(t)&&!Te(t)?Ve(o,t):He(o,t)}},"$e"),Ve=c((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const u=e.exec(o);if(u){const f=e.lastIndex;if(!n.options.silent){const g=t(...u,o,`${s}`);E(g)||n.output.push(g)}return n.index=f,!0}else return!1},"Ee"),He=c((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const u=e.lastIndex;if(!E(t)&&!n.options.silent){const f=U(t)?t(o.slice(s,u),o,`${s}`):t;E(f)||n.output.push(f)}return n.index=u,!0}else return!1},"Ce"),se=c((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!E(t)&&!n.options.silent){const u=U(t)?t(e,o,`${s}`):t;E(u)||n.output.push(u)}return n.index+=e.length,!0}else return!1},"F"),H=c((e,t,n,s)=>{const o=N(e),u=t>1;return J(G(ie(f=>{let g=0;for(;g<n;){const b=f.index;if(!o(f)||(g+=1,f.index===b))break}return g>=t},u),s))},"k"),ae=c((e,t)=>H(e,0,1,t),"L"),V=c((e,t)=>H(e,0,1/0,t),"$"),Ge=c((e,t)=>H(e,1,1/0,t),"Re"),I=c((e,t)=>{const n=e.map(N);return J(G(ie(s=>{for(let o=0,u=n.length;o<u;o++)if(!n[o](s))return!1;return!0}),t))},"x"),j=c((e,t)=>{const n=e.map(N);return J(G(s=>{for(let o=0,u=n.length;o<u;o++)if(n[o](s))return!0;return!1},t))},"p"),ie=c((e,t=!0,n=!1)=>{const s=N(e);return t?o=>{const u=o.index,f=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=u,o.output.length!==f&&(o.output.length=f)),g}:s},"q"),G=c((e,t)=>{const n=N(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const u=s.output.splice(o,1/0),f=t(u);return E(f)||s.output.push(f),!0}else return!1}:n},"B"),J=(()=>{let e=0;return t=>{const n=N(t),s=e+=1;return o=>{var u;if(o.options.memoization===!1)return n(o);const f=o.index,g=(u=o.cache)[s]||(u[s]={indexMax:-1,queue:[]}),b=g.queue;if(f<=g.indexMax){const D=g.store||(g.store=new Map);if(b.length){for(let z=0,Qt=b.length;z<Qt;z+=2){const Xt=b[z*2],en=b[z*2+1];D.set(Xt,en)}b.length=0}const O=D.get(f);if(O===!1)return!1;if(Ue(O))return o.index=O,!0;if(O)return o.index=O.index,O.output?.length&&o.output.push(...O.output),!0}const F=o.output.length,Kt=n(o);if(g.indexMax=Math.max(g.indexMax,f),Kt){const D=o.index,O=o.output.length;if(O>F){const z=o.output.slice(F,O);b.push(f,{index:D,output:z})}else b.push(f,D);return!0}else return b.push(f,!1),!1}}})(),ue=c(e=>{let t;return n=>(t||(t=N(e())),t(n))},"G"),N=qe(e=>{if(U(e))return ze(e)?ue(e):e;if(re(e)||Fe(e))return p(e);if(ne(e))return I(e);if(Be(e))return j(Object.values(e));throw new Error("Invalid rule")}),M=c(e=>e,"d"),Je=c(e=>typeof e=="string","ke"),Ye=c(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const u=o?.partial?n:t,f=u.get(s);if(f!==void 0)return f;const g=e(s,o);return u.set(s,g),g}},"Be"),Ke=c(e=>{const t={},n={};return(s,o)=>{const u=o?.partial?n:t;return u[s]??(u[s]=e(s,o))}},"Pe"),Qe=p(/\\./,M),Xe=p(/./,M),et=p(/\*\*\*+/,"*"),tt=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),nt=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),rt=V(j([Qe,et,tt,nt,Xe])),ot=rt,st=c(e=>oe(e,ot,{memoization:!1}).join(""),"Ie"),at=st,ce="abcdefghijklmnopqrstuvwxyz",it=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ce[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),le=c(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ce.indexOf(e[n])+1;return t},"V"),Y=c((e,t)=>{if(t<e)return Y(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),ut=c((e,t,n)=>Y(e,t).map(s=>String(s).padStart(n,"0")),"qe"),fe=c((e,t)=>Y(le(e),le(t)).map(it),"W"),$=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),B=c(e=>({children:e}),"y"),P=(()=>{const e=c((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let u=0,f=o.length;u<f;u++)e(o[u],n,s)},"e");return t=>{if(!t.length)return B([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],u=t[n];e(o,u,s)}return t[0]}})(),k=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),ct=p(/\\./,$),lt=p(/[$.*+?^(){}[\]\|]/,e=>$(`\\${e}`)),ft=p(/[\\\/]/,k),pt=p(/[^$.*+?^(){}[\]\|\\\/]+/,$),dt=p(/^(?:!!)*!(.*)$/,(e,t)=>$(`(?!^${$e.compile(t).source}$).*?`)),gt=p(/^(!!)+/),ht=j([dt,gt]),mt=p(/\/(\*\*\/)+/,()=>B([P([k(),$(".+?"),k()]),k()])),xt=p(/^(\*\*\/)+/,()=>B([$("^"),P([$(".*?"),k()])])),vt=p(/\/(\*\*)$/,()=>B([P([k(),$(".*?")]),$("$")])),$t=p(/\*\*/,()=>$(".*?")),pe=j([mt,xt,vt,$t]),bt=p(/\*\/(?!\*\*\/|\*$)/,()=>P([$("[^\\\\/]*?"),k()])),yt=p(/\*/,()=>$("[^\\\\/]*")),de=j([bt,yt]),ge=p("?",()=>$("[^\\\\/]")),wt=p("[",M),_t=p("]",M),jt=p(/[!^]/,"^\\\\/"),Ot=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,M),Rt=p(/\\./,M),Et=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Nt=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,M),Mt=j([Rt,Et,Nt,Ot,kt]),he=I([wt,ae(jt),V(Mt),_t],e=>$(e.join(""))),St=p("{","(?:"),At=p("}",")"),Ct=p(/(\d+)\.\.(\d+)/,(e,t,n)=>ut(+t,+n,Math.min(t.length,n.length)).join("|")),It=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>fe(t,n).join("|")),Pt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>fe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),zt=j([Ct,It,Pt]),me=I([St,zt,At],e=>$(e.join(""))),Tt=p("{"),Ut=p("}"),Bt=p(","),Ft=p(/\\./,$),Dt=p(/[$.*+?^(){[\]\|]/,e=>$(`\\${e}`)),Lt=p(/[\\\/]/,k),qt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,$),Wt=ue(()=>ve),Zt=p("",()=>$("(?:)")),Vt=Ge(j([pe,de,ge,he,me,Wt,Ft,Dt,Lt,qt]),P),xe=j([Vt,Zt]),ve=I([Tt,ae(I([xe,V(I([Bt,xe]))])),Ut],B),Ht=V(j([ht,pe,de,ge,he,me,ve,ct,lt,ft,pt]),P),Gt=Ht,Jt=c(e=>oe(e,Gt,{memoization:!1})[0],"kr"),Yt=Jt,K=c((e,t,n)=>K.compile(e,n).test(t),"N");K.compile=(()=>{const e=Ke((n,s)=>Ce(Yt(at(n)),s)),t=Ye((n,s)=>Pe(n.map(o=>e(o,s))));return(n,s)=>Je(n)?e(n,s):t(n,s)})();var $e=K;return d(v)})();return r.default||r},"_lazyMatch"),Q;const xn=c((r,a)=>(Q||(Q=ye(),ye=null),Q(r,a)),"default");var vn=Object.defineProperty,$n=ee((r,a)=>vn(r,"name",{value:a,configurable:!0}),"t$1");const bn=/^[A-Z]:\//i,S=$n((r="")=>r&&r.replaceAll("\\","/").replace(bn,a=>a.toUpperCase()),"normalizeWindowsPath");var yn=Object.defineProperty,_=ee((r,a)=>yn(r,"name",{value:a,configurable:!0}),"r");const wn=/^[/\\]{2}/,_n=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Re=/^[A-Z]:$/i,we=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,On=/^[/\\]|^[a-z]:[/\\]/i,Rn=/\/$/,En=_(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Ee=_((r,a)=>{let i="",l=0,h=-1,m=0,x;for(let d=0;d<=r.length;++d){if(d<r.length)x=r[d];else{if(x==="/")break;x="/"}if(x==="/"){if(!(h===d-1||m===1))if(m===2){if(i.length<2||l!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const v=i.lastIndexOf("/");v===-1?(i="",l=0):(i=i.slice(0,v),l=i.length-1-i.lastIndexOf("/")),h=d,m=0;continue}else if(i.length>0){i="",l=0,h=d,m=0;continue}}a&&(i+=i.length>0?"/..":"..",l=2)}else i.length>0?i+=`/${r.slice(h+1,d)}`:i=r.slice(h+1,d),l=d-h-1;h=d,m=0}else x==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),W=_(r=>_n.test(r),"isAbsolute"),Ne=_(function(r){if(r.length===0)return".";r=S(r);const a=wn.exec(r),i=W(r),l=r.at(-1)==="/";return r=Ee(r,!i),r.length===0?i?"/":l?"./":".":(l&&(r+="/"),Re.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!W(r)?`/${r}`:r)},"normalize"),Nn=_((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const l=a.at(-1)==="/",h=i[0]==="/";l&&h?a+=i.slice(1):a+=l||h?i:`/${i}`}else a+=i;return Ne(a)},"join"),X=_(function(...r){r=r.map(l=>S(l));let a="",i=!1;for(let l=r.length-1;l>=-1&&!i;l--){const h=l>=0?r[l]:En();!h||h.length===0||(a=`${h}/${a}`,i=W(h))}return a=Ee(a,!i),i&&!W(a)?`/${a}`:a.length>0?a:"."},"resolve");_(function(r){return S(r)},"toNamespacedPath");const kn=_(function(r){return jn.exec(S(r))?.[1]??""},"extname");_(function(r,a){const i=X(r).replace(we,"$1").split("/"),l=X(a).replace(we,"$1").split("/");if(l[0][1]===":"&&i[0][1]===":"&&i[0]!==l[0])return l.join("/");const h=[...i];for(const m of h){if(l[0]!==m)break;i.shift(),l.shift()}return[...i.map(()=>".."),...l].join("/")},"relative");const ke=_(r=>{const a=S(r).replace(Rn,"").split("/").slice(0,-1);return a.length===1&&Re.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(W(r)?"/":".")},"dirname");_(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return S(r.root?X(...a):a.join("/"))},"format");const Mn=_((r,a)=>{const i=S(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");_(function(r){const a=On.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Mn(r),l=kn(i);return{base:i,dir:ke(r),ext:l,name:i.slice(0,i.length-l.length),root:a}},"parse");_((r,a)=>xn(a,Ne(r)),"matchesGlob");var Sn=Object.defineProperty,An=R((r,a)=>Sn(r,"name",{value:a,configurable:!0}),"e");let q=class extends cn{static{R(this,"p")}static{An(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",l){super(a,i,l),this.name="UpdateNotifierError"}};var Cn=Object.defineProperty,te=R((r,a)=>Cn(r,"name",{value:a,configurable:!0}),"n");const In="last-update-check.json",Me=te(r=>{const a=un(r);if(a===void 0)throw new q("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return Nn(a,In)},"getConfigFile"),Pn=te(r=>{const a=Me(r);try{if(!je(a))return;const{lastUpdateCheck:i}=JSON.parse(on(a,"utf8"));return i}catch{return}},"getLastUpdate"),zn=te(r=>{const a=Me(r),i=ke(a);je(i)||sn(i,{recursive:!0}),an(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var Tn=Object.defineProperty,Un=R((r,a)=>Tn(r,"name",{value:a,configurable:!0}),"d");const Bn=Un(async(r,a,i)=>{const l=i.replace("__NAME__",r),h=512*1024;return await new Promise((m,x)=>{ln(l,d=>{if(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)){x(new q(`Unexpected status code ${String(d.statusCode)}`,"VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d.resume();return}let v="",y=!1;d.on("data",w=>{y||(v+=String(w),v.length>h&&(y=!0,x(new q("Response too large","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d.destroy()))}),d.on("end",()=>{if(!y)try{const w=JSON.parse(v)[a];if(!w){x(new q("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r}));return}m(w)}catch{x(new q("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",d=>{x(d)})})},"getDistributionVersion");var Fn=Object.defineProperty,Dn=R((r,a)=>Fn(r,"name",{value:a,configurable:!0}),"i");const Hn=Dn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:l,registryUrl:h="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:m=1e3*60*60*24})=>{const x=Pn(l.name);if(r||!x||x<Date.now()-m){const d=await Bn(l.name,i,h);if(zn(l.name),pn(d,l.version))return d;a&&console.error(`Latest version (${d}) not newer than current version (${l.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${String(m)}ms but only ${String(Date.now()-x)}ms since last check.`)},"hasNewVersion");export{Hn as default};
@@ -0,0 +1,4 @@
1
+ var St=Object.defineProperty;var $=(t,e)=>St(t,"name",{value:e,configurable:!0});import{createRequire as Dt}from"node:module";import{VERBOSITY_DEBUG as H,POSITIONALS_KEY as se,VERBOSITY_QUIET as Gt,VERBOSITY_VERBOSE as Kt,VERBOSITY_NORMAL as je}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as P}from"./cerebro-error-BnJTixb2.js";import{d as z,h as ke,e as Y,o as Ue,b as Ht,c as Yt,a as Jt,i as Qt,f as Xt}from"./runtime-process-DKHFvYkv.js";import{p as ue}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";import{distance as Zt}from"fastest-levenshtein";import{s as en,L as tn,M as ne,E as W,P as G,N as I,C as ye,D as Te,W as nn,U as Me,Q as on,_ as Se,J as De,T as Ve,z as an,K as rn,q as sn,I as ln,V as cn,u as un,r as pn,Y as fn,p as dn,n as hn,Z as mn,i as gn,a as vn,A as wn,X as yn,e as bn,t as Be}from"./constants-DmzZF6_u-BmMwILI_.js";const Vt=Dt(import.meta.url),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,it=$(t=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[e,n]=ee.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ee.getBuiltinModule(t)}return Vt(t)},"__cjs_getBuiltinModule"),{writeFile:Bt,stat:Rt,rm:zt,readFile:Ie,readdir:Wt,mkdir:Ft,access:qt}=it("node:fs/promises"),{createRequire:$n}=it("node:module"),ae=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var On=Object.defineProperty,An=$((t,e)=>On(t,"name",{value:e,configurable:!0}),"t$9");let V=class extends P{static{$(this,"a")}static{An(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 Pn=Object.defineProperty,Cn=$((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"e$7");let at=class extends P{static{$(this,"o")}static{Cn(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 Nn=Object.defineProperty,_n=$((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"e$6");let kn=class extends P{static{$(this,"o")}static{_n(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 En=Object.defineProperty,Re=$((t,e)=>En(t,"name",{value:e,configurable:!0}),"d$6");let xn=class{static{$(this,"p")}static{Re(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`);z().CEREBRO_OUTPUT_LEVEL===String(H)&&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 o=new kn(i.name,`Failed to initialize: ${r instanceof Error?r.message:String(r)}`,r instanceof Error?r:void 0);throw this.logger.error(o.message),o}}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 o of r){const c=o[e];if(typeof c=="function"){this.logger.debug(`executing ${e} hook for plugin: ${o.name}`);try{await(e==="afterCommand"?c(n,i):c(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${o.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(o){this.logger.error(`Error in error handler for plugin "${r.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,r=Re(o=>{if(n.has(o))return;if(i.has(o))throw new Error(`Circular dependency detected involving plugin "${o}"`);const c=this.plugins.get(o);if(!c)throw new Error(`Plugin "${o}" not found`);if(i.add(o),c.dependencies)for(const s of c.dependencies)r(s);i.delete(o),n.add(o),e.push(c)},"visit");for(const o of this.plugins.keys())r(o);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 Ln=Object.defineProperty,In=$((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"n$b");const oe=In(t=>t.type?.name==="Boolean","optionIsBoolean");var jn=Object.defineProperty,rt=$((t,e)=>jn(t,"name",{value:e,configurable:!0}),"p$6");const Un=rt(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"),ze=rt(t=>(oe(t)||(t.typeLabel=t.typeLabel??Un(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var Tn=Object.defineProperty,st=$((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"e$4");const Mn=new RegExp(/^-([^\d-])$/),Sn=new RegExp(/^--(\S+)/),Dn=new RegExp(/^-([^\d-]{2,})$/),Vn=st(t=>Mn.test(t)||Sn.test(t)||Dn.test(t),"isOption"),Bn=st((t,e)=>{const n=e[0]&&Vn(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 Rn=Object.defineProperty,lt=$((t,e)=>Rn(t,"name",{value:e,configurable:!0}),"o$b"),zn=Object.defineProperty,ct=lt((t,e)=>zn(t,"name",{value:e,configurable:!0}),"o"),Wn=Object.defineProperty,Fn=ct((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"i");let qn=class ut extends ue{static{$(this,"a")}static{lt(this,"r")}static{ct(this,"t")}static{Fn(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,ut.prototype)}};var Gn=Object.defineProperty,pt=$((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"t$7"),Kn=Object.defineProperty,ft=pt((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"e"),Hn=Object.defineProperty,Yn=ft((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"e");let We=class dt extends ue{static{$(this,"n")}static{pt(this,"n")}static{ft(this,"o")}static{Yn(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,dt.prototype)}};var Jn=Object.defineProperty,ht=$((t,e)=>Jn(t,"name",{value:e,configurable:!0}),"a$9"),Qn=Object.defineProperty,mt=ht((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"a"),Xn=Object.defineProperty,Zn=mt((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"o");let eo=class gt extends ue{static{$(this,"o")}static{ht(this,"r")}static{mt(this,"e")}static{Zn(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,gt.prototype)}};var to=Object.defineProperty,vt=$((t,e)=>to(t,"name",{value:e,configurable:!0}),"i$8"),no=Object.defineProperty,wt=vt((t,e)=>no(t,"name",{value:e,configurable:!0}),"i"),oo=Object.defineProperty,io=wt((t,e)=>oo(t,"name",{value:e,configurable:!0}),"i");let j=class yt extends ue{static{$(this,"a")}static{vt(this,"o")}static{wt(this,"e")}static{io(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,yt.prototype)}};var ao=Object.defineProperty,ro=$((t,e)=>ao(t,"name",{value:e,configurable:!0}),"E$3"),so=Object.defineProperty,Q=ro((t,e)=>so(t,"name",{value:e,configurable:!0}),"C"),lo=Object.defineProperty,pe=Q((t,e)=>lo(t,"name",{value:e,configurable:!0}),"o");const Fe=pe(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),qe=pe(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Ge=pe(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),co=pe((t,e)=>Array.isArray(t)?Fe(e)?t.map(Boolean):qe(e)?t.map(Number):Ge(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Fe(e)?!!t:qe(e)?Number(t):Ge(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var uo=Object.defineProperty,po=Q((t,e)=>uo(t,"name",{value:e,configurable:!0}),"e");const x=po((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var fo=Object.defineProperty,q=Q((t,e)=>fo(t,"name",{value:e,configurable:!0}),"x$2");const ho=/-([a-z])/g,mo=/^\d+$/,be=q(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),go=q(t=>t.codePointAt(0)===95,"isSpecialKey"),Ke=q((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),He=q(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ye=q((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"),vo=q((t,e,n,i,r)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??r?.get(c)}return o},"getDefinition"),wo=q((t,e,n,i)=>{const r=n.debug??!1;x(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(r,"Starting argument resolution","resolver"),x(r,"Tokens:","resolver",t),x(r,"Definitions:","resolver",e),x(r,"Processing tokens...","resolver");const o=new Map,c=new Map,s=n.caseInsensitive?new Map:void 0,g=n.caseInsensitive?new Map:void 0,a=n.camelCase?new Map:void 0,u=n.camelCase?new Map:void 0;for(const p of e)if(o.set(p.name,p),p.alias&&c.set(p.alias,p),n.caseInsensitive&&s&&(s.set(p.name.toLowerCase(),p),p.alias&&g&&g.set(p.alias.toLowerCase(),p)),n.camelCase&&a&&u){const m=p.name.replaceAll(ho,(v,O)=>O.toUpperCase());a.set(p.name,m),u.set(m,p.name)}const d={},l={},h=[],f=[],y=new Set;let b=!1;const w=e.find(p=>p.defaultOption),C=e.some(p=>p.group),N=e.some(p=>p.type===Number);for(let p=0;p<t.length;p++){const m=t[p];if(m.kind==="option-terminator"){d._unknown=i.slice(m.index),b=!0;break}if(m.kind==="option"&&m.name){let v=vo(m.name,o,c,s,g);if(!v&&m.value===void 0&&N&&mo.test(m.name)){const _=e.find(M=>M.type===Number);_&&(v=_,m.value=m.name,m.name=_.name)}const O=v?v.name:m.name,A=v?.multiple,U=v?.lazyMultiple;if(l[O]!==void 0&&!A&&!U&&!n.partial)throw new qn(O);if(!v&&n.partial){const _=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;h.push({index:m.index,value:_});continue}if(!v&&n.stopAtFirstUnknown){d._unknown=i.slice(m.index);break}if(!v&&!n.partial)throw new We(m.name);if(m.value===void 0){const _=t[p+1],M=_?.kind==="option"&&!("name"in _)&&_.value!==void 0,L=_&&v&&!(v.type&&be(v.type))&&(_.kind==="positional"||M),Mt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(L&&(!v?.defaultOption||Mt))if(A){let S=p+1;const we=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)we.push(t[S].value),y.add(t[S].index),S++;l[O]=l[O]===void 0?we:Ke(l[O],we),p=S-1}else U?(Ye(l,O,_.value,!0),y.add(_.index),p++):(l[O]=_.value,y.add(_.index),p++);else v?.type&&be(v.type)?Ye(l,O,!0,A):l[O]=A?[]:null}else{let{value:_}=m;if(v?.type&&be(v.type))switch(_){case"":{if(n.partial){l._unknown??=[];const L=`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`;l._unknown.push(L),f.push({index:m.index,value:L}),_=!0}else throw new We(m.name);break}case"false":{_=!1;break}case"true":{_=!0;break}default:_=!0}const M=[_];if(A){let L=p+1;for(;L<t.length&&t[L].kind==="positional";)M.push(t[L].value),y.add(t[L].index),L++;p=L-1}l[O]===void 0?l[O]=A||U?M:_:A||U?l[O]=Ke(l[O],M):l[O]=_}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!y.has(m.index)&&!w){x(r,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),d._unknown=i.slice(m.index);break}}for(const[p,m]of Object.entries(l)){const v=o.get(p);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(m)&&(l[p]=[m])}let E=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const p of t)if(p.kind==="option"&&!o.has(p.name??"")&&!c.has(p.name??"")&&(!n.caseInsensitive||!s?.has(p.name?.toLowerCase()??"")&&!g?.has(p.name?.toLowerCase()??""))){E=p.index;break}}if(w){const p=[],m=[];for(const v of t)v.kind==="positional"&&!y.has(v.index)&&v.index<E&&(p.push(v.value),m.push(v));if(p.length>0){const v=l[w.name],O=w.multiple??w.lazyMultiple;v===void 0?O?(m.forEach(A=>y.add(A.index)),l[w.name]=p):(y.add(m[0].index),l[w.name]=p[0]):O&&(m.forEach(A=>y.add(A.index)),l[w.name]=Array.isArray(v)?[...p,...v]:[...p,v])}}if(!n.partial){for(const p of t)if(p.kind==="positional"&&!y.has(p.index))throw new eo(i[p.index])}if(n.partial&&!n.stopAtFirstUnknown){const p=[...h];if(l._unknown)for(const m of f)p.push({index:m.index,value:m.value});for(const m of t)m.kind==="positional"&&!y.has(m.index)&&p.push({index:m.index,value:i[m.index]});p.length>0&&(p.sort((m,v)=>m.index-v.index),d._unknown=p.map(m=>m.value))}if(n.stopAtFirstUnknown&&!b){const p=t.findIndex(O=>O.kind==="option"&&!o.has(O.name??"")&&!c.has(O.name??"")&&(!n.caseInsensitive||!s?.has(O.name?.toLowerCase()??"")&&!g?.has(O.name?.toLowerCase()??""))),m=t.findIndex(O=>O.kind==="positional"&&!y.has(O.index));let v=-1;if(p!==-1&&m!==-1?v=Math.min(p,m):p!==-1?v=p:m!==-1&&(v=m),v>=0){const O=t[v].index;d._unknown=i.slice(O)}}else h.length>0&&!n.partial&&(d._unknown=h.map(p=>p.value));for(const[p,m]of Object.entries(l)){const v=n.camelCase?a?.get(p)??p:p,O=o.get(p);d[v]=O?.type?co(m,O.type):m===void 0?null:m}for(const p of e){const m=n.camelCase?a?.get(p.name)??p.name:p.name;!(m in d)&&p.defaultValue!==void 0&&(p.multiple??p.lazyMultiple?d[m]=Array.isArray(p.defaultValue)?[...p.defaultValue]:[p.defaultValue]:d[m]=p.defaultValue)}if(C){const p={},m={},v={};for(const A of e)if(A.group){const U=Array.isArray(A.group)?A.group:[A.group];for(const _ of U)He(_)||(p[_]??={})}for(const A of Object.keys(d))if(!go(A)){m[A]=d[A];let U=A;n.camelCase&&(U=u?.get(A)??A);const _=o.get(U);if(_?.group){const M=Array.isArray(_.group)?_.group:[_.group];for(const L of M)He(L)||p[L]&&(p[L][A]=d[A])}else v[A]=d[A]}const O={_all:m};for(const[A,U]of Object.entries(p))O[A]=U;Object.keys(v).length>0&&(O._none=v),d._unknown&&(O._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,O)}return x(r,"Final parsed result:","resolver",d),d},"resolveArgs");var yo=Object.defineProperty,X=Q((t,e)=>yo(t,"name",{value:e,configurable:!0}),"l");const J="-".codePointAt(0),F="=",bo=F.codePointAt(0),$o="--",Oo="-",Ao="--",bt=X(t=>t.length>2&&t.startsWith(Ao),"hasLongOptionPrefix"),Po=X(t=>bt(t)&&!t.includes(F,3),"isLongOption"),Co=X(t=>bt(t)&&t.includes(F,3),"isLongOptionAndValue"),No=X(t=>{if(t.length!==2||t.codePointAt(0)!==J||t.codePointAt(1)===J)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),_o=X(t=>!(t.length<=2||t.codePointAt(0)!==J||t.codePointAt(1)===J),"isShortOptionGroup"),ko=X(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;if(r>0?r--:i++,o===$o){e.push({index:i,kind:"option-terminator"});const c=n.map((s,g)=>({index:i+g+1,kind:"positional",value:s}));e.push(...c),i+=n.length;break}if(No(o)){const c=o.charAt(1);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(_o(o)&&!o.includes(F)){const c=[];let s="",g=!1;for(let a=1;a<o.length;a++){const u=o.charAt(a);g?s+=u:u.codePointAt(0)===bo?g=!0:c.push(`${Oo}${u}`)}if(g)if(c.length>0){const a=c.pop();c.push(`${a}=${s}`)}else c.push(s);n.unshift(...c),r=c.length;continue}if(Po(o)){const c=o.slice(2);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(Co(o)){const c=o.indexOf(F),s=o.slice(2,c),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:s,rawName:o,value:g});continue}if(o.length>2&&o.codePointAt(0)===J&&o.codePointAt(1)!==J&&o.includes(F)){const c=o.indexOf(F),s=o.charAt(1),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:s,rawName:o,value:g});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var Eo=Object.defineProperty,xe=Q((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"d");const xo=/\d/,Lo=xe(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Io=xe(t=>typeof t=="function","isValidCustomTypeFunction"),jo=xe((t,e,n)=>{const i=n?.debug??!1;x(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,o=new Set,c=new Set,s=new Set;let g=0;for(const a of t){if(x(i,"Checking definition:","validation",a),!a.name)throw x(i,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof a.name!="string")throw new j("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const u=e?a.name.toLowerCase():"";if(r.has(a.name)||e&&c.has(u))throw new j(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&s.has(u))throw new j(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(r.add(a.name),e&&c.add(u),a.alias!==void 0){if(typeof a.alias!="string")throw new j("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(xo.test(a.alias))throw new j("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const d=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&s.has(d))throw new j(`Invalid option definition: duplicate alias '${a.alias}'`);if(r.has(a.alias)||e&&c.has(d))throw new j(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&s.add(d)}if(a.defaultOption&&(g++,a.type!==void 0&&Lo(a.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(a.type!==void 0&&!(a.type===Boolean||a.type===Number||a.type===String||typeof a.type=="function"&&Io(a.type)))throw new j("Invalid option definition: invalid type")}if(g>1)throw x(i,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");x(i,"Validation completed successfully","validation")},"validateDefinitions");var Uo=Object.defineProperty,To=Q((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"O");const Mo=To((t,e={})=>{const n=e.debug??!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",r),jo(r,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);o=o.filter(u=>!a.has(u))}x(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(a=>{if(a.startsWith("--")){const u=a.indexOf("="),d=(u===-1?a.slice(2):a.slice(2,u)).toLowerCase();return u===-1?`--${d}`:`--${d}${a.slice(u)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const u=a.slice(1).split("=",2),d=u[0],l=u[1];if(!d)return a;const h=d.toLowerCase();return l===void 0?`-${h}`:`-${h}=${l}`}return a}));const s=ko(c.map(String));x(n,"Tokenized arguments:","index",s);const g=wo(s,r,i,o);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");var So=Object.defineProperty,Do=$((t,e)=>So(t,"name",{value:e,configurable:!0}),"b$2");let Vo=class{static{$(this,"m")}static{Do(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var Bo=Object.defineProperty,Ro=$((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"n$7");let $e=class extends P{static{$(this,"i")}static{Ro(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 zo=Object.defineProperty,Wo=$((t,e)=>zo(t,"name",{value:e,configurable:!0}),"f$5");const Fo=/^-{1,2}(\w+)(=(.+))?$/,$t=Wo((t,e,n,i)=>{const r=Fo.exec(t);if(r===null)return{};const o=r[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(s=>s.name===o||s.alias===o);return c!==void 0?{argName:c.name,argValue:r[3],option:c}:{}},"getParameterOption");var qo=Object.defineProperty,Ee=$((t,e)=>qo(t,"name",{value:e,configurable:!0}),"e$3");const Je=Ee((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"),Go=new Set(["0","1","false","true"]),Ko=Ee((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=Ee((o,c)=>{const{argName:s,argValue:g,option:a}=$t(c,e,n,i),{lastOption:u}=o;return a&&oe(a)&&g&&s?o.partial[s]=Je(g,a):o.lastName&&u&&oe(u)&&Go.has(c)&&(o.partial[o.lastName]=Je(c,u)),{lastName:s,lastOption:a,partial:o.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var Ho=Object.defineProperty,Qe=$((t,e)=>Ho(t,"name",{value:e,configurable:!0}),"s$9");const Yo=new Set(["0","1","false","true"]),Jo=Qe((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=Qe((o,c)=>{const{argValue:s,option:g}=$t(c,e,n,i),{lastOption:a}=o;if(a&&oe(a)&&Yo.has(c)){const{args:u}=o;return{args:u.slice(0,-1)}}return g&&oe(g)&&s?{args:o.args}:{args:[...o.args,c],lastOption:g}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var Qo=Object.defineProperty,Xo=$((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"o$8");const Xe=Xo(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 Zo=Object.defineProperty,fe=$((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"o$7");const ei=fe(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),ti=fe((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ei(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"),ni=/_./g,oi=/^[A-Z]/,ii=fe(t=>t.toLowerCase().replaceAll(ni,e=>e[1]?.toUpperCase()??e).replace(oi,e=>e.toLowerCase()),"toCamelCase"),ai=fe(t=>{if(!t||t.length===0)return{};const e={},n=z();for(const i of t){const r=n[i.name],o=ti(i,r),c=o===void 0?i.defaultValue:o,s=ii(i.name);e[s]=c}return e},"processEnvVariables");var ri=Object.defineProperty,ie=$((t,e)=>ri(t,"name",{value:e,configurable:!0}),"a$5");const si=ie(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 o of r)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),Ot=ie(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new $e(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new $e(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new $e(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),li=ie((t,e,n,i)=>{const r=new Vo(t.name,t),{_all:o,_unknown:c,positionals:s}=e,g=Object.keys(n).length>0?{...o,...n}:o;se in g&&delete g[se],r.argument=s?.[se]??[],r.rawUnknown=[...c??[]];const a=Object.keys(i).length>0;return r.options=a?{...g,...i}:g,r.env=ai(t.env),r},"prepareToolbox"),ci=ie((t,e,n)=>{const i=t.options??[],r=i.length>0;let o=Xe(r?[...i,...n]:n);if(o.length>0){for(const a of o)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:se,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,s;if(r){const{optionMapByAlias:a,optionMapByName:u}=si(i);c=Jo(e,i,u,a),s=Ko(e,i,u,a)}else c=e,s={};const g=Mo(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:s,parsedArgs:g}},"processCommandArgs"),K=ie(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Ot(t))(e),"executeCommand");var ui=Object.defineProperty,pi=$((t,e)=>ui(t,"name",{value:e,configurable:!0}),"n$6");let fi=class extends P{static{$(this,"s")}static{pi(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 di=Object.defineProperty,hi=$((t,e)=>di(t,"name",{value:e,configurable:!0}),"t$5");const Ze=hi((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 mi=Object.defineProperty,At=$((t,e)=>mi(t,"name",{value:e,configurable:!0}),"n$5");const gi=At((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Zt(t,e)<=t.length/3,"isSimilar"),R=At((t,e)=>{const n=t.toLowerCase();return e.filter(i=>gi(i.toLowerCase(),n))},"findAlternatives");var vi=Object.defineProperty,de=$((t,e)=>vi(t,"name",{value:e,configurable:!0}),"a$4");const wi=de((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let o=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const c=R(i.replace("--",""),(e.options??[]).map(s=>s.name));if(c.length>0){const[s,...g]=c.map(a=>`--${a}`);o+=g.length>0?`, did you mean ${s??""} or ${g.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
2
+ `))},"validateUnknownOptions"),yi=de((t,e,n)=>{const i=n.__requiredOptions__,r=i?Ze(i,e,!0):Ze(t,e,!1);if(r.length>0)throw new fi(n.name,r.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&wi(e,n)},"validateRequiredOptions"),bi=de((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(r)throw new at(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),$i=de(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const o=e.get(r.name)??[];o.push(r),e.set(r.name,o)}if(typeof r.alias=="string"&&r.alias.length>0){const o=n.get(r.alias)??[];o.push(r),n.set(r.alias,o)}else if(Array.isArray(r.alias)){for(const o of r.alias)if(o.length>0){const c=n.get(o)??[];c.push(r),n.set(o,c)}}}const i=[];for(const[r,o]of e)o.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[r,o]of n)o.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
3
+ `))},"validateDuplicateOptions");var Oi=Object.defineProperty,Le=$((t,e)=>Oi(t,"name",{value:e,configurable:!0}),"s$5");const Ai=Le((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 o=e[r-1];if(o===void 0||o.startsWith("-"))break;n.push(o);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"),B=Le(t=>t.join(" "),"getCommandPathKey"),et=Le((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Pi=Object.defineProperty,Pt=$((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"a$3"),Ci=Object.defineProperty,Ct=Pt((t,e)=>Ci(t,"name",{value:e,configurable:!0}),"a"),Ni=Object.defineProperty,_i=Ct((t,e)=>Ni(t,"name",{value:e,configurable:!0}),"a");let Nt=class{static{$(this,"u")}static{Pt(this,"n")}static{Ct(this,"s")}static{_i(this,"LRUCache")}capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};var ki=Object.defineProperty,Ei=$((t,e)=>ki(t,"name",{value:e,configurable:!0}),"r$5"),xi=Object.defineProperty,Li=Ei((t,e)=>xi(t,"name",{value:e,configurable:!0}),"a"),Ii=Object.defineProperty,ji=Li((t,e)=>Ii(t,"name",{value:e,configurable:!0}),"s");const Ui=ji((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Ti=Object.defineProperty,Mi=$((t,e)=>Ti(t,"name",{value:e,configurable:!0}),"T"),Si=Object.defineProperty,he=Mi((t,e)=>Si(t,"name",{value:e,configurable:!0}),"j");const Di=$n(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vi=he(t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,n]=te.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return te.getBuiltinModule(t)}return Di(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Bi}=Vi("node:util");var Ri=Object.defineProperty,zi=he((t,e)=>Ri(t,"name",{value:e,configurable:!0}),"a");const Oe=new Nt(1e3),Wi=/[.*+?^${}()|[\]\\]/g,Fi=zi(t=>{const e=t.join("");if(Oe.has(e)){const r=Oe.get(e);return r.lastIndex=0,r}const n=t.map(r=>r.replaceAll(Wi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Oe.set(e,i),i},"getSeparatorsRegex");var qi=Object.defineProperty,Gi=he((t,e)=>qi(t,"name",{value:e,configurable:!0}),"t");const Ki=Gi(t=>{const e=[];let n=0,i;for(W.lastIndex=0;(i=W.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=W.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Hi=Object.defineProperty,k=he((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"u");const Yi=/[ČŠŽĐ]/i,_t=new Uint8Array(128),kt=new Uint8Array(128),Et=new Uint8Array(128);for(let t=0;t<128;t++)_t[t]=t>=65&&t<=90?1:0,kt[t]=t>=97&&t<=122?1:0,Et[t]=t>=48&&t<=57?1:0;const Ae=k(t=>_t[t],"isUpper"),tt=k(t=>kt[t],"isLower"),Pe=k(t=>Et[t],"isDigit"),D=k((t,e,n,i,r)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const h of c)if(h(t[0])){o=!0;break}if(!o&&!n)return[t];const s=[...t],g=[];let a=s[0],u="other";const d=Object.entries(e);for(const h of d){const[f,y]=h;if(y(s[0])){u=f;break}}let l=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let h=1;h<s.length;h++){const f=s[h];let y="other";for(const C of d){const[N,E]=C;if(E(f)){y=N;break}}const b=n&&i?f===f.toLocaleUpperCase(i):!1;let w=!1;r?w=r(u,y,l,b,f,h,s):(u!==y&&u!=="other"&&y!=="other"&&(w=!0),n&&y!=="other"&&!l&&b&&(w=!0)),w?(g.push(a),a=f):a+=f,u=y,n&&(l=b)}return a&&a.length>0&&g.push(a),g.length>0?g:[t]},"handleScriptTransitions"),Ji=k((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"),xt=k((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 o=1;o<r;o++){const c=Ji(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const s=t.codePointAt(o-1),g=t.codePointAt(o),a=s&&s<128&&Ae(s),u=g&&g<128&&Ae(g),d=s&&s<128&&tt(s),l=s&&s<128&&Pe(s),h=g&&g<128&&Pe(g);if(d&&u){i.push(t.slice(n,o)),n=o;continue}if(l&&!h||!l&&h){i.push(t.slice(n,o)),n=o;continue}if(h&&!l){let f=!1,y=!1;if(o+1<r){const b=t.codePointAt(o+1);f=b&&b<128&&Ae(b),y=b&&b<128&&Pe(b)}if(!y&&f){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),y=f&&f<128&&tt(f);if(a&&u&&y){const b=t.slice(n,o+1);e.has(b)||(i.push(t.slice(n,o)),n=o)}}}return n<r&&i.push(t.slice(n)),i.filter(o=>o!=="")},"splitCamelCaseFast"),Lt=k((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 a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e),f=h,y=h?0:-1;for(let b=1;b<u;b++){const w=a[b],C=w===w.toLocaleUpperCase(e);if(C===h)l+=w;else if(C)l&&l.length>0&&(d.push(l),l=w),f=!0,y=b;else{if(f&&b-y>1){const N=a[b-1],E=l.slice(0,-1);E&&E.length>0&&d.push(E),l=N+w}else l+=w;f=!1,y=-1}h=C}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(!G.test(t)&&!I.test(t))return[t];const a=[...t],u=a.length,d=[];let l=a[0];const h=a[0];let f;G.test(h)?f=1:I.test(h)?f=2:f=0;let y=h===h.toLocaleUpperCase(e);for(let w=1;w<u;w++){const C=a[w];let N;G.test(C)?N=1:I.test(C)?N=2:N=0;const E=C===C.toLocaleUpperCase(e);f!==N&&(f===1||f===2)&&(N===1||N===2)||N===f&&!y&&E?(d.push(l),l=C):l+=C,f=N,y=E}l&&l.length>0&&d.push(l);const b=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&I.test(d[w])&&G.test(d[w+1][0])?(b.push(d[w]+d[w+1]),w+=1):b.push(d[w]);return b}if(e.startsWith("el")){if(!ye.test(t)&&!I.test(t))return[t];const a=[];Te.lastIndex=0;let u;for(;(u=Te.exec(t))!==null;)a.push(u[0]);a.length===0&&a.push(t);const d=[];if(a.length===1){const l=a[0];if(!l||!ye.test(l[0])||l.length===1)return[l??t]}for(const l of a){if(!l)continue;if(!ye.test(l[0])||l.length===1){d.push(l);continue}const h=l.length;let f=l[0],y=l[0]===l[0].toLocaleUpperCase(e);for(let b=1;b<h;b++){const w=l[b],C=w===w.toLocaleUpperCase(e);!y&&C?(d.push(f),f=w):f+=w,y=C}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),u=a?{hiragana:k(l=>on.test(l),"hiragana"),kanji:k(l=>Me.test(l),"kanji"),katakana:k(l=>nn.test(l),"katakana"),latin:k(l=>I.test(l),"latin")}:{hangul:k(l=>Se.test(l),"hangul"),latin:k(l=>I.test(l),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const l=D(t,u,!1,e,(f,y)=>f==="hiragana"&&y==="katakana"||f==="katakana"&&y==="hiragana"||f==="hiragana"&&y==="latin"||f==="katakana"&&y==="latin"||f==="kanji"&&y==="latin"||f==="latin"&&(y==="hiragana"||y==="katakana"||y==="kanji")),h=[];for(const f of l){const y=f;y.length===1&&d.has(y)&&h.length>0?h[h.length-1]=h.at(-1)+y:h.push(y)}return h.length>0?h:[t]}return D(t,u,!1,e,(l,h)=>l==="hangul"&&h==="latin"||l==="latin"&&h==="hangul")}if(e.startsWith("sl")){const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e);for(let f=1;f<u;f++){const y=a[f],b=y===y.toLocaleUpperCase(e),w=Yi.test(y),C=f<u-1&&a[f+1]===a[f+1].toLocaleUpperCase(e);!h&&b||w&&C?(d.push(l),l=y,w&&C&&(d.push(l),l="")):l+=y,h=b}return l&&l.length>0&&d.push(l),d}if(e.startsWith("zh"))return D(t,{han:k(a=>Me.test(a),"han"),latin:k(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=k(u=>De.test(u)||Ve.test(u),"isRtlChar");return D(t,{latin:k(u=>I.test(u),"latin"),rtl:k(u=>a(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 a=k(u=>an.test(u)||rn.test(u)||sn.test(u)||ln.test(u)||cn.test(u)||un.test(u)||pn.test(u)||fn.test(u)||dn.test(u)||hn.test(u)||mn.test(u)||gn.test(u)||vn.test(u)||wn.test(u)||yn.test(u)||bn.test(u),"isIndicChar");return D(t,{indic:k(u=>a(u),"indic"),latin:k(u=>I.test(u),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return D(t,{cyrillic:k(a=>G.test(a),"cyrillic"),latin:k(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return D(t,{latin:k(a=>I.test(a),"latin"),rtl:k(a=>De.test(a)||Ve.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return D(t,{hangul:k(a=>Se.test(a),"hangul"),latin:k(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!G.test(t)&&!I.test(t))return[t];const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e);for(let f=1;f<u;f++){const y=a[f],b=y===y.toLocaleUpperCase(e);if(Be.test(y)||Be.test(a[f-1])){l+=y;continue}!h&&b?(d.push(l),l=y):l+=y,h=b}return l&&l.length>0&&d.push(l),d}const r=[...t],o=r.length,c=[];let s=r[0],g=r[0]===r[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){c.push(a),s=r[a.length],g=s===s.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const u=r[a],d=u===u.toLocaleUpperCase(e);let l=0;for(const h of n)if(t.startsWith(h,a)){c.push(s,h),l=h.length,s="";const f=h.at(-1);f&&(g=f===f.toLocaleUpperCase(e));break}if(l>0){a+=l-1;continue}!g&&d?(c.push(s),s=u):s+=u,g=d}return s&&c.push(s),c},"splitCamelCaseLocale"),Qi=k((t,e,n)=>{const i=[],r=ne.test(t)?t.split(ne).filter(Boolean):[t];for(const o of r){const c=o;if(ne.test(c))i.push(c);else{W.lastIndex=0;const s=W.test(c)?Ki(c).filter(Boolean):[c];for(const g of s)if(W.lastIndex=0,W.test(g))i.push(g);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...Lt(g,a,n))}else i.push(...xt(g,n))}}return i},"processTextWithAnsiEmoji"),Xi=k((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:o,normalize:c=!1,separators:s,stripAnsi:g=!1,stripEmoji:a=!1}=e,u=new Set([...r].toSorted((w,C)=>C.length-w.length));let d=t;g&&(d=Bi(d)),a&&(d=en(d));let l;Array.isArray(s)?l=Fi(s):s instanceof RegExp?l=s:l=tn;const h=[];let f=d;const y=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;f.length>0;){const w=y.exec(f);if(!w){f===".."?h.push(".."):f==="."?h.push("."):f.length>0&&h.push(f);break}const C=w.index,N=w[0],E=N.length,p=f.slice(0,C),m=f.slice(C+E);if(N.startsWith("../"))h.push(".."),f=f.slice(C+3);else if(N.startsWith("./"))h.push("."),f=f.slice(C+2);else if(C===0&&N==="..")h.push(".."),f=f.slice(2);else if(C===0&&N===".")h.push("."),f=f.slice(1);else{p.length>0&&h.push(p);let v=0;for(;(v=N.indexOf("../",v))!==-1;)h.push(".."),v+=3;for(v=0;(v=N.indexOf("./",v))!==-1;)(v===0||N[v-1]!==".")&&h.push("."),v+=2;let O=m;for(;O.startsWith("../");)h.push(".."),O=O.slice(3);for(;O.startsWith("./");)h.push("."),O=O.slice(2);if(O===".."){h.push("..");break}else if(O==="."){h.push(".");break}else f=O}y.lastIndex=0}if(h.length===0){const w=d.split(l).filter(Boolean);h.push(...w)}let b=[];for(const w of h)n||i?b.push(...Qi(w,o,u)):o?b.push(...Lt(w,o,u)):b.push(...xt(w,u));return c&&(b=b.map(w=>u.has(w)?w:o&&w===w.toLocaleUpperCase(o)?w[0]+w.slice(1).toLocaleLowerCase(o):w.toUpperCase()===w&&!u.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),b},"splitByCase");var Zi=Object.defineProperty,ea=$((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"r$4"),ta=Object.defineProperty,na=ea((t,e)=>ta(t,"name",{value:e,configurable:!0}),"o"),oa=Object.defineProperty,ia=na((t,e)=>oa(t,"name",{value:e,configurable:!0}),"s");const aa=ia((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var ra=Object.defineProperty,sa=$((t,e)=>ra(t,"name",{value:e,configurable:!0}),"r$3"),la=Object.defineProperty,ca=sa((t,e)=>la(t,"name",{value:e,configurable:!0}),"r"),ua=Object.defineProperty,pa=ca((t,e)=>ua(t,"name",{value:e,configurable:!0}),"n");const fa=pa((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var da=Object.defineProperty,ha=$((t,e)=>da(t,"name",{value:e,configurable:!0}),"i$3"),ma=Object.defineProperty,ga=ha((t,e)=>ma(t,"name",{value:e,configurable:!0}),"f"),va=Object.defineProperty,wa=ga((t,e)=>va(t,"name",{value:e,configurable:!0}),"l");const ya=wa((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",o="";for(let c=0;c<n;c++){const s=t[c];if(ne.test(s)){r?(i.push(r+o+s),r="",o=""):(i.length>0&&i.push(e),r=s);continue}r?(o&&(o+=e),o+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var ba=Object.defineProperty,$a=$((t,e)=>ba(t,"name",{value:e,configurable:!0}),"r$2"),Oa=Object.defineProperty,Aa=$a((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"a"),Pa=Object.defineProperty,Ca=Aa((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"e");const Na=/(?<![a-zß])SS(?![a-z])/g,_a=Ca(t=>t.replaceAll(Na,"ß"),"normalizeGermanEszett");var ka=Object.defineProperty,Ea=$((t,e)=>ka(t,"name",{value:e,configurable:!0}),"c$2"),xa=Object.defineProperty,La=Ea((t,e)=>xa(t,"name",{value:e,configurable:!0}),"c"),Ia=Object.defineProperty,ja=La((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"o");const Ua=new Nt(1e3),It=ja((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??Ua;let r;if(n&&(r=fa(t,e)),n&&r&&i.has(r))return i.get(r);let o=!0;const c=ya(Xi(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&&ne.test(s))return s;const g=e?.locale?.startsWith("de")?_a(s):s,a=e?.locale?g.toLocaleLowerCase(e.locale):g.toLowerCase();return o?(o=!1,Ui(a,e)):aa(a,e)}),"");return n&&r&&i.set(r,c),c},"camelCase");var Ta=Object.defineProperty,me=$((t,e)=>Ta(t,"name",{value:e,configurable:!0}),"a$2");const Ma=me(t=>{t.options?.forEach(e=>{e.__camelCaseName__=It(e.name)})},"processOptionNames"),Sa=me(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 o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(o),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Da=me((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=It(o.name);i.set(c,o)}const r=Object.keys(n).filter(o=>i.has(o));if(r.length!==0)for(const o of r){const c=o.charAt(2);if(!c)continue;const s=c.toLowerCase()+o.slice(3),g=i.get(o);g&&(g.__negated__=!0),n[s]=!n[o],Reflect.deleteProperty(n,o)}},"mapNegatableOptions"),Va=me((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 o=n.get(r);if(o?.implies){const{implies:c}=o;for(const[s,g]of Object.entries(c))i[s]===void 0&&(i[s]=g)}}},"mapImpliedOptions");var Ba=Object.defineProperty,ge=$((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"e$2");const Ra=ge(()=>!!process.versions.electron,"isElectronApp"),za=ge(()=>Ra()&&!process.defaultApp,"isBundledElectronApp"),Wa=ge(()=>za()?0:1,"getProcessArgvBinIndex"),Fa=ge(t=>t.slice(Wa()+1),"hideBin");var qa=Object.defineProperty,jt=$((t,e)=>qa(t,"name",{value:e,configurable:!0}),"e$1");const Ga=" ",Ka=jt((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),Ha=jt(t=>{if(typeof t=="string")return t.split(Ga);const e=ke();return Ka(t,e)?Fa(t):t},"parseRawCommand");var Ya=Object.defineProperty,Ce=$((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"r");const Ja=Ce(t=>{const e=Ce(o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),Y(1)},"uncaughtExceptionHandler"),n=Ce((o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let s;if(typeof o=="string")s=o;else try{s=JSON.stringify(o)}catch{s=String(o)}t.error(`Promise rejection: ${s}`)}Y(1)},"unhandledRejectionHandler"),i=Ue("uncaughtException",e),r=Ue("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var Qa=Object.defineProperty,Z=$((t,e)=>Qa(t,"name",{value:e,configurable:!0}),"e");const le=100,Ut=/^[a-z][\w-]*$/i,ce=Z((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new P(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),nt=Z((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new P(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");Z((t,e)=>{if(typeof t!="function")throw new P(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Ne=Z((t,e)=>{if(typeof t!="object"||t===null)throw new P(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),re=Z(t=>{const e=ce(t,"Command name");if(e.length>le)throw new P(`Command name is too long (maximum ${String(le)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new P(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Ut.test(e))throw new P(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");Z(t=>{const e=ce(t,"Plugin name");if(e.length>le)throw new P(`Plugin name is too long (maximum ${String(le)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new P(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!Ut.test(e))throw new P(`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 Xa=Object.defineProperty,ve=$((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"s");const Za=new Set([`
4
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),er=/^[A-Z]:/i,tr=ve((t,e=!0)=>{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)`);if(e){for(const n of t)if(Za.has(n))throw new Error(`Argument contains dangerous character: ${n}`)}return t.trim()},"sanitizeArgument"),ot=ve((t,e=!0)=>{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(n=>tr(n,e))},"sanitizeArguments");ve(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.split(/[/\\]/).includes(".."))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||er.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 Ar{static{$(this,"RateLimiter")}static{ve(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 nr=Object.defineProperty,T=$((t,e)=>nr(t,"name",{value:e,configurable:!0}),"b");const or=/^-([^\d-])$/,ir=/^--(\S+)/,ar=/^-([^\d-]{2,})$/,_e=T(t=>or.test(t)||ir.test(t)||ar.test(t),"isOption"),rr={access:T((t,e)=>qt(t,e),"access"),mkdir:T((t,e)=>Ft(t,e),"mkdir"),readdir:T(t=>Wt(t),"readdir"),readFile:T((async(t,e)=>e===void 0?Ie(t):Ie(t,e)),"readFile"),rm:T((t,e)=>zt(t,e),"rm"),stat:T(t=>Rt(t),"stat"),writeFile:T((t,e,n)=>Bt(t,e,n),"writeFile")};class Tt{static{$(this,"Cli")}static{T(this,"Cli")}#t;#e;#c;#u;#f;#d;#y;#b;#$;#O;#A;#p;#n;#o;#i;#a;#r;#h=!1;#P;#C=!1;#m;#g;#v;#l=[];#x(){return this.#m===void 0&&(this.#m=[...this.#o.keys()]),this.#m}#N(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#s(){return this.#v===void 0&&(this.#v=[...this.#x(),...this.#N()]),this.#v}#_(){return this.#l.length===0?ae:[...ae,...this.#l]}#k(){this.#m=void 0,this.#g=void 0,this.#v=void 0}#w(){if(this.#c===void 0){const e=Ha(this.#e.argv);this.#c=ot(e,!1),this.#L()}return this.#c}#L(){if(!this.#c)return;const e=z();let n=!1;for(const i of this.#c){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Gt),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Kt),n=!0;break}if(i==="--debug"){e.CEREBRO_OUTPUT_LEVEL=String(H),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(H):String(je))}#I(){this.#C||(this.#P=Ja(this.#t),this.#C=!0)}#j(){return{arch:Yt(),argv:this.#w(),cwd:this.#u,env:this.#O??z(),exit:this.#$??(e=>Y(e??0)),platform:Ht(),stdin:this.#A}}#E(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:s}=ci(e,n,this.#_()),g=Object.keys(c).length>0;let a=s;g&&(a={...s,_all:{...s._all,...c}}),yi(o,a,e);const u=li(e,s,c,i);u.runtime=this,u.argv=this.#w(),u.fs=this.#b??rr,u.process=this.#j(),u.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const l=e.options.filter(h=>h.name.startsWith("no-"));for(const h of l){const f=h.name.replace(/^no-/,""),y=`--${h.name}`,b=`--${f}`,w=n.includes(y),C=n.includes(b);if(w&&C)throw new at(f,h.name)}}return d&&(Da(u,e),Va(u,e)),bi(o,u.options,e),z().CEREBRO_OUTPUT_LEVEL===String(H)&&(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_:o,booleanValues:c,commandArgs:a,parsedArgs:s,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new P("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??ke(),r=n.cwd??Jt();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new P("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 P("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new P("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new P("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=z();if(o.CEREBRO_OUTPUT_LEVEL=String(je),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],d=[],l=this.#e.logger;for(const h of u)typeof l[h]!="function"&&d.push(h);if(d.length>0)throw new P(`Logger object is missing required methods: ${d.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:d});this.#t=this.#e.logger}else this.#t={...console,debug:T((...u)=>{o.CEREBRO_OUTPUT_LEVEL===String(H)&&console.debug(...u)},"debug")};this.#d=this.#e.packageVersion,this.#y=this.#e.packageName,this.#u=this.#e.cwd,this.#a="help",this.#r={};const c=n.fs;if(c!==void 0&&(typeof c!="object"||c===null))throw new P("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const s=n.exit;if(s!==void 0&&typeof s!="function")throw new P("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const g=n.env;if(g!==void 0&&(typeof g!="object"||g===null))throw new P("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const a=n.stdin;if(a!==void 0&&typeof a!="string")throw new P("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#b=n.fs,this.#$=n.exit,this.#O=n.env,this.#A=n.stdin??"",this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#d?` v${this.#d}`:""}`),this.#r}setDefaultCommand(e){return this.#a=e,this}get defaultCommand(){return this.#a}addCommand(e){Ne(e,"Command"),re(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new P(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new P(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?re(e.alias):nt(e.alias,"Command alias").forEach(a=>re(a))),e.argument&&Ne(e.argument,"Command argument"),e.options&&Ne(e.options,"Command options"),e.commandPath&&(nt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{re(a)}));const r=et(e.name,e.commandPath),o=B(r);if(this.#o.has(o))throw new P(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,s=this.#n.get(e.name),g=s!==void 0&&(s.commandPath===void 0||s.commandPath.length===0);if(!c&&g)throw new P(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)ze(a);if($i(e),Sa(e),Ma(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),c&&s!==void 0)this.#n.set(o,e);else{if(!c&&s!==void 0&&!g){const a=et(s.name,s.commandPath);this.#n.set(B(a),s)}this.#n.set(e.name,e)}if(this.#o.set(o,r),this.#i.set(o,e),this.#k(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const u of a){if(z().CEREBRO_OUTPUT_LEVEL===String(H)&&this.#t.debug("adding alias",u),this.#n.has(u))throw new P(`Command alias "${u}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:u,commandName:e.name});this.#n.set(u,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ae.map(o=>o.name)),r=new Set(ae.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new P(`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 P(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new P(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",ze(n),this.#l.push(n),this}getGlobalOptions(){return this.#_()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new xn(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:T(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#d}getPackageName(){return this.#y}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#P?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:p}=await import("../commands/help-command.js");this.addCommand(new p(this.#n))}const o=this.#N(),c=this.#o;this.#I();const s=this.#w();let g,a=[...s];const u=Qt(),d=Xt(),l=ke();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const h=Ai(c,[...s]);if(h.commandPath)g=h.commandPath,a=h.argv;else{if(s.length>1&&s[0]&&s[1]&&!_e(s[0])&&!_e(s[1])){const m=[];let v=0;for(;v<s.length;){const A=s[v];if(!A||_e(A))break;m.push(A),v+=1}const O=B(m);if(m[0]&&!o.includes(m[0])){const A=this.#s(),U=R(O,A);throw new V(O,U)}}let p;try{p=Bn([null,...o],[...s])}catch(m){if(m instanceof Error&&m.name==="INVALID_COMMAND"&&"command"in m){const v=m.command,O=this.#s(),A=R(v,O);throw new V(v,A)}throw m}p.command&&(g=[p.command],a=p.argv)}if(!g)if(this.#a)g=[this.#a];else{const p=this.#s();throw new V("",p)}const f=B(g),y=this.#o.get(f);let b;if(y){if(b=this.#i.get(f),!b||B(y)!==f){const p=this.#s(),m=R(f,p);throw new V(f,m)}}else{const p=g.at(-1);if(b=p?this.#n.get(p):void 0,!b){const m=this.#s(),v=R(f,m);throw new V(f,v)}}if(typeof b.execute!="function"&&typeof b.loader!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),i?Y(1):void 0;const w=a;let C,N;try{({commandArgs:C,toolbox:N}=this.#E(b,w,r,f))}catch(p){if(this.#t.error(p),i)return Y(1);throw p}const E=this.getPluginManager();try{!this.#h&&E.hasPlugins()&&(await E.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await E.executeLifecycle("execute",N),await E.executeLifecycle("beforeCommand",N);let p;const m=C.global;if(m?.help){const v=this.#n.get("help");if(!v)throw new P("Help command not found","COMMAND_NOT_FOUND");p=await K(v,N,C)}else if(m?.version??m?.V){const v=this.#n.get("version");if(!v)throw new P("Version command not found","COMMAND_NOT_FOUND");p=await K(v,N,C)}else p=await K(b,N,C);return await E.executeLifecycle("afterCommand",N,p),i?Y(0):void 0}catch(p){throw await E.executeErrorHandlers(p,N),p}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;ce(e,"Command name");const o=e.split(" ").filter(Boolean),c=B(o),s=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!s){const l=this.#s(),h=R(c||e,l);throw new V(e,h)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new P(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const g=[...ot(i,!1)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:a,toolbox:u}=this.#E(s,g,r,c||e),d=this.getPluginManager();try{!this.#h&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await d.executeLifecycle("execute",u),await d.executeLifecycle("beforeCommand",u);let l;const h=a.global;if(h?.help){const f=this.#n.get("help");if(!f)throw new P("Help command not found","COMMAND_NOT_FOUND");l=await K(f,u,a)}else if(h?.version??h?.V){const f=this.#n.get("version");if(!f)throw new P("Version command not found","COMMAND_NOT_FOUND");l=await K(f,u,a)}else l=await K(s,u,a);return await d.executeLifecycle("afterCommand",u,l),l}catch(l){throw await d.executeErrorHandlers(l,u),l}}clone(e){const n={...this.#e,...e},i=new Tt(this.#f,n);for(const[r,o]of this.#n)i.#n.set(r,o);for(const[r,o]of this.#o)i.#o.set(r,[...o]);for(const[r,o]of this.#i)i.#i.set(r,o);for(const r of this.#l)i.#l.push(r);return i.#a=this.#a,i.#r={...this.#r},i.#k(),i}async getAction(e){ce(e,"Command name");const n=e.split(" ").filter(Boolean),i=B(n),r=this.#o.get(i)?this.#i.get(i):this.#n.get(e);if(!r){const o=this.#s(),c=R(i||e,o);throw new V(e,c)}if(typeof r.execute=="function")return r.execute;if(typeof r.loader=="function")return Ot(r);throw new P(`Command "${r.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:r.name})}}export{Tt 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-DxgI44AK-DFDWFoCr.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 @@
1
+ var n=Object.defineProperty;var a=(e,p)=>n(e,"name",{value:p,configurable:!0});var t=Object.defineProperty,c=a((e,p)=>t(e,"name",{value:p,configurable:!0}),"p"),g=Object.defineProperty,r=c((e,p)=>g(e,"name",{value:p,configurable:!0}),"e"),E=Object.defineProperty,S=r((e,p)=>E(e,"name",{value:p,configurable:!0}),"E");const i=String.raw,u=i`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,w=S(()=>new RegExp(i`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${u}(?:\u200D${u})*`,"gu"),"default");var R=Object.defineProperty,x=r((e,p)=>R(e,"name",{value:p,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 s=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,b=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,l=w(),f=/[-_./\s]+/g,m=/(\u001B\[[0-9;]*[a-z])/i,d=new RegExp("\\p{Script=Arabic}","u"),y=new RegExp("\\p{Script=Bengali}","u"),B=new RegExp("\\p{Script=Cyrillic}","u"),v=new RegExp("\\p{Script=Devanagari}","u"),j=new RegExp("\\p{Script=Ethiopic}","u"),F=new RegExp("\\p{Script=Greek}","u"),O=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),h=new RegExp("\\p{Script=Gujarati}","u"),k=new RegExp("\\p{Script=Gurmukhi}","u"),G=new RegExp("\\p{Script=Hangul}","u"),H=new RegExp("\\p{Script=Hebrew}","u"),L=new RegExp("\\p{Script=Hiragana}","u"),M=new RegExp("\\p{Script=Han}","u"),P=new RegExp("\\p{Script=Kannada}","u"),T=new RegExp("\\p{Script=Katakana}","u"),K=new RegExp("\\p{Script=Khmer}","u"),z=new RegExp("\\p{Script=Lao}","u"),A=new RegExp("\\p{Script=Latin}","u"),C=new RegExp("\\p{Script=Malayalam}","u"),D=new RegExp("\\p{Script=Myanmar}","u"),q=new RegExp("\\p{Script=Oriya}","u"),I=new RegExp("\\p{Script=Sinhala}","u"),Z=new RegExp("\\p{Script=Tamil}","u"),_=new RegExp("\\p{Script=Telugu}","u"),$=new RegExp("\\p{Script=Thai}","u"),J=new RegExp("\\p{Script=Tibetan}","u"),N=/[\u02BB\u02BC\u0027]/u,Q=x(e=>e.replace(l,""),"stripEmoji");export{j as A,F as C,O as D,l as E,b as H,k as I,H as J,y as K,f as L,m as M,A as N,B as P,L as Q,d as T,M as U,P as V,T as W,K as X,C as Y,z as Z,G as _,D as a,q as e,s as h,J as i,$ as n,I as p,h as q,_ as r,Q as s,N as t,Z as u,v as z};
@@ -0,0 +1,6 @@
1
+ var ge=Object.defineProperty;var d=(e,r)=>ge(e,"name",{value:r,configurable:!0});import{createRequire as we}from"node:module";import{h as O,H as E,E as U}from"./constants-DmzZF6_u-BmMwILI_.js";import{createTable as P}from"@visulima/tabular";import{NO_BORDER as M}from"@visulima/tabular/style";import $e from"@visulima/colorize/template";import{d as We}from"./runtime-process-DKHFvYkv.js";import{bold as Ne}from"@visulima/colorize";const be=we(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=d(e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[r,t]=$.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return $.getBuiltinModule(e)}return be(e)},"__cjs_getBuiltinModule"),w=$,{execFileSync:ye}=k("node:child_process"),I=k("node:fs"),ve=k("node:tty"),Oe=k("node:os");var Ie=Object.defineProperty,Q=d((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"u$2"),je=Object.defineProperty,L=Q((e,r)=>je(e,"name",{value:r,configurable:!0}),"l");const Ae=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],xe=12288,Ee=65510,Se=[12288,12288,65281,65376,65504,65510],Pe=8361,Me=65518,Te=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],_e=32,Ce=10630,Re=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ke=4352,Le=262141,ae=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Fe=Object.defineProperty,Be=L((e,r)=>Fe(e,"name",{value:r,configurable:!0}),"r$1");const j=Be((e,r)=>{let t=0,i=Math.floor(e.length/2)-1;for(;t<=i;){const a=Math.floor((t+i)/2),s=a*2;if(r<e[s])i=a-1;else if(r>e[s+1])t=a+1;else return!0}return!1},"isInRange");var He=Object.defineProperty,b=L((e,r)=>He(e,"name",{value:r,configurable:!0}),"r");const te=19968,[ze,qe]=F(ae);function F(e){let r=e[0],t=e[1];for(let i=0;i<e.length;i+=2){const a=e[i],s=e[i+1];if(te>=a&&te<=s)return[a,s];s-a>t-r&&(r=a,t=s)}return[r,t]}d(F,"c$2");Q(F,"f");L(F,"k");b(F,"findWideFastPathRange");const oe=b(e=>e<161||e>1114109?!1:j(Ae,e),"isAmbiguous"),se=b(e=>e<xe||e>Ee?!1:j(Se,e),"isFullWidth"),Ve=b(e=>e<Pe||e>Me?!1:j(Te,e),"isHalfWidth"),Ye=b(e=>e<_e||e>Ce?!1:j(Re,e),"isNarrow"),le=b(e=>e>=ze&&e<=qe?!0:e<ke||e>Le?!1:j(ae,e),"isWide");function B(e){return oe(e)?"ambiguous":se(e)?"fullwidth":Ve(e)?"halfwidth":Ye(e)?"narrow":le(e)?"wide":"neutral"}d(B,"g$3");Q(B,"S");L(B,"getCategory");b(B,"getCategory");var De=Object.defineProperty,H=d((e,r)=>De(e,"name",{value:r,configurable:!0}),"i$2"),Ue=Object.defineProperty,z=H((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"a"),Je=Object.defineProperty,X=z((e,r)=>Je(e,"name",{value:r,configurable:!0}),"e");function A(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}d(A,"s$1");H(A,"s");z(A,"r");X(A,"validate");function x(e){return A(e),B(e)}d(x,"r$3");H(x,"p");z(x,"eastAsianWidthType");X(x,"eastAsianWidthType");function Z(e,{ambiguousAsWide:r=!1}={}){return A(e),se(e)||le(e)||r&&oe(e)?2:1}d(Z,"o$2");H(Z,"W");z(Z,"eastAsianWidth");X(Z,"eastAsianWidth");var Ke=Object.defineProperty,Ge=d((e,r)=>Ke(e,"name",{value:r,configurable:!0}),"E"),Qe=Object.defineProperty,Xe=Ge((e,r)=>Qe(e,"name",{value:r,configurable:!0}),"A"),Ze=Object.defineProperty,q=Xe((e,r)=>Ze(e,"name",{value:r,configurable:!0}),"d");const ie=new Map,S=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,T=q(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),er=q((e,r)=>{const t=Math.floor(e/65536),i=e%65536;let a=ie.get(t);if(a||(a=new Map,ie.set(t,a)),a.has(i))return a.get(i);let s;if(T(e)==="latin")s=r.width.regular;else if(T(e)==="control")s=r.width.control;else if(T(e)==="wide")s=r.width.wide;else switch(x(e)){case"ambiguous":{s=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{s=r.width.fullWidth;break}case"wide":{s=r.width.wide;break}default:s=r.width.regular}return a.set(i,s),s},"getCachedCharWidth"),rr=q(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),K=q((e,r={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const t={truncation:{countAnsiEscapeCodes:r.countAnsiEscapeCodes??!1,ellipsis:r.ellipsis??"",ellipsisWidth:r.ellipsisWidth??(r.ellipsis?K(r.ellipsis,{...r,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:r.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:r.ambiguousIsNarrow??!1,ansi:r.ansiWidth??0,control:r.controlWidth??0,emoji:r.emojiWidth??2,fullWidth:r.fullWidth??2,halfWidth:r.halfWidth??1,regular:r.regularWidth??1,tab:r.tabWidth??8,wide:r.wideWidth??2}},i=Math.max(0,t.truncation.limit-t.truncation.ellipsisWidth),{length:a}=e,s=a>1e4;let n=0,o=0,l=a,u=!1;const y=e.includes("\x1B")||e.includes("›");for(;n<a;){if(y&&(e[n]==="\x1B"||e[n]==="›")){if(e.startsWith("\x1B]8;;",n)){const h="\x1B]8;;\x07",g=h.length,V=e.indexOf("\x07",n+5);if(V!==-1){const Y=e.indexOf(h,V+1);if(Y!==-1){const me=Y+g,pe=e.slice(V+1,Y).replace(O,""),re=K(pe,{ambiguousIsNarrow:t.width.ambiguousIsNarrow,ansiWidth:t.width.ansi,controlWidth:t.width.control,countAnsiEscapeCodes:!1,ellipsis:t.truncation.ellipsis,ellipsisWidth:t.truncation.ellipsisWidth,emojiWidth:t.width.emoji,fullWidth:t.width.fullWidth,halfWidth:t.width.halfWidth,limit:Math.max(0,i-o),regularWidth:t.width.regular,tabWidth:t.width.tab,wideWidth:t.width.wide}),D=re.width;if(re.truncated)u=!0,l=Math.min(l,n);else if(o+D>i&&(l=Math.min(l,n),u=!0,o+D>t.truncation.limit))break;if(o+=D,n=me,u&&o>=t.truncation.limit)break;continue}}}if(O.lastIndex=n,O.test(e)){const h=O.lastIndex-n,g=t.truncation.countAnsiEscapeCodes?h:t.width.ansi;if(o+g>i&&(l=Math.min(l,n),o+g>t.truncation.limit)){u=!0;break}o+=g,n=O.lastIndex;continue}}const m=e.codePointAt(n);if(m===8203||m===65279||m>=8288&&m<=8292){n+=1;continue}if(m===9){if(o+t.width.tab>i&&(l=Math.min(l,n),o+t.width.tab>t.truncation.limit)){u=!0;break}o+=t.width.tab,n+=1;continue}if(S.lastIndex=n,S.test(e)){const h=(S.lastIndex-n)*t.width.regular;if(o+h>i){const g=Math.floor((i-o)/t.width.regular);if(l=Math.min(l,n+g),o+h>t.truncation.limit){u=!0;break}}o+=h,n=S.lastIndex;continue}if((m<=31||m>=127&&m<=159)&&(E.lastIndex=n,E.test(e))){const h=(E.lastIndex-n)*t.width.control;if(o+h>i&&(l=Math.min(l,n+Math.floor((i-o)/t.width.control)),o+h>t.truncation.limit)){u=!0;break}o+=h,n=E.lastIndex;continue}if(U.lastIndex=n,U.test(e)){if(o+t.width.emoji>i&&(l=Math.min(l,n),o+t.width.emoji>t.truncation.limit)){u=!0;break}o+=t.width.emoji,n=U.lastIndex;continue}const v=e.codePointAt(n)??0;if(rr(v)){n+=v>65535?2:1;continue}let f;if(s)f=er(v,t);else switch(T(v)){case"control":{f=t.width.control;break}case"latin":{f=t.width.regular;break}case"wide":{f=t.width.wide;break}case"zero":{f=0;break}default:switch(x(v)){case"ambiguous":{f=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{f=t.width.fullWidth;break}case"wide":{f=t.width.wide;break}default:f=t.width.regular}}if(o+f>i&&(l=Math.min(l,n),o+f>t.truncation.limit)){u=!0;break}o+=f,n+=v>65535?2:1}let W=o,ee=!1;return u&&t.truncation.limit>=t.truncation.ellipsisWidth&&(W=t.truncation.limit,ee=!0),{ellipsed:ee,index:u?l:a,truncated:u,width:W}},"getStringTruncatedWidth");var tr=Object.defineProperty,ir=d((e,r)=>tr(e,"name",{value:r,configurable:!0}),"i$1"),nr=Object.defineProperty,ar=ir((e,r)=>nr(e,"name",{value:r,configurable:!0}),"e"),or=Object.defineProperty,sr=ar((e,r)=>or(e,"name",{value:r,configurable:!0}),"r");const lr=sr((e,r={})=>K(e,{...r,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var dr=Object.defineProperty,p=d((e,r)=>dr(e,"name",{value:r,configurable:!0}),"n$1");const de=80,ue=24,G=p((e,r,{shell:t,env:i}={})=>ye(e,r,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:t,env:i}).trim(),"exec"),_=p((e,r)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(r,10)}),"create"),ce=p((e,r)=>{const{columns:t,rows:i}=_(e,r);if(!(Number.isNaN(t)||Number.isNaN(i))&&!(t===de&&i===ue))return{columns:t,rows:i}},"createIfNotDefault"),ur=p(()=>{if(w.platform!=="linux")return!0;try{const e=I.readFileSync("/proc/self/stat","utf8"),r=e.lastIndexOf(") ");if(r===-1)return!1;const t=e.slice(r+2).trim().split(/\s+/),i=Number.parseInt(t[2],10),a=Number.parseInt(t[5],10);return Number.isNaN(i)||Number.isNaN(a)||a<=0?!1:i===a}catch{return!1}},"isForegroundProcess");function fe(){const{env:e,stdout:r,stderr:t}=w;if(r?.columns&&r?.rows)return _(r.columns,r.rows);if(t?.columns&&t?.rows)return _(t.columns,t.rows);if(e.COLUMNS&&e.LINES)return _(e.COLUMNS,e.LINES);const i={columns:de,rows:ue};return w.platform==="win32"?J()??i:w.platform==="darwin"?ne()??J()??i:ne()??J()??cr()??i}d(fe,"O$1");p(fe,"terminalSize");const ne=p(()=>{try{const e=w.platform==="darwin"?I.constants.O_EVTONLY|I.constants.O_NONBLOCK:I.constants.O_NONBLOCK,{columns:r,rows:t}=ve.WriteStream(I.openSync("/dev/tty",e));return{columns:r,rows:t}}catch{}},"devTty"),J=p(()=>{try{const e=G("tput",["cols"],{env:{TERM:"dumb",...w.env}}),r=G("tput",["lines"],{env:{TERM:"dumb",...w.env}});if(e&&r)return ce(e,r)}catch{}},"tput"),cr=p(()=>{try{if(!ur())return;const e=G("resize",["-u"]).match(/\d+/g);if(e.length===2)return ce(e[0],e[1])}catch{}},"resize");var fr=Object.defineProperty,hr=d((e,r)=>fr(e,"name",{value:r,configurable:!0}),"s");const N=new Map,mr=500,c=hr(e=>{if(!e||e==="")return"";const r=N.get(e);if(r!==void 0)return r;const t=$e(Object.assign([],{raw:[e]}));if(N.size>=mr){const i=N.keys().next().value;i!==void 0&&N.delete(i)}return N.set(e,t),t},"templateFormat");var pr=Object.defineProperty,gr=d((e,r)=>pr(e,"name",{value:r,configurable:!0}),"t$1");const C=gr(()=>{const e=We().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const r=Number.parseInt(e,10);if(!(Number.isNaN(r)||r<=0))return r},"getTerminalWidth");var wr=Object.defineProperty,br=d((e,r)=>wr(e,"name",{value:r,configurable:!0}),"t");class he{static{d(this,"n")}static{br(this,"BaseSection")}lines;constructor(){this.lines=[]}add(r){this.lines.push(r)}toString(){return this.lines.join(Oe.EOL)}header(r){this.add(Ne(r)),this.lines.push("")}}var yr=Object.defineProperty,R=d((e,r)=>yr(e,"name",{value:r,configurable:!0}),"g");const vr=R(e=>e!==void 0&&e>0?e:fe().columns,"resolveTerminalWidth"),$r=R((e,r,t,i)=>{if(e.length===0||e.some(u=>u.length!==2))return;let a=0;for(const u of e){const y=u[0];if(y===void 0)continue;const W=lr(y);W>a&&(a=W)}if(a===0)return;const s=t+i,n=a+s,o=20+s;if(n+o>r)return;const l=r-n;return[n,l]},"computeColumnWidths");class Wr extends he{static{d(this,"S")}static{R(this,"ContentSection")}constructor(r){if(super(),r.header&&this.header(c(r.header)),r.content){if(r.raw)if(Array.isArray(r.content)&&r.content.every(t=>typeof t=="string"))r.content.forEach(t=>{Array.isArray(t)?t.forEach(i=>{this.add(c(i))}):this.add(c(t))});else if(typeof r.content=="string")this.add(c(r.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(r.content));this.add("")}}getContentLines(r){if(typeof r=="string"){const t=P({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return t.addRow([c(r)]),t.toString()}if(Array.isArray(r)&&r.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(i=>typeof i=="string"))){const t=vr(C()),i=R(o=>Array.isArray(o)?o.map(l=>c(l)):[c(o)],"formatRow"),a=r.map(o=>i(o)),s=$r(a,t,4,1),n=P({columnWidths:s,showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:t,truncateOverflow:!1,wordWrap:!0});return a.forEach(o=>{s!==void 0&&o.length===2?n.addRow([{content:o[0],wordWrap:!1},o[1]]):n.addRow(o)}),n.toString()}if(typeof r=="object"){const t=r;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
2
+ ${JSON.stringify(r)}`);const i=P({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(a=>{Array.isArray(a)?i.addRow(a.map(s=>c(s))):i.addRow([c(a)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
+
4
+ ${JSON.stringify(r)}`)}}var Or=Object.defineProperty,Nr=d((e,r)=>Or(e,"name",{value:r,configurable:!0}),"m");class Ir extends he{static{d(this,"O")}static{Nr(this,"OptionListSection")}constructor(r){super();let t=r.optionList??[];const i=Array.isArray(r.hide)?r.hide:[r.hide].filter(n=>typeof n=="string"),a=Array.isArray(r.group)?r.group:[r.group].filter(n=>typeof n=="string");i.length>0&&(t=t.filter(n=>!i.includes(n.name))),r.header&&this.header(c(r.header)),a.length>0&&(t=t.filter(n=>{const o=n,l=a.includes("_none")&&!o.group,u=o.group,y=this.intersect(Array.isArray(u)?u:[u],a);return l||y?n:void 0}));const s=P({showHeader:!1,style:{border:M,paddingLeft:2,paddingRight:1,...r.tableOptions?.style},terminalWidth:C()??r.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:r.tableOptions?.wordWrap??!0,...r.tableOptions});t.forEach(n=>{const o=n;s.addRow([this.getOptionNames(o,r.reverseNameOrder??!1,r.isArgument??!1),c(o.description)])}),this.add(s.toString()),this.lines.push("")}getOptionNames(r,t,i){if(!r.name)throw new TypeError("Invalid option definition, name is required.");let a=r.type?r.type.name.toLowerCase():"string";const s=r.multiple||r.lazyMultiple?"[]":"";a=c(r.typeLabel??`{underline ${a}${s}}`);let n;if(r.alias)if(r.name){const o=i?r.name:`{yellow --${r.name}}`;n=c(t?`{bold ${o}}, {bold -${r.alias}} ${a}`:`{bold -${r.alias}}, {bold ${o}} ${a}`)}else t?n=c(`{bold -${r.alias}} ${a}`):n=c(`{bold -${r.alias}} ${a}`);else n=c(`{bold ${i?r.name:`{yellow --${r.name}}`}} ${a}`);return n}intersect(r,t){return r.some(i=>t.includes(i))}}var jr=Object.defineProperty,Ar=d((e,r)=>jr(e,"name",{value:r,configurable:!0}),"o");const Rr=Ar(e=>(Array.isArray(e)?e:[e]).length===0?"":`
5
+ ${e.map(r=>r.optionList?new Ir(r).toString():new Wr(r).toString()).join(`
6
+ `)}`,"commandLineUsage");export{c as f,Rr 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};