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

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 (96) hide show
  1. package/CHANGELOG.md +471 -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 +5 -5
  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 +21 -21
  10. package/dist/commands/version-command.d.ts +4 -3
  11. package/dist/commands/version-command.js +1 -1
  12. package/dist/index.d.ts +501 -95
  13. package/dist/index.js +1 -1
  14. package/dist/logger/create-pail-logger.d.ts +745 -8
  15. package/dist/logger/create-pail-logger.js +1 -1
  16. package/dist/packem_chunks/has-new-version.js +1 -1
  17. package/dist/packem_shared/Cerebro-ChUYLbTK.js +4 -0
  18. package/dist/packem_shared/VisulimaError-CVxSPzeQ.js +76 -0
  19. package/dist/packem_shared/cerebro-error-etNTKvnJ.js +1 -0
  20. package/dist/packem_shared/constants-CImsldtV-Ces7vzH9.js +1 -0
  21. package/dist/packem_shared/index-B5zrpT20.js +6 -0
  22. package/dist/packem_shared/index.d-Br8HpP0A.d.ts +93 -0
  23. package/dist/packem_shared/isVisulimaError-jVZgumOU-C67qeq6-.js +1 -0
  24. package/dist/packem_shared/lazyNamed-DMUm8mZe.js +1 -0
  25. package/dist/packem_shared/plugin-manager.d-BSQtHbWS.d.ts +620 -0
  26. package/dist/packem_shared/renderError-DJiY-69l-s_7rEsoy.js +25 -0
  27. package/dist/packem_shared/runtime-process-hJz7FqPN.js +1 -0
  28. package/dist/plugins/error-handler-plugin.d.ts +21 -19
  29. package/dist/plugins/error-handler-plugin.js +1 -1
  30. package/dist/plugins/runtime-version-check-plugin.d.ts +22 -20
  31. package/dist/plugins/runtime-version-check-plugin.js +1 -1
  32. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +21 -8
  33. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
  34. package/dist/util/general/compile-cache.d.ts +41 -0
  35. package/dist/util/general/compile-cache.js +1 -0
  36. package/dist/util/general/heap-tuning.d.ts +18 -0
  37. package/dist/util/general/heap-tuning.js +1 -0
  38. package/package.json +32 -26
  39. package/dist/cli.d.ts +0 -203
  40. package/dist/constants.d.ts +0 -29
  41. package/dist/default-env.d.ts +0 -7
  42. package/dist/default-options.d.ts +0 -3
  43. package/dist/empty-toolbox.d.ts +0 -15
  44. package/dist/errors/cerebro-error.d.ts +0 -10
  45. package/dist/errors/command-not-found-error.d.ts +0 -9
  46. package/dist/errors/command-validation-error.d.ts +0 -10
  47. package/dist/errors/completion-error.d.ts +0 -9
  48. package/dist/errors/conflicting-options-error.d.ts +0 -10
  49. package/dist/errors/plugin-error.d.ts +0 -9
  50. package/dist/errors/update-notifier-error.d.ts +0 -7
  51. package/dist/packem_shared/Cerebro-aPZjbfzf.js +0 -4
  52. package/dist/packem_shared/VisulimaError-BJideSBf.js +0 -76
  53. package/dist/packem_shared/cerebro-error-BnJTixb2.js +0 -1
  54. package/dist/packem_shared/help-command-CIRIXN03.js +0 -1
  55. package/dist/packem_shared/index-DQ3pvLQH.js +0 -6
  56. package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +0 -1
  57. package/dist/packem_shared/renderError-ZMlMvw1N-eVUSdl6c.js +0 -24
  58. package/dist/packem_shared/runtime-process-G-n-wOub.js +0 -1
  59. package/dist/plugin-manager.d.ts +0 -53
  60. package/dist/plugins/update-notifier/cache.d.ts +0 -11
  61. package/dist/plugins/update-notifier/get-distribution-version.d.ts +0 -2
  62. package/dist/plugins/update-notifier/has-new-version.d.ts +0 -14
  63. package/dist/types/cli.d.ts +0 -102
  64. package/dist/types/command-line-usage.d.ts +0 -37
  65. package/dist/types/command.d.ts +0 -136
  66. package/dist/types/option-types.d.ts +0 -83
  67. package/dist/types/options.d.ts +0 -4
  68. package/dist/types/plugin.d.ts +0 -53
  69. package/dist/types/toolbox.d.ts +0 -96
  70. package/dist/util/arg-processing/get-boolean-values.d.ts +0 -7
  71. package/dist/util/arg-processing/get-parameter-option.d.ts +0 -7
  72. package/dist/util/arg-processing/map-option-type-label.d.ts +0 -3
  73. package/dist/util/arg-processing/option-is-boolean.d.ts +0 -9
  74. package/dist/util/arg-processing/remove-boolean-values.d.ts +0 -9
  75. package/dist/util/command-line-commands.d.ts +0 -10
  76. package/dist/util/command-line-usage/get-terminal-width.d.ts +0 -7
  77. package/dist/util/command-line-usage/index.d.ts +0 -3
  78. package/dist/util/command-line-usage/section/base-section.d.ts +0 -8
  79. package/dist/util/command-line-usage/section/content-section.d.ts +0 -65
  80. package/dist/util/command-line-usage/section/option-list-section.d.ts +0 -44
  81. package/dist/util/command-processing/command-processor.d.ts +0 -37
  82. package/dist/util/command-processing/command-validation.d.ts +0 -17
  83. package/dist/util/command-processing/nested-command-parser.d.ts +0 -25
  84. package/dist/util/command-processing/option-processor.d.ts +0 -44
  85. package/dist/util/data-processing/list-missing-arguments.d.ts +0 -15
  86. package/dist/util/data-processing/merge-arguments.d.ts +0 -7
  87. package/dist/util/general/find-alternatives.d.ts +0 -8
  88. package/dist/util/general/hide-bin.d.ts +0 -2
  89. package/dist/util/general/parse-raw-command.d.ts +0 -7
  90. package/dist/util/general/register-exception-handler.d.ts +0 -9
  91. package/dist/util/general/runtime-process.d.ts +0 -65
  92. package/dist/util/general/semver-gt.d.ts +0 -2
  93. package/dist/util/general/validate-input.d.ts +0 -24
  94. package/dist/util/process-env-variables.d.ts +0 -9
  95. package/dist/util/security.d.ts +0 -58
  96. 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
+ import a from"@visulima/pail/processor/caller";import m from"@visulima/pail/processor/message-formatter";import{createPail as l}from"@visulima/pail/server";import{VERBOSITY_DEBUG as p,VERBOSITY_QUIET as E}from"../packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{d as f}from"../packem_shared/runtime-process-hJz7FqPN.js";const T=o=>{const i={16:"informational",32:"informational",64:"trace",128:"debug",256:"debug"},t=[new m],r=f().CEREBRO_OUTPUT_LEVEL;(r===String(128)||r===String(p))&&t.push(new a);const n=(r&&i[r])??"informational",s={...o,logLevel:o?.logLevel??n,processors:o?.processors?[...t,...o.processors]:t},e=l(s);return r===String(E)&&e.disable(),e};export{T 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
+ import{createRequire as Qt}from"node:module";import{findCacheDirSync as rn}from"@visulima/find-cache-dir";import{t as on}from"../packem_shared/cerebro-error-etNTKvnJ.js";const Xt=Qt(import.meta.url),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,be=s=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[a,i]=q.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return q.getBuiltinModule(s)}return Xt(s)},{existsSync:ye,readFileSync:en,mkdirSync:tn,writeFileSync:nn}=be("node:fs"),{get:sn}=be("node:https"),$e=s=>{const[a,i]=s.split("-");return{nums:a.split(".").map(l=>Number.parseInt(l,10)||0),pre:i}},an=(s,a)=>{const i=$e(s),l=$e(a),h=Math.max(i.nums.length,l.nums.length);for(let $=0;$<h;$++){const b=i.nums[$]??0,y=l.nums[$]??0;if(b>y)return!0;if(b<y)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 $=0;$<d;$++){const b=m[$],y=x[$];if(b===void 0)return!1;if(y===void 0)return!0;if(b===y)continue;const S=Number.parseInt(b,10),T=Number.parseInt(y,10),L=!Number.isNaN(S)&&String(S)===b,A=!Number.isNaN(T)&&String(T)===y;return L&&A?S>T:L?!1:A?!0:b>y}return!1};var un=Object.defineProperty,X=(s,a)=>un(s,"name",{value:a,configurable:!0}),cn=Object.defineProperty,c=X((s,a)=>cn(s,"name",{value:a,configurable:!0}),"u$1");let ve=c(()=>{var s=(()=>{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,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of l(t))!h.call(e,r)&&r!==n&&a(e,r,{get:c(()=>t[r],"get"),enumerable:!(o=i(t,r))||o.enumerable});return e},"ae"),d=c(e=>x(a({},"__esModule",{value:!0}),e),"oe"),$={};m($,{zeptomatch:c(()=>xe,"zeptomatch")});var b=c(e=>{const t=new Set,n=[e];for(let o=0;o<n.length;o++){const r=n[o];if(t.has(r))continue;t.add(r);const{children:u}=r;if(u?.length)for(let f=0,g=u.length;f<g;f++)n.push(u[f])}return Array.from(t)},"M"),y=c(e=>{let t="";const n=b(e);for(let o=0,r=n.length;o<r;o++){const u=n[o];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"),S=c((e,t,n)=>{const o=n.get(e);if(o!==void 0)return o;const r=e.partial??t;let u="";if(e.regex&&(u+=r?"(?:$|":"",u+=e.regex.source),e.children?.length){const f=L(e.children.map(g=>S(g,t,n)).filter(Boolean));if(f?.length){const g=e.children.some(B=>!B.regex||!(B.partial??t)),w=f.length>1||r&&(!u.length||g);u+=w?r?"(?:$|":"(?:":"",u+=f.join("|"),u+=w?")":""}}return e.regex&&(u+=r?")":""),n.set(e,u),u},"O"),T=c((e,t)=>{const n=new Map,o=b(e);for(let r=o.length-1;r>=0;r--){const u=S(o[r],t,n);if(!(r>0))return u}return""},"ie"),L=c(e=>Array.from(new Set(e)),"ue"),A=c((e,t,n)=>A.compile(e,n).test(t),"R");A.compile=(e,t)=>{const n=t?.partial??!1,o=T(e,n),r=y(e);return new RegExp(`^(?:${o})$`,r)};var Oe=A,ke=c((e,t)=>{const n=Oe.compile(e,t),o=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(o,r)},"le"),Me=ke,Se=c(e=>{const t=e.map(o=>o.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Ae=Se,ee=c(e=>Array.isArray(e),"j"),P=c(e=>typeof e=="function","_"),Ce=c(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))})(),ze=c(e=>typeof e=="number","de"),Te=c(e=>typeof e=="object"&&e!==null,"xe"),Pe=c(e=>e instanceof RegExp,"me"),Ue=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Be=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),te=c(e=>typeof e=="string","A"),j=c(e=>e===void 0,"f"),Fe=c(e=>{const t=new Map;return n=>{const o=t.get(n);if(o!==void 0)return o;const r=e(n);return t.set(n,r),r}},"ye"),ne=c((e,t,n={})=>{const o={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=N(t)(o),u=Math.max(o.index,o.indexBacktrackMax);if(r&&o.index===e.length)return o.output;throw new Error(`Failed to parse at index ${u}`)},"I"),p=c((e,t)=>ee(e)?qe(e,t):te(e)?re(e,t):De(e,t),"i"),qe=c((e,t)=>{const n={};for(const o of e){if(o.length!==1)throw new Error(`Invalid character: "${o}"`);const r=o.charCodeAt(0);n[r]=!0}return o=>{const r=o.input;let u=o.index,f=u;for(;f<r.length&&r.charCodeAt(f)in n;)f+=1;if(f>u){if(!j(t)&&!o.options.silent){const g=r.slice(u,f),w=P(t)?t(g,r,`${u}`):t;j(w)||o.output.push(w)}o.index=f}return!0}},"we"),De=c((e,t)=>{if(Be(e))return re(e.source,t);{const n=e.source,o=e.flags.replace(/y|$/,"y"),r=new RegExp(n,o);return Ue(e)&&P(t)&&!Ie(t)?Ze(r,t):Le(r,t)}},"$e"),Ze=c((e,t)=>n=>{const o=n.index,r=n.input;e.lastIndex=o;const u=e.exec(r);if(u){const f=e.lastIndex;if(!n.options.silent){const g=t(...u,r,`${o}`);j(g)||n.output.push(g)}return n.index=f,!0}else return!1},"Ee"),Le=c((e,t)=>n=>{const o=n.index,r=n.input;if(e.lastIndex=o,e.test(r)){const u=e.lastIndex;if(!j(t)&&!n.options.silent){const f=P(t)?t(r.slice(o,u),r,`${o}`):t;j(f)||n.output.push(f)}return n.index=u,!0}else return!1},"Ce"),re=c((e,t)=>n=>{const o=n.index,r=n.input;if(r.startsWith(e,o)){if(!j(t)&&!n.options.silent){const u=P(t)?t(e,r,`${o}`):t;j(u)||n.output.push(u)}return n.index+=e.length,!0}else return!1},"F"),V=c((e,t,n,o)=>{const r=N(e),u=t>1;return J(H(se(f=>{let g=0;for(;g<n;){const w=f.index;if(!r(f)||(g+=1,f.index===w))break}return g>=t},u),o))},"k"),oe=c((e,t)=>V(e,0,1,t),"L"),W=c((e,t)=>V(e,0,1/0,t),"$"),We=c((e,t)=>V(e,1,1/0,t),"Re"),C=c((e,t)=>{const n=e.map(N);return J(H(se(o=>{for(let r=0,u=n.length;r<u;r++)if(!n[r](o))return!1;return!0}),t))},"x"),R=c((e,t)=>{const n=e.map(N);return J(H(o=>{for(let r=0,u=n.length;r<u;r++)if(n[r](o))return!0;return!1},t))},"p"),se=c((e,t=!0,n=!1)=>{const o=N(e);return t?r=>{const u=r.index,f=r.output.length,g=o(r);return!g&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!g||n)&&(r.index=u,r.output.length!==f&&(r.output.length=f)),g}:o},"q"),H=c((e,t)=>{const n=N(e);return t?o=>{if(o.options.silent)return n(o);const r=o.output.length;if(n(o)){const u=o.output.splice(r,1/0),f=t(u);return j(f)||o.output.push(f),!0}else return!1}:n},"B"),J=(()=>{let e=0;return t=>{const n=N(t),o=e+=1;return r=>{var u;if(r.options.memoization===!1)return n(r);const f=r.index,g=(u=r.cache)[o]||(u[o]={indexMax:-1,queue:[]}),w=g.queue;if(f<=g.indexMax){const F=g.store||(g.store=new Map);if(w.length){for(let z=0,Gt=w.length;z<Gt;z+=2){const Yt=w[z*2],Kt=w[z*2+1];F.set(Yt,Kt)}w.length=0}const E=F.get(f);if(E===!1)return!1;if(ze(E))return r.index=E,!0;if(E)return r.index=E.index,E.output?.length&&r.output.push(...E.output),!0}const B=r.output.length,Jt=n(r);if(g.indexMax=Math.max(g.indexMax,f),Jt){const F=r.index,E=r.output.length;if(E>B){const z=r.output.slice(B,E);w.push(f,{index:F,output:z})}else w.push(f,F);return!0}else return w.push(f,!1),!1}}})(),ae=c(e=>{let t;return n=>(t||(t=N(e())),t(n))},"G"),N=Fe(e=>{if(P(e))return Ce(e)?ae(e):e;if(te(e)||Pe(e))return p(e);if(ee(e))return C(e);if(Te(e))return R(Object.values(e));throw new Error("Invalid rule")}),k=c(e=>e,"d"),Ve=c(e=>typeof e=="string","ke"),He=c(e=>{const t=new WeakMap,n=new WeakMap;return(o,r)=>{const u=r?.partial?n:t,f=u.get(o);if(f!==void 0)return f;const g=e(o,r);return u.set(o,g),g}},"Be"),Je=c(e=>{const t={},n={};return(o,r)=>{const u=r?.partial?n:t;return u[o]??(u[o]=e(o,r))}},"Pe"),Ge=p(/\\./,k),Ye=p(/./,k),Ke=p(/\*\*\*+/,"*"),Qe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),Xe=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),et=W(R([Ge,Ke,Qe,Xe,Ye])),tt=et,nt=c(e=>ne(e,tt,{memoization:!1}).join(""),"Ie"),rt=nt,ie="abcdefghijklmnopqrstuvwxyz",ot=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ie[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ue=c(e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t=t*26+ie.indexOf(e[n])+1;return t},"V"),G=c((e,t)=>{if(t<e)return G(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),st=c((e,t,n)=>G(e,t).map(o=>String(o).padStart(n,"0")),"qe"),ce=c((e,t)=>G(ue(e),ue(t)).map(ot),"W"),v=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),U=c(e=>({children:e}),"y"),I=(()=>{const e=c((t,n,o)=>{if(o.has(t))return;o.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let u=0,f=r.length;u<f;u++)e(r[u],n,o)},"e");return t=>{if(!t.length)return U([]);for(let n=t.length-1;n>=1;n--){const o=new Set,r=t[n-1],u=t[n];e(r,u,o)}return t[0]}})(),O=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),at=p(/\\./,v),it=p(/[$.*+?^(){}[\]\|]/,e=>v(`\\${e}`)),ut=p(/[\\\/]/,O),ct=p(/[^$.*+?^(){}[\]\|\\\/]+/,v),lt=p(/^(?:!!)*!(.*)$/,(e,t)=>v(`(?!^${xe.compile(t).source}$).*?`)),ft=p(/^(!!)+/),pt=R([lt,ft]),dt=p(/\/(\*\*\/)+/,()=>U([I([O(),v(".+?"),O()]),O()])),gt=p(/^(\*\*\/)+/,()=>U([v("^"),I([v(".*?"),O()])])),ht=p(/\/(\*\*)$/,()=>U([I([O(),v(".*?")]),v("$")])),mt=p(/\*\*/,()=>v(".*?")),le=R([dt,gt,ht,mt]),xt=p(/\*\/(?!\*\*\/|\*$)/,()=>I([v("[^\\\\/]*?"),O()])),$t=p(/\*/,()=>v("[^\\\\/]*")),fe=R([xt,$t]),pe=p("?",()=>v("[^\\\\/]")),vt=p("[",k),wt=p("]",k),bt=p(/[!^]/,"^\\\\/"),yt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,k),_t=p(/\\./,k),Rt=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),jt=p(/[^$.*+?^(){}[\]\|\\\/]+/,k),Nt=R([_t,Rt,Et,yt,jt]),de=C([vt,oe(bt),W(Nt),wt],e=>v(e.join(""))),Ot=p("{","(?:"),kt=p("}",")"),Mt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>st(+t,+n,Math.min(t.length,n.length)).join("|")),St=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),At=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ct=R([Mt,St,At]),ge=C([Ot,Ct,kt],e=>v(e.join(""))),It=p("{"),zt=p("}"),Tt=p(","),Pt=p(/\\./,v),Ut=p(/[$.*+?^(){[\]\|]/,e=>v(`\\${e}`)),Bt=p(/[\\\/]/,O),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,v),qt=ae(()=>me),Dt=p("",()=>v("(?:)")),Zt=We(R([le,fe,pe,de,ge,qt,Pt,Ut,Bt,Ft]),I),he=R([Zt,Dt]),me=C([It,oe(C([he,W(C([Tt,he]))])),zt],U),Lt=W(R([pt,le,fe,pe,de,ge,me,at,it,ut,ct]),I),Wt=Lt,Vt=c(e=>ne(e,Wt,{memoization:!1})[0],"kr"),Ht=Vt,Y=c((e,t,n)=>Y.compile(e,n).test(t),"N");Y.compile=(()=>{const e=Je((n,o)=>Me(Ht(rt(n)),o)),t=He((n,o)=>Ae(n.map(r=>e(r,o))));return(n,o)=>Ve(n)?e(n,o):t(n,o)})();var xe=Y;return d($)})();return s.default||s},"_lazyMatch"),K;const ln=c((s,a)=>(K||(K=ve(),ve=null),K(s,a)),"default");var fn=Object.defineProperty,pn=X((s,a)=>fn(s,"name",{value:a,configurable:!0}),"t$1");const dn=/^[A-Z]:\//i,M=pn((s="")=>s&&s.replaceAll("\\","/").replace(dn,a=>a.toUpperCase()),"normalizeWindowsPath");var gn=Object.defineProperty,_=X((s,a)=>gn(s,"name",{value:a,configurable:!0}),"r");const hn=/^[/\\]{2}/,mn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,_e=/^[A-Z]:$/i,we=/^\/([A-Z]:)?$/i,xn=/.(\.[^./]+)$/,$n=/^[/\\]|^[a-z]:[/\\]/i,vn=/\/$/,wn=_(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Re=_((s,a)=>{let i="",l=0,h=-1,m=0,x;for(let d=0;d<=s.length;++d){if(d<s.length)x=s[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 $=i.lastIndexOf("/");$===-1?(i="",l=0):(i=i.slice(0,$),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+=`/${s.slice(h+1,d)}`:i=s.slice(h+1,d),l=d-h-1;h=d,m=0}else x==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),Z=_(s=>mn.test(s),"isAbsolute"),Ee=_(function(s){if(s.length===0)return".";s=M(s);const a=hn.exec(s),i=Z(s),l=s.at(-1)==="/";return s=Re(s,!i),s.length===0?i?"/":l?"./":".":(l&&(s+="/"),_e.test(s)&&(s+="/"),a?i?`//${s}`:`//./${s}`:i&&!Z(s)?`/${s}`:s)},"normalize"),bn=_((...s)=>{let a="";for(const i of s)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 Ee(a)},"join"),Q=_(function(...s){s=s.map(l=>M(l));let a="",i=!1;for(let l=s.length-1;l>=-1&&!i;l--){const h=l>=0?s[l]:wn();!h||h.length===0||(a=`${h}/${a}`,i=Z(h))}return a=Re(a,!i),i&&!Z(a)?`/${a}`:a.length>0?a:"."},"resolve");_(function(s){return M(s)},"toNamespacedPath");const yn=_(function(s){return xn.exec(M(s))?.[1]??""},"extname");_(function(s,a){const i=Q(s).replace(we,"$1").split("/"),l=Q(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 je=_(s=>{const a=M(s).replace(vn,"").split("/").slice(0,-1);return a.length===1&&_e.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(Z(s)?"/":".")},"dirname");_(function(s){const a=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return M(s.root?Q(...a):a.join("/"))},"format");const _n=_((s,a)=>{const i=M(s).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");_(function(s){const a=$n.exec(s)?.[0]?.replaceAll("\\","/")??"",i=_n(s),l=yn(i);return{base:i,dir:je(s),ext:l,name:i.slice(0,i.length-l.length),root:a}},"parse");_((s,a)=>ln(a,Ee(s)),"matchesGlob");let D=class extends on{constructor(a,i="UPDATE_NOTIFIER_ERROR",l){super(a,i,l),this.name="UpdateNotifierError"}};const Rn="last-update-check.json",Ne=s=>{const a=rn(s);if(a===void 0)throw new D("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:s});return bn(a,Rn)},En=s=>{const a=Ne(s);try{if(!ye(a))return;const{lastUpdateCheck:i}=JSON.parse(en(a,"utf8"));return i}catch{return}},jn=s=>{const a=Ne(s),i=je(a);ye(i)||tn(i,{recursive:!0}),nn(a,JSON.stringify({lastUpdateCheck:Date.now()}))},Nn=async(s,a,i)=>{const l=i.replace("__NAME__",s),h=512*1024;return await new Promise((m,x)=>{sn(l,d=>{if(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)){x(new D(`Unexpected status code ${String(d.statusCode)}`,"VERSION_FETCH_ERROR",{distributionTag:a,packageName:s})),d.resume();return}let $="",b=!1;d.on("data",y=>{b||($+=String(y),$.length>h&&(b=!0,x(new D("Response too large","VERSION_FETCH_ERROR",{distributionTag:a,packageName:s})),d.destroy()))}),d.on("end",()=>{if(!b)try{const y=JSON.parse($)[a];if(!y){x(new D("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:s}));return}m(y)}catch{x(new D("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:s}))}})}).on("error",d=>{x(d)})})},An=async({alwaysRun:s,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=En(l.name);if(s||!x||x<Date.now()-m){const d=await Nn(l.name,i,h);if(jn(l.name),an(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.`)};export{An as default};
@@ -0,0 +1,4 @@
1
+ import{createRequire as lt}from"node:module";import{VERBOSITY_DEBUG as q,POSITIONALS_KEY as te,VERBOSITY_QUIET as gt,VERBOSITY_VERBOSE as wt,VERBOSITY_NORMAL as ve}from"./VERBOSITY_QUIET-XPultrIA.js";import{t as A}from"./cerebro-error-etNTKvnJ.js";import{d as j,f as me,o as be,e as G,b as yt,c as vt,g as bt,h as $t,i as Ot}from"./runtime-process-hJz7FqPN.js";import{E as ie}from"./isVisulimaError-jVZgumOU-C67qeq6-.js";import{distance as At}from"fastest-levenshtein";import{Y as Ct,h as _t,k as ne,n as B,H as W,J as L,T as re,j as $e,_ as Oe,q as kt,C as Ae,A as xt,f as Ne,z as Ce,G as _e,L as It,b as Lt,K as Et,O as Pt,D as Ut,V as Mt,W as Dt,N as Tt,U as Vt,X as St,I as jt,Z as Bt,P as Rt,M as zt,v as Wt,Q as Ft}from"./constants-CImsldtV-Ces7vzH9.js";const ct=lt(import.meta.url),J=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ze=t=>{if(typeof J<"u"&&J.versions&&J.versions.node){const[e,n]=J.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return J.getBuiltinModule(t)}return ct(t)},{writeFile:ut,stat:ht,rm:pt,readFile:ye,readdir:ft,mkdir:dt,access:mt}=ze("node:fs/promises"),{createRequire:Nt}=ze("node:module"),X=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let T=class extends A{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(", ")}`)}},We=class extends A{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}`}},qt=class extends A{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)}},Gt=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);j().CEREBRO_OUTPUT_LEVEL===String(q)&&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(s){const o=new qt(i.name,`Failed to initialize: ${s instanceof Error?s.message:String(s)}`,s instanceof Error?s: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 s=this.getDependencyOrder();for(const o of s){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(r){throw this.logger.error(`Error in ${e} hook for plugin "${o.name}":`,r),r}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const i=this.getDependencyOrder();for(const s of i)if(typeof s.onError=="function"){this.logger.debug(`executing error handler for plugin: ${s.name}`);try{await s.onError(e,n)}catch(o){this.logger.error(`Error in error handler for plugin "${s.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,s=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 r of c.dependencies)s(r);i.delete(o),n.add(o),e.push(c)};for(const o of this.plugins.keys())s(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`)}}};const Z=t=>t.type?.name==="Boolean",Kt=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},ke=t=>(Z(t)||(t.typeLabel=t.typeLabel??Kt(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Ht=new RegExp(/^-([^\d-])$/),Yt=new RegExp(/^--(\S+)/),Jt=new RegExp(/^-([^\d-]{2,})$/),Qt=t=>Ht.test(t)||Yt.test(t)||Jt.test(t),Zt=(t,e)=>{const n=e[0]&&Qt(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}};var Xt=Object.defineProperty,Fe=(t,e)=>Xt(t,"name",{value:e,configurable:!0}),en=Object.defineProperty,tn=Fe((t,e)=>en(t,"name",{value:e,configurable:!0}),"i");let nn=class qe extends ie{static{Fe(this,"t")}static{tn(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,qe.prototype)}};var on=Object.defineProperty,Ge=(t,e)=>on(t,"name",{value:e,configurable:!0}),sn=Object.defineProperty,an=Ge((t,e)=>sn(t,"name",{value:e,configurable:!0}),"e");class oe extends ie{static{Ge(this,"o")}static{an(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,oe.prototype)}}var rn=Object.defineProperty,Ke=(t,e)=>rn(t,"name",{value:e,configurable:!0}),ln=Object.defineProperty,cn=Ke((t,e)=>ln(t,"name",{value:e,configurable:!0}),"o");let un=class He extends ie{static{Ke(this,"e")}static{cn(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,He.prototype)}};var hn=Object.defineProperty,Ye=(t,e)=>hn(t,"name",{value:e,configurable:!0}),pn=Object.defineProperty,fn=Ye((t,e)=>pn(t,"name",{value:e,configurable:!0}),"i");let E=class Je extends ie{static{Ye(this,"e")}static{fn(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,Je.prototype)}};var dn=Object.defineProperty,H=(t,e)=>dn(t,"name",{value:e,configurable:!0}),mn=Object.defineProperty,se=H((t,e)=>mn(t,"name",{value:e,configurable:!0}),"o");const xe=se(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Ie=se(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Le=se(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),gn=se((t,e)=>Array.isArray(t)?xe(e)?t.map(Boolean):Ie(e)?t.map(Number):Le(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:xe(e)?!!t:Ie(e)?Number(t):Le(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var wn=Object.defineProperty,yn=H((t,e)=>wn(t,"name",{value:e,configurable:!0}),"e");const x=yn((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var vn=Object.defineProperty,z=H((t,e)=>vn(t,"name",{value:e,configurable:!0}),"x$2");const bn=/-([a-z])/g,$n=/^\d+$/,le=z(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),On=z(t=>t.codePointAt(0)===95,"isSpecialKey"),Ee=z((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),Pe=z(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ue=z((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"),An=z((t,e,n,i,s)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??s?.get(c)}return o},"getDefinition"),Nn=z((t,e,n,i)=>{const s=n.debug??!1;x(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(s,"Starting argument resolution","resolver"),x(s,"Tokens:","resolver",t),x(s,"Definitions:","resolver",e),x(s,"Processing tokens...","resolver");const o=new Map,c=new Map,r=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 h of e)if(o.set(h.name,h),h.alias&&c.set(h.alias,h),n.caseInsensitive&&r&&(r.set(h.name.toLowerCase(),h),h.alias&&g&&g.set(h.alias.toLowerCase(),h)),n.camelCase&&a&&u){const m=h.name.replaceAll(bn,(w,$)=>$.toUpperCase());a.set(h.name,m),u.set(m,h.name)}const f={},l={},d=[],p=[],v=new Set;let b=!1;const y=e.find(h=>h.defaultOption),N=e.some(h=>h.group),C=e.some(h=>h.type===Number);for(let h=0;h<t.length;h++){const m=t[h];if(m.kind==="option-terminator"){f._unknown=i.slice(m.index),b=!0;break}if(m.kind==="option"&&m.name){let w=An(m.name,o,c,r,g);if(!w&&m.value===void 0&&C&&$n.test(m.name)){const _=e.find(U=>U.type===Number);_&&(w=_,m.value=m.name,m.name=_.name)}const $=w?w.name:m.name,O=w?.multiple,P=w?.lazyMultiple;if(l[$]!==void 0&&!O&&!P&&!n.partial)throw new nn($);if(!w&&n.partial){const _=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;d.push({index:m.index,value:_});continue}if(!w&&n.stopAtFirstUnknown){f._unknown=i.slice(m.index);break}if(!w&&!n.partial)throw new oe(m.name);if(m.value===void 0){const _=t[h+1],U=_?.kind==="option"&&!("name"in _)&&_.value!==void 0,I=_&&w&&!(w.type&&le(w.type))&&(_.kind==="positional"||U),rt=w&&w.defaultOption&&!w.multiple&&!w.lazyMultiple;if(I&&(!w?.defaultOption||rt))if(O){let M=h+1;const ae=[];for(;M<t.length&&(t[M].kind==="positional"||t[M].kind==="option"&&!("name"in t[M])&&t[M].value!==void 0);)ae.push(t[M].value),v.add(t[M].index),M++;l[$]=l[$]===void 0?ae:Ee(l[$],ae),h=M-1}else P?(Ue(l,$,_.value,!0),v.add(_.index),h++):(l[$]=_.value,v.add(_.index),h++);else w?.type&&le(w.type)?Ue(l,$,!0,O):l[$]=O?[]:null}else{let{value:_}=m;if(w?.type&&le(w.type))switch(_){case"":{if(n.partial){l._unknown??=[];const I=`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`;l._unknown.push(I),p.push({index:m.index,value:I}),_=!0}else throw new oe(m.name);break}case"false":{_=!1;break}case"true":{_=!0;break}default:_=!0}const U=[_];if(O){let I=h+1;for(;I<t.length&&t[I].kind==="positional";)U.push(t[I].value),v.add(t[I].index),I++;h=I-1}l[$]===void 0?l[$]=O||P?U:_:O||P?l[$]=Ee(l[$],U):l[$]=_}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!v.has(m.index)&&!y){x(s,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),f._unknown=i.slice(m.index);break}}for(const[h,m]of Object.entries(l)){const w=o.get(h);w&&(w.multiple||w.lazyMultiple)&&!Array.isArray(m)&&(l[h]=[m])}let k=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const h of t)if(h.kind==="option"&&!o.has(h.name??"")&&!c.has(h.name??"")&&(!n.caseInsensitive||!r?.has(h.name?.toLowerCase()??"")&&!g?.has(h.name?.toLowerCase()??""))){k=h.index;break}}if(y){const h=[],m=[];for(const w of t)w.kind==="positional"&&!v.has(w.index)&&w.index<k&&(h.push(w.value),m.push(w));if(h.length>0){const w=l[y.name],$=y.multiple??y.lazyMultiple;w===void 0?$?(m.forEach(O=>v.add(O.index)),l[y.name]=h):(v.add(m[0].index),l[y.name]=h[0]):$&&(m.forEach(O=>v.add(O.index)),l[y.name]=Array.isArray(w)?[...h,...w]:[...h,w])}}if(!n.partial){for(const h of t)if(h.kind==="positional"&&!v.has(h.index))throw new un(i[h.index])}if(n.partial&&!n.stopAtFirstUnknown){const h=[...d];if(l._unknown)for(const m of p)h.push({index:m.index,value:m.value});for(const m of t)m.kind==="positional"&&!v.has(m.index)&&h.push({index:m.index,value:i[m.index]});h.length>0&&(h.sort((m,w)=>m.index-w.index),f._unknown=h.map(m=>m.value))}if(n.stopAtFirstUnknown&&!b){const h=t.findIndex($=>$.kind==="option"&&!o.has($.name??"")&&!c.has($.name??"")&&(!n.caseInsensitive||!r?.has($.name?.toLowerCase()??"")&&!g?.has($.name?.toLowerCase()??""))),m=t.findIndex($=>$.kind==="positional"&&!v.has($.index));let w=-1;if(h!==-1&&m!==-1?w=Math.min(h,m):h!==-1?w=h:m!==-1&&(w=m),w>=0){const $=t[w].index;f._unknown=i.slice($)}}else d.length>0&&!n.partial&&(f._unknown=d.map(h=>h.value));for(const[h,m]of Object.entries(l)){const w=n.camelCase?a?.get(h)??h:h,$=o.get(h);f[w]=$?.type?gn(m,$.type):m===void 0?null:m}for(const h of e){const m=n.camelCase?a?.get(h.name)??h.name:h.name;!(m in f)&&h.defaultValue!==void 0&&(h.multiple??h.lazyMultiple?f[m]=Array.isArray(h.defaultValue)?[...h.defaultValue]:[h.defaultValue]:f[m]=h.defaultValue)}if(N){const h={},m={},w={};for(const O of e)if(O.group){const P=Array.isArray(O.group)?O.group:[O.group];for(const _ of P)Pe(_)||(h[_]??={})}for(const O of Object.keys(f))if(!On(O)){m[O]=f[O];let P=O;n.camelCase&&(P=u?.get(O)??O);const _=o.get(P);if(_?.group){const U=Array.isArray(_.group)?_.group:[_.group];for(const I of U)Pe(I)||h[I]&&(h[I][O]=f[O])}else w[O]=f[O]}const $={_all:m};for(const[O,P]of Object.entries(h))$[O]=P;Object.keys(w).length>0&&($._none=w),f._unknown&&($._unknown=f._unknown),Object.keys(f).forEach(O=>delete f[O]),Object.assign(f,$)}return x(s,"Final parsed result:","resolver",f),f},"resolveArgs");var Cn=Object.defineProperty,Y=H((t,e)=>Cn(t,"name",{value:e,configurable:!0}),"l");const K="-".codePointAt(0),R="=",_n=R.codePointAt(0),kn="--",xn="-",In="--",Qe=Y(t=>t.length>2&&t.startsWith(In),"hasLongOptionPrefix"),Ln=Y(t=>Qe(t)&&!t.includes(R,3),"isLongOption"),En=Y(t=>Qe(t)&&t.includes(R,3),"isLongOptionAndValue"),Pn=Y(t=>{if(t.length!==2||t.codePointAt(0)!==K||t.codePointAt(1)===K)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),Un=Y(t=>!(t.length<=2||t.codePointAt(0)!==K||t.codePointAt(1)===K),"isShortOptionGroup"),Mn=Y(t=>{const e=[],n=[...t];let i=-1,s=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;if(s>0?s--:i++,o===kn){e.push({index:i,kind:"option-terminator"});const c=n.map((r,g)=>({index:i+g+1,kind:"positional",value:r}));e.push(...c),i+=n.length;break}if(Pn(o)){const c=o.charAt(1);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(Un(o)&&!o.includes(R)){const c=[];let r="",g=!1;for(let a=1;a<o.length;a++){const u=o.charAt(a);g?r+=u:u.codePointAt(0)===_n?g=!0:c.push(`${xn}${u}`)}if(g)if(c.length>0){const a=c.pop();c.push(`${a}=${r}`)}else c.push(r);n.unshift(...c),s=c.length;continue}if(Ln(o)){const c=o.slice(2);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(En(o)){const c=o.indexOf(R),r=o.slice(2,c),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:o,value:g});continue}if(o.length>2&&o.codePointAt(0)===K&&o.codePointAt(1)!==K&&o.includes(R)){const c=o.indexOf(R),r=o.charAt(1),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:o,value:g});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var Dn=Object.defineProperty,we=H((t,e)=>Dn(t,"name",{value:e,configurable:!0}),"d");const Tn=/\d/,Vn=we(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Sn=we(t=>typeof t=="function","isValidCustomTypeFunction"),jn=we((t,e,n)=>{const i=n?.debug??!1;x(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,o=new Set,c=new Set,r=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 E("Invalid option definition: name is required");if(typeof a.name!="string")throw new E("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new E("Invalid option definition: name cannot be empty");const u=e?a.name.toLowerCase():"";if(s.has(a.name)||e&&c.has(u))throw new E(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&r.has(u))throw new E(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(s.add(a.name),e&&c.add(u),a.alias!==void 0){if(typeof a.alias!="string")throw new E("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new E("Invalid option definition: alias must be a single character");if(Tn.test(a.alias))throw new E("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new E('Invalid option definition: alias cannot be "-"');const f=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&r.has(f))throw new E(`Invalid option definition: duplicate alias '${a.alias}'`);if(s.has(a.alias)||e&&c.has(f))throw new E(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&r.add(f)}if(a.defaultOption&&(g++,a.type!==void 0&&Vn(a.type)))throw new E("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"&&Sn(a.type)))throw new E("Invalid option definition: invalid type")}if(g>1)throw x(i,"Validation failed: multiple defaultOptions not allowed","validation"),new E("Invalid option definition: multiple defaultOptions not allowed");x(i,"Validation completed successfully","validation")},"validateDefinitions");var Bn=Object.defineProperty,Rn=H((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"O");const zn=Rn((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 s=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",s),jn(s,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("="),f=(u===-1?a.slice(2):a.slice(2,u)).toLowerCase();return u===-1?`--${f}`:`--${f}${a.slice(u)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const u=a.slice(1).split("=",2),f=u[0],l=u[1];if(!f)return a;const d=f.toLowerCase();return l===void 0?`-${d}`:`-${d}=${l}`}return a}));const r=Mn(c.map(String));x(n,"Tokenized arguments:","index",r);const g=Nn(r,s,i,o);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");class Wn{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let ce=class extends A{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)}};const Fn=/^-{1,2}(\w+)(=(.+))?$/,Ze=(t,e,n,i)=>{const s=Fn.exec(t);if(s===null)return{};const o=s[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(r=>r.name===o||r.alias===o);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},Me=(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)},qn=new Set(["0","1","false","true"]),Gn=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:r,argValue:g,option:a}=Ze(c,e,n,i),{lastOption:u}=o;return a&&Z(a)&&g&&r?o.partial[r]=Me(g,a):o.lastName&&u&&Z(u)&&qn.has(c)&&(o.partial[o.lastName]=Me(c,u)),{lastName:r,lastOption:a,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},Kn=new Set(["0","1","false","true"]),Hn=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:r,option:g}=Ze(c,e,n,i),{lastOption:a}=o;if(a&&Z(a)&&Kn.has(c)){const{args:u}=o;return{args:u.slice(0,-1)}}return g&&Z(g)&&r?{args:o.args}:{args:[...o.args,c],lastOption:g}};return t.reduce(s,{args:[]}).args},De=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()]},Yn=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},Jn=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Yn(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)}},Qn=/_./g,Zn=/^[A-Z]/,Xn=t=>t.toLowerCase().replaceAll(Qn,e=>e[1]?.toUpperCase()??e).replace(Zn,e=>e.toLowerCase()),eo=t=>{if(!t||t.length===0)return{};const e={},n=j();for(const i of t){const s=n[i.name],o=Jn(i,s),c=o===void 0?i.defaultValue:o,r=Xn(i.name);e[r]=c}return e},to=t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const s=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of s)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},Xe=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ce(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new ce(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new ce(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},no=(t,e,n,i)=>{const s=new Wn(t.name,t),{_all:o,_unknown:c,positionals:r}=e,g=Object.keys(n).length>0?{...o,...n}:o;te in g&&delete g[te],s.argument=r?.[te]??[],s.rawUnknown=[...c??[]];const a=Object.keys(i).length>0;return s.options=a?{...g,...i}:g,s.env=eo(t.env),s},oo=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=De(s?[...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:te,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,r;if(s){const{optionMapByAlias:a,optionMapByName:u}=to(i);c=Hn(e,i,u,a),r=Gn(e,i,u,a)}else c=e,r={};const g=zn(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:r,parsedArgs:g}},F=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Xe(t))(e);let io=class extends A{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(", ")}`}};const Te=(t,e,n=!1)=>{const i=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}i.push(s)}return i},so=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:At(t,e)<=t.length/3,S=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>so(i.toLowerCase(),n))},ao=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const s=i.startsWith("--");let o=`Found unknown ${s?"option":"argument"} "${i}"`;if(s){const c=S(i.replace("--",""),(e.options??[]).map(r=>r.name));if(c.length>0){const[r,...g]=c.map(a=>`--${a}`);o+=g.length>0?`, did you mean ${r??""} or ${g.join(", ")}?`:`, did you mean ${r??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
2
+ `))},ro=(t,e,n)=>{const i=n.__requiredOptions__,s=i?Te(i,e,!0):Te(t,e,!1);if(s.length>0)throw new io(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&ao(e,n)},lo=(t,e,n)=>{const i=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(i.length>0){const s=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(s)throw new We(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},co=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const o=e.get(s.name)??[];o.push(s),e.set(s.name,o)}if(typeof s.alias=="string"&&s.alias.length>0){const o=n.get(s.alias)??[];o.push(s),n.set(s.alias,o)}else if(Array.isArray(s.alias)){for(const o of s.alias)if(o.length>0){const c=n.get(o)??[];c.push(s),n.set(o,c)}}}const i=[];for(const[s,o]of e)o.length>1&&i.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[s,o]of n)o.length>1&&i.push(`Duplicate option alias "-${s}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
3
+ `))},uo=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let s=1;s<=e.length;s+=1){const o=e[s-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:s})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},V=t=>t.join(" "),Ve=(t,e)=>e&&e.length>0?[...e,t]:[t];class ho{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}}const po=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),fo=Nt(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mo=t=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[e,n]=Q.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Q.getBuiltinModule(t)}return fo(t)},{stripVTControlCharacters:go}=mo("node:util"),ue=new ho(1e3),wo=/[.*+?^${}()|[\]\\]/g,yo=t=>{const e=t.join("");if(ue.has(e)){const s=ue.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(wo,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return ue.set(e,i),i},vo=t=>{const e=[];let n=0,i;for(B.lastIndex=0;(i=B.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=B.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},bo=/[ČŠŽĐ]/i,et=new Uint8Array(128),tt=new Uint8Array(128),nt=new Uint8Array(128);for(let t=0;t<128;t++)et[t]=t>=65&&t<=90?1:0,tt[t]=t>=97&&t<=122?1:0,nt[t]=t>=48&&t<=57?1:0;const he=t=>et[t],Se=t=>tt[t],pe=t=>nt[t],D=(t,e,n,i,s)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const d of c)if(d(t[0])){o=!0;break}if(!o&&!n)return[t];const r=[...t],g=[];let a=r[0],u="other";const f=Object.entries(e);for(const d of f){const[p,v]=d;if(v(r[0])){u=p;break}}let l=n&&i?r[0]===r[0].toLocaleUpperCase(i):!1;for(let d=1;d<r.length;d++){const p=r[d];let v="other";for(const N of f){const[C,k]=N;if(k(p)){v=C;break}}const b=n&&i?p===p.toLocaleUpperCase(i):!1;let y=!1;s?y=s(u,v,l,b,p,d,r):(u!==v&&u!=="other"&&v!=="other"&&(y=!0),n&&v!=="other"&&!l&&b&&(y=!0)),y?(g.push(a),a=p):a+=p,u=v,n&&(l=b)}return a&&a.length>0&&g.push(a),g.length>0?g:[t]},$o=(t,e,n,i)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return i.push(s),e+s.length;return e},ot=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],s=t.length;for(let o=1;o<s;o++){const c=$o(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const r=t.codePointAt(o-1),g=t.codePointAt(o),a=r&&r<128&&he(r),u=g&&g<128&&he(g),f=r&&r<128&&Se(r),l=r&&r<128&&pe(r),d=g&&g<128&&pe(g);if(f&&u){i.push(t.slice(n,o)),n=o;continue}if(l&&!d||!l&&d){i.push(t.slice(n,o)),n=o;continue}if(d&&!l){let p=!1,v=!1;if(o+1<s){const b=t.codePointAt(o+1);p=b&&b<128&&he(b),v=b&&b<128&&pe(b)}if(!v&&p){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const p=t.codePointAt(o+1),v=p&&p<128&&Se(p);if(a&&u&&v){const b=t.slice(n,o+1);e.has(b)||(i.push(t.slice(n,o)),n=o)}}}return n<s&&i.push(t.slice(n)),i.filter(o=>o!=="")},it=(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,f=[];let l=a[0],d=a[0]===a[0].toLocaleUpperCase(e),p=d,v=d?0:-1;for(let b=1;b<u;b++){const y=a[b],N=y===y.toLocaleUpperCase(e);if(N===d)l+=y;else if(N)l&&l.length>0&&(f.push(l),l=y),p=!0,v=b;else{if(p&&b-v>1){const C=a[b-1],k=l.slice(0,-1);k&&k.length>0&&f.push(k),l=C+y}else l+=y;p=!1,v=-1}d=N}return l&&l.length>0&&f.push(l),f}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!L.test(t))return[t];const a=[...t],u=a.length,f=[];let l=a[0];const d=a[0];let p;W.test(d)?p=1:L.test(d)?p=2:p=0;let v=d===d.toLocaleUpperCase(e);for(let y=1;y<u;y++){const N=a[y];let C;W.test(N)?C=1:L.test(N)?C=2:C=0;const k=N===N.toLocaleUpperCase(e);p!==C&&(p===1||p===2)&&(C===1||C===2)||C===p&&!v&&k?(f.push(l),l=N):l+=N,p=C,v=k}l&&l.length>0&&f.push(l);const b=[];for(let y=0;y<f.length;y++)y<f.length-1&&f[y].length===1&&L.test(f[y])&&W.test(f[y+1][0])?(b.push(f[y]+f[y+1]),y+=1):b.push(f[y]);return b}if(e.startsWith("el")){if(!re.test(t)&&!L.test(t))return[t];const a=[];$e.lastIndex=0;let u;for(;(u=$e.exec(t))!==null;)a.push(u[0]);a.length===0&&a.push(t);const f=[];if(a.length===1){const l=a[0];if(!l||!re.test(l[0])||l.length===1)return[l??t]}for(const l of a){if(!l)continue;if(!re.test(l[0])||l.length===1){f.push(l);continue}const d=l.length;let p=l[0],v=l[0]===l[0].toLocaleUpperCase(e);for(let b=1;b<d;b++){const y=l[b],N=y===y.toLocaleUpperCase(e);!v&&N?(f.push(p),p=y):p+=y,v=N}p&&f.push(p)}return f}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),u=a?{hiragana:l=>xt.test(l),kanji:l=>Ae.test(l),katakana:l=>kt.test(l),latin:l=>L.test(l)}:{hangul:l=>Ne.test(l),latin:l=>L.test(l)},f=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const l=D(t,u,!1,e,(p,v)=>p==="hiragana"&&v==="katakana"||p==="katakana"&&v==="hiragana"||p==="hiragana"&&v==="latin"||p==="katakana"&&v==="latin"||p==="kanji"&&v==="latin"||p==="latin"&&(v==="hiragana"||v==="katakana"||v==="kanji")),d=[];for(const p of l){const v=p;v.length===1&&f.has(v)&&d.length>0?d[d.length-1]=d.at(-1)+v:d.push(v)}return d.length>0?d:[t]}return D(t,u,!1,e,(l,d)=>l==="hangul"&&d==="latin"||l==="latin"&&d==="hangul")}if(e.startsWith("sl")){const a=[...t],u=a.length,f=[];let l=a[0],d=a[0]===a[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const v=a[p],b=v===v.toLocaleUpperCase(e),y=bo.test(v),N=p<u-1&&a[p+1]===a[p+1].toLocaleUpperCase(e);!d&&b||y&&N?(f.push(l),l=v,y&&N&&(f.push(l),l="")):l+=v,d=b}return l&&l.length>0&&f.push(l),f}if(e.startsWith("zh"))return D(t,{han:a=>Ae.test(a),latin:a=>L.test(a)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=u=>Ce.test(u)||_e.test(u);return D(t,{latin:u=>L.test(u),rtl:u=>a(u)},!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=u=>It.test(u)||Lt.test(u)||Et.test(u)||Pt.test(u)||Ut.test(u)||Mt.test(u)||Dt.test(u)||Tt.test(u)||Vt.test(u)||St.test(u)||jt.test(u)||Bt.test(u)||Rt.test(u)||zt.test(u)||Wt.test(u)||Ft.test(u);return D(t,{indic:u=>a(u),latin:u=>L.test(u)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return D(t,{cyrillic:a=>W.test(a),latin:a=>L.test(a)},!0,e);if(["ar","fa","he"].includes(e))return D(t,{latin:a=>L.test(a),rtl:a=>Ce.test(a)||_e.test(a)},!1,e);if(e.startsWith("ko"))return D(t,{hangul:a=>Ne.test(a),latin:a=>L.test(a)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!L.test(t))return[t];const a=[...t],u=a.length,f=[];let l=a[0],d=a[0]===a[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const v=a[p],b=v===v.toLocaleUpperCase(e);if(Oe.test(v)||Oe.test(a[p-1])){l+=v;continue}!d&&b?(f.push(l),l=v):l+=v,d=b}return l&&l.length>0&&f.push(l),f}const s=[...t],o=s.length,c=[];let r=s[0],g=s[0]===s[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){c.push(a),r=s[a.length],g=r===r.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const u=s[a],f=u===u.toLocaleUpperCase(e);let l=0;for(const d of n)if(t.startsWith(d,a)){c.push(r,d),l=d.length,r="";const p=d.at(-1);p&&(g=p===p.toLocaleUpperCase(e));break}if(l>0){a+=l-1;continue}!g&&f?(c.push(r),r=u):r+=u,g=f}return r&&c.push(r),c},Oo=(t,e,n)=>{const i=[],s=ne.test(t)?t.split(ne).filter(Boolean):[t];for(const o of s){const c=o;if(ne.test(c))i.push(c);else{B.lastIndex=0;const r=B.test(c)?vo(c).filter(Boolean):[c];for(const g of r)if(B.lastIndex=0,B.test(g))i.push(g);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...it(g,a,n))}else i.push(...ot(g,n))}}return i},Ao=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:s=[],locale:o,normalize:c=!1,separators:r,stripAnsi:g=!1,stripEmoji:a=!1}=e,u=new Set([...s].toSorted((y,N)=>N.length-y.length));let f=t;g&&(f=go(f)),a&&(f=Ct(f));let l;Array.isArray(r)?l=yo(r):r instanceof RegExp?l=r:l=_t;const d=[];let p=f;const v=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;p.length>0;){const y=v.exec(p);if(!y){p===".."?d.push(".."):p==="."?d.push("."):p.length>0&&d.push(p);break}const N=y.index,C=y[0],k=C.length,h=p.slice(0,N),m=p.slice(N+k);if(C.startsWith("../"))d.push(".."),p=p.slice(N+3);else if(C.startsWith("./"))d.push("."),p=p.slice(N+2);else if(N===0&&C==="..")d.push(".."),p=p.slice(2);else if(N===0&&C===".")d.push("."),p=p.slice(1);else{h.length>0&&d.push(h);let w=0;for(;(w=C.indexOf("../",w))!==-1;)d.push(".."),w+=3;for(w=0;(w=C.indexOf("./",w))!==-1;)(w===0||C[w-1]!==".")&&d.push("."),w+=2;let $=m;for(;$.startsWith("../");)d.push(".."),$=$.slice(3);for(;$.startsWith("./");)d.push("."),$=$.slice(2);if($===".."){d.push("..");break}else if($==="."){d.push(".");break}else p=$}v.lastIndex=0}if(d.length===0){const y=f.split(l).filter(Boolean);d.push(...y)}let b=[];for(const y of d)n||i?b.push(...Oo(y,o,u)):o?b.push(...it(y,o,u)):b.push(...ot(y,u));return c&&(b=b.map(y=>u.has(y)?y:o&&y===y.toLocaleUpperCase(o)?y[0]+y.slice(1).toLocaleLowerCase(o):y.toUpperCase()===y&&!u.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),b},No=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Co=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let s="",o="";for(let c=0;c<n;c++){const r=t[c];if(ne.test(r)){s?(i.push(s+o+r),s="",o=""):(i.length>0&&i.push(e),s=r);continue}s?(o&&(o+=e),o+=r):(i.length>0&&i.push(e),i.push(r))}return i.join("")},st=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Co(Ao(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{const o=s,c=o.toLowerCase();return n?(n=!1,po(c)):No(c)}),"")},_o=t=>{t.options?.forEach(e=>{e.__camelCaseName__=st(e.name)})},ko=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 s=i.name.replace(/^no-/,"");if(!e.has(s)){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:s};n.push(o),e.add(s)}}n.length>0&&t.options.push(...n)},xo=(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=st(o.name);i.set(c,o)}const s=Object.keys(n).filter(o=>i.has(o));if(s.length!==0)for(const o of s){const c=o.charAt(2);if(!c)continue;const r=c.toLowerCase()+o.slice(3),g=i.get(o);g&&(g.__negated__=!0),n[r]=!n[o],Reflect.deleteProperty(n,o)}},Io=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:i}=t;for(const s of Object.keys(i)){const o=n.get(s);if(o?.implies){const{implies:c}=o;for(const[r,g]of Object.entries(c))i[r]===void 0&&(i[r]=g)}}},Lo=()=>!!process.versions.electron,Eo=()=>Lo()&&!process.defaultApp,Po=()=>Eo()?0:1,Uo=t=>t.slice(Po()+1),Mo=" ",Do=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),To=t=>{if(typeof t=="string")return t.split(Mo);const e=me();return Do(t,e)?Uo(t):t},Vo=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),G(1)},n=(o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let r;if(typeof o=="string")r=o;else try{r=JSON.stringify(o)}catch{r=String(o)}t.error(`Promise rejection: ${r}`)}G(1)},i=be("uncaughtException",e),s=be("unhandledRejection",n);return()=>{i(),s()}},je=100,So=/^[a-z][\w-]*$/i,ge=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new A(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},Be=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new A(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},fe=(t,e)=>{if(typeof t!="object"||t===null)throw new A(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},ee=t=>{const e=ge(t,"Command name");if(e.length>je)throw new A(`Command name is too long (maximum ${String(je)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new A(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!So.test(e))throw new A(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},jo=new Set([`
4
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Bo=(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(jo.has(n))throw new Error(`Argument contains dangerous character: ${n}`)}return t.trim()},Re=(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=>Bo(n,e))},Ro=/^-([^\d-])$/,zo=/^--(\S+)/,Wo=/^-([^\d-]{2,})$/,de=t=>Ro.test(t)||zo.test(t)||Wo.test(t),Fo={access:(t,e)=>mt(t,e),mkdir:(t,e)=>dt(t,e),readdir:t=>ft(t),readFile:(async(t,e)=>e===void 0?ye(t):ye(t,e)),rm:(t,e)=>pt(t,e),stat:t=>ht(t),writeFile:(t,e,n)=>ut(t,e,n)};class at{#t;#e;#c;#u;#p;#f;#v;#b;#$;#O;#A;#h;#n;#o;#i;#s;#a;#d=!1;#N;#C=!1;#m;#g;#w;#l=[];#L(){return this.#m===void 0&&(this.#m=[...this.#o.keys()]),this.#m}#_(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#r(){return this.#w===void 0&&(this.#w=[...this.#L(),...this.#_()]),this.#w}#k(){return this.#l.length===0?X:[...X,...this.#l]}#x(){this.#m=void 0,this.#g=void 0,this.#w=void 0}#y(){if(this.#c===void 0){const e=To(this.#e.argv);this.#c=Re(e,!1),this.#E()}return this.#c}#E(){if(!this.#c)return;const e=j();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(wt),n=!0;break}if(i==="--debug"){e.CEREBRO_OUTPUT_LEVEL=String(q),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(q):String(ve))}#P(){this.#C||(this.#N=Vo(this.#t),this.#C=!0)}#U(){return{arch:vt(),argv:this.#y(),cwd:this.#u,env:this.#O??j(),exit:this.#$??(e=>G(e??0)),platform:yt(),stdin:this.#A}}#I(e,n,i,s){this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:r}=oo(e,n,this.#k()),g=Object.keys(c).length>0;let a=r;g&&(a={...r,_all:{...r._all,...c}}),ro(o,a,e);const u=no(e,r,c,i);u.runtime=this,u.argv=this.#y(),u.fs=this.#b??Fo,u.process=this.#U(),u.console=this.#t;const f=e.options&&e.options.length>0;if(f&&e.options){const l=e.options.filter(d=>d.name.startsWith("no-"));for(const d of l){const p=d.name.replace(/^no-/,""),v=`--${d.name}`,b=`--${p}`,y=n.includes(v),N=n.includes(b);if(y&&N)throw new We(p,d.name)}}return f&&(xo(u,e),Io(u,e)),lo(o,u.options,e),j().CEREBRO_OUTPUT_LEVEL===String(q)&&(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:r,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new A("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#p=e.trim();const i=n.argv??me(),s=n.cwd??bt();if(this.#e={...n,argv:i,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new A("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 A("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new A("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new A("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=j();if(o.CEREBRO_OUTPUT_LEVEL=String(ve),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],f=[],l=this.#e.logger;for(const d of u)typeof l[d]!="function"&&f.push(d);if(f.length>0)throw new A(`Logger object is missing required methods: ${f.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:f});this.#t=this.#e.logger}else this.#t={...console,debug:(...u)=>{o.CEREBRO_OUTPUT_LEVEL===String(q)&&console.debug(...u)}};this.#f=this.#e.packageVersion,this.#v=this.#e.packageName,this.#u=this.#e.cwd,this.#s="help",this.#a={};const c=n.fs;if(c!==void 0&&(typeof c!="object"||c===null))throw new A("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const r=n.exit;if(r!==void 0&&typeof r!="function")throw new A("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 A("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 A("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.#a=e,this}getCommandSection(){return this.#a.header||(this.#a.header=`${this.#p}${this.#f?` v${this.#f}`:""}`),this.#a}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){fe(e,"Command"),ee(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new A(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new A(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ee(e.alias):Be(e.alias,"Command alias").forEach(a=>ee(a))),e.argument&&fe(e.argument,"Command argument"),e.options&&fe(e.options,"Command options"),e.commandPath&&(Be(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{ee(a)}));const s=Ve(e.name,e.commandPath),o=V(s);if(this.#o.has(o))throw new A(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,r=this.#n.get(e.name),g=r!==void 0&&(r.commandPath===void 0||r.commandPath.length===0);if(!c&&g)throw new A(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)ke(a);if(co(e),ko(e),_o(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),c&&r!==void 0)this.#n.set(o,e);else{if(!c&&r!==void 0&&!g){const a=Ve(r.name,r.commandPath);this.#n.set(V(a),r)}this.#n.set(e.name,e)}if(this.#o.set(o,s),this.#i.set(o,e),this.#x(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const u of a){if(j().CEREBRO_OUTPUT_LEVEL===String(q)&&this.#t.debug("adding alias",u),this.#n.has(u))throw new A(`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(X.map(o=>o.name)),s=new Set(X.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new A(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new A(`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 A(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",ke(n),this.#l.push(n),this}getGlobalOptions(){return this.#k()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#h?this.#h:(this.#h=new Gt(this.#t),this.#h.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#h)}getCliName(){return this.#p}getPackageVersion(){return this.#f}getPackageName(){return this.#v}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#N?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...s}=e;if(!this.#n.has("help")){const{default:h}=await import("../commands/help-command.js");this.addCommand(new h(this.#n))}const o=this.#_(),c=this.#o;this.#P();const r=this.#y();let g,a=[...r];const u=$t(),f=Ot(),l=me();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${f.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const d=uo(c,[...r]);if(d.commandPath)g=d.commandPath,a=d.argv;else{if(r.length>1&&r[0]&&r[1]&&!de(r[0])&&!de(r[1])){const m=[];let w=0;for(;w<r.length;){const O=r[w];if(!O||de(O))break;m.push(O),w+=1}const $=V(m);if(m[0]&&!o.includes(m[0])){const O=this.#r(),P=S($,O);throw new T($,P)}}let h;try{h=Zt([null,...o],[...r])}catch(m){if(m instanceof Error&&m.name==="INVALID_COMMAND"&&"command"in m){const w=m.command,$=this.#r(),O=S(w,$);throw new T(w,O)}throw m}h.command&&(g=[h.command],a=h.argv)}if(!g)if(this.#s)g=[this.#s];else{const h=this.#r();throw new T("",h)}const p=V(g),v=this.#o.get(p);let b;if(v){if(b=this.#i.get(p),!b||V(v)!==p){const h=this.#r(),m=S(p,h);throw new T(p,m)}}else{const h=g.at(-1);if(b=h?this.#n.get(h):void 0,!b){const m=this.#r(),w=S(p,m);throw new T(p,w)}}if(typeof b.execute!="function"&&typeof b.loader!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),i?G(1):void 0;const y=a;let N,C;try{({commandArgs:N,toolbox:C}=this.#I(b,y,s,p))}catch(h){if(this.#t.error(h),i)return G(1);throw h}const k=this.getPluginManager();try{!this.#d&&k.hasPlugins()&&(await k.init({cli:this,cwd:this.#u,logger:this.#t}),this.#d=!0),await k.executeLifecycle("execute",C),await k.executeLifecycle("beforeCommand",C);let h;const m=N.global;if(m?.help){const w=this.#n.get("help");if(!w)throw new A("Help command not found","COMMAND_NOT_FOUND");h=await F(w,C)}else if(m?.version??m?.V){const w=this.#n.get("version");if(!w)throw new A("Version command not found","COMMAND_NOT_FOUND");h=await F(w,C)}else h=await F(b,C);return await k.executeLifecycle("afterCommand",C,h),i?G(0):void 0}catch(h){throw await k.executeErrorHandlers(h,C),h}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;ge(e,"Command name");const o=e.split(" ").filter(Boolean),c=V(o),r=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!r){const l=this.#r(),d=S(c||e,l);throw new T(e,d)}if(typeof r.execute!="function"&&typeof r.loader!="function")throw new A(`Command "${r.name}" has no function to execute`,"INVALID_COMMAND",{commandName:r.name});const g=[...Re(i,!1)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:a,toolbox:u}=this.#I(r,g,s,c||e),f=this.getPluginManager();try{!this.#d&&f.hasPlugins()&&(await f.init({cli:this,cwd:this.#u,logger:this.#t}),this.#d=!0),await f.executeLifecycle("execute",u),await f.executeLifecycle("beforeCommand",u);let l;const d=a.global;if(d?.help){const p=this.#n.get("help");if(!p)throw new A("Help command not found","COMMAND_NOT_FOUND");l=await F(p,u)}else if(d?.version??d?.V){const p=this.#n.get("version");if(!p)throw new A("Version command not found","COMMAND_NOT_FOUND");l=await F(p,u)}else l=await F(r,u);return await f.executeLifecycle("afterCommand",u,l),l}catch(l){throw await f.executeErrorHandlers(l,u),l}}clone(e){const n={...this.#e,...e},i=new at(this.#p,n);for(const[s,o]of this.#n)i.#n.set(s,o);for(const[s,o]of this.#o)i.#o.set(s,[...o]);for(const[s,o]of this.#i)i.#i.set(s,o);for(const s of this.#l)i.#l.push(s);return i.#s=this.#s,i.#a={...this.#a},i.#x(),i}async getAction(e){ge(e,"Command name");const n=e.split(" ").filter(Boolean),i=V(n),s=this.#o.get(i)?this.#i.get(i):this.#n.get(e);if(!s){const o=this.#r(),c=S(i||e,o);throw new T(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return Xe(s);throw new A(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}export{at as Cli};
@@ -0,0 +1,76 @@
1
+ import{createRequire as M}from"node:module";import{O as ur,C as cr,V as lr,_ as fr}from"./renderError-DJiY-69l-s_7rEsoy.js";import{E as mr,u as dr}from"./isVisulimaError-jVZgumOU-C67qeq6-.js";const V=M(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[r,t]=b.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return b.getBuiltinModule(e)}return V(e)},{createRequire:U}=B("node:module");var q=Object.defineProperty,z=(e,r)=>q(e,"name",{value:r,configurable:!0}),K=Object.defineProperty,w=z((e,r)=>K(e,"name",{value:r,configurable:!0}),"l");const N=w((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"),Y=/\n|\r(?!\n)/,H=w(e=>e.split(Y).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),"getLineStartIndexes"),He=w((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=H(e),i=N(r,a);return{column:r-a[i]+1,line:i+1}}const o=N(r,e);return{column:r-e[o]+1,line:o+1}},"indexToLineColumn");var X=Object.defineProperty,W=(e,r)=>X(e,"name",{value:r,configurable:!0}),G=Object.defineProperty,Q=W((e,r)=>G(e,"name",{value:r,configurable:!0}),"t");const Xe=Q(({applicationType:e,error:r,file:t})=>`You are a very skilled ${t.language??"unknown"} programmer.
2
+
3
+ ${e?`You are working on a ${e} application.`:""}
4
+
5
+ Use the following context to find a possible fix for the exception message at the end. Limit your answer to 4 or 5 sentences. Also include a few links to documentation that might help.
6
+
7
+ Use this format in your answer, make sure links are json:
8
+
9
+ FIX
10
+ insert the possible fix here
11
+ ENDFIX
12
+ LINKS
13
+ {"title": "Title link 1", "url": "URL link 1"}
14
+ {"title": "Title link 2", "url": "URL link 2"}
15
+ ENDLINKS
16
+ ---
17
+
18
+ Here comes the context and the exception message:
19
+
20
+ Line: ${String(t.line)}
21
+
22
+ File:
23
+ ${t.file}
24
+
25
+ Snippet including line numbers:
26
+ ${t.snippet??""}
27
+
28
+ Exception class:
29
+ ${r.name}
30
+
31
+ Exception message:
32
+ ${r.message}`,"aiPrompt");var Z=Object.defineProperty,ee=(e,r)=>Z(e,"name",{value:r,configurable:!0}),re=Object.defineProperty,I=ee((e,r)=>re(e,"name",{value:r,configurable:!0}),"o");const A=I((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"),We=I(e=>{const r=A("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=A("LINKS","ENDLINKS",e),n=t?t.split(`
33
+ `).map(a=>a.trim()).filter(Boolean).map(a=>{try{return JSON.parse(a)}catch{return}}).filter(a=>a!==void 0):[],o=n.length>0?`
34
+
35
+ ## Links
36
+
37
+ ${n.map(a=>`- <a href="${a.url}" target="_blank" rel="noopener noreferrer">${a.title}</a>`).join(`
38
+ `)}`:"";return`${r.replaceAll(/"([^"]*)"(?:\s|\.)/g,"<code>$1</code> ")}${o}
39
+
40
+ --------------------
41
+ This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`},"aiSolutionResponse");var te=Object.defineProperty,ne=(e,r)=>te(e,"name",{value:r,configurable:!0}),oe=Object.defineProperty,ae=ne((e,r)=>oe(e,"name",{value:r,configurable:!0}),"n");const Ge={handle:ae(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 ie=Object.defineProperty,se=(e,r)=>ie(e,"name",{value:r,configurable:!0}),ue=Object.defineProperty,s=se((e,r)=>ue(e,"name",{value:r,configurable:!0}),"t");const ce=s(e=>`\`\`\`
43
+ ${e.trim()}
44
+ \`\`\``,"code"),v=s(e=>`\`\`\`bash
45
+ ${e.trim()}
46
+ \`\`\``,"bash"),$=s(e=>`\`\`\`ts
47
+ ${e.trim()}
48
+ \`\`\``,"ts"),le=s(e=>`\`\`\`js
49
+ ${e.trim()}
50
+ \`\`\``,"js"),f=s((e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},"has"),fe=[{name:"esm-cjs-interop",test:s(e=>{const{message:r}=e;if(f(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:",v(`node -v
51
+ cat package.json | jq .type`),"","Example dynamic import in CJS:",le("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
52
+ `),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:s(e=>{const{message:r}=e;if(f(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:",$(`export default function Component() {}
53
+ // import Component from './file'`),"","Named export example:",$(`export function Component() {}
54
+ // import { Component } from './file'`)].join(`
55
+ `),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:s(e=>{const{message:r}=e;if(f(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:",v(`lsof -i :3000
56
+ kill -9 <PID>`),"","On Windows (PowerShell):",v(`netstat -ano | findstr :3000
57
+ taskkill /PID <PID> /F`)].join(`
58
+ `),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:s((e,r)=>{const{message:t}=e;if(f(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:",ce(`${r.file}:${String(r.line)}`)].join(`
59
+ `),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:s(e=>{const{message:r}=e;if(f(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:",$(`{
60
+ "compilerOptions": {
61
+ "baseUrl": ".",
62
+ "paths": { "@/*": ["src/*"] }
63
+ }
64
+ }`)].join(`
65
+ `),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:s(e=>{const{message:r}=e;if(f(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.","",v(`ping <host>
66
+ nslookup <host>
67
+ curl -v http://<host>:<port>`)].join(`
68
+ `),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:s(e=>{const{message:r}=e;if(f(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.","",$("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
69
+ `),title:"Accessing property of undefined"}},"test")}],Qe={handle:s((e,r)=>{try{const t=fe.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 pe=Object.defineProperty,C=(e,r)=>pe(e,"name",{value:r,configurable:!0}),me=Object.defineProperty,de=C((e,r)=>me(e,"name",{value:r,configurable:!0}),"s");let p=class extends Error{static{C(this,"e")}static{de(this,"NonError")}constructor(r){super(r),this.name="NonError"}};var be=Object.defineProperty,ge=(e,r)=>be(e,"name",{value:r,configurable:!0}),ye=Object.defineProperty,he=ge((e,r)=>ye(e,"name",{value:r,configurable:!0}),"e");const er=he(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace");var ve=Object.defineProperty,$e=(e,r)=>ve(e,"name",{value:r,configurable:!0}),je=Object.defineProperty,O=$e((e,r)=>je(e,"name",{value:r,configurable:!0}),"n");const y=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&y.set("AggregateError",AggregateError);const rr=O((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(y.has(n))throw new Error(`The error constructor "${n}" is already known.`);y.set(n,e)},"addKnownErrorConstructor");O(()=>new Map(y),"getKnownErrorConstructors");const _=O(e=>y.get(e),"getErrorConstructor"),E=O(e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(_(e.name)!==void 0||e.name==="Error"),"isErrorLike");var Oe=Object.defineProperty,Ee=(e,r)=>Oe(e,"name",{value:r,configurable:!0}),Pe=Object.defineProperty,c=Ee((e,r)=>Pe(e,"name",{value:r,configurable:!0}),"s");const D=c(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"),Se={maxDepth:Number.POSITIVE_INFINITY},J=c((e,r,t=0)=>E(e)?x(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new p(JSON.stringify(e)):new p(JSON.stringify(e)),"deserializePlainObject"),we=c((e,r,t,n,o)=>{const a=r.map(i=>h(i,n,o+1));return new e(a,t)},"reconstructAggregateError"),x=c((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new p(JSON.stringify(e));const{cause:n,errors:o,message:a,name:i,stack:u,...d}=e,k=_(i)??Error,l=i==="AggregateError"&&Array.isArray(o)?we(k,o,a,r,t):new k(a);return!l.name&&i&&(l.name=i),a!==void 0&&(l.message=a),u&&(l.stack=u),xe(l,d,n,i,r,t),n!==void 0&&(l.cause=h(n,r,t+1)),ke(l,e),l},"reconstructError"),h=c((e,r,t)=>{if(D(e)){if(E(e))return J(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"),xe=c((e,r,t,n,o,a)=>{const i=e;for(const[u,d]of Object.entries(r))if(!(u==="cause"&&t!==void 0)){if(u==="errors"&&n==="AggregateError")continue;i[u]=h(d,o,a+1)}},"restoreErrorProperties"),ke=c((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"),T=c(e=>new p(JSON.stringify(e)),"handlePrimitive"),Ne=c(e=>new p(JSON.stringify(e)),"handleArray"),Ae=c((e,r)=>E(e)?x(e,r,0):J(e,r),"handlePlainObject"),tr=c((e,r={})=>{const t={...Se,...r};return e instanceof Error?e:e===null?T(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?T(e):Array.isArray(e)?Ne(e):E(e)?x(e,t,0):D(e)?Ae(e,t):new p(JSON.stringify(e))},"deserialize");var Te=Object.defineProperty,L=(e,r)=>Te(e,"name",{value:r,configurable:!0});const Ie=U(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ce=L(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 Ie(e)},"__cjs_getBuiltinModule"),{inspect:_e}=Ce("node:util");var De=Object.defineProperty,Je=L((e,r)=>De(e,"name",{value:r,configurable:!0}),"s");const nr=Je(e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${_e(e)}`);break}if(t.push(n),r.add(n),typeof n!="object"||!("cause"in n))break;n=n.cause}return t},"getErrorCauses");var Le=Object.defineProperty,Fe=(e,r)=>Le(e,"name",{value:r,configurable:!0}),Re=Object.defineProperty,F=Fe((e,r)=>Re(e,"name",{value:r,configurable:!0}),"s");const Me=F(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"),or=F((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(Me(n));return t.join(`
76
+ `)},"formatStacktrace");var Ve=Object.defineProperty,Be=(e,r)=>Ve(e,"name",{value:r,configurable:!0});const Ue=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 qe=Object.defineProperty,m=Be((e,r)=>qe(e,"name",{value:r,configurable:!0}),"i");const ze=m(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"),P=new WeakSet,R=m(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)&&R(n.value))}},"makePropertiesEnumerable"),Ke=m(e=>{P.add(e);const r=e.toJSON();return P.delete(e),Object.isExtensible(r)&&R(r),r},"toJSON"),S=m((e,r,t,n,o=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(t+=1,j(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(ze(e)){if(o.has(e))return"[Circular]";if(n.maxDepth!==void 0&&n.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=n.maxDepth)return{};t+=1,o.add(e);const a={};for(const i in e)a[i]=S(e[i],r,t,n,o);return o.delete(e),a}try{return e}catch{return"[Not Available]"}},"serializeValue"),j=m((e,r,t,n)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!P.has(e))return Ke(e);const o=Object.create(Ue);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 u of e.errors){if(!(u instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(u))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;i.push(j(u,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:j(a,r,t,n),writable:!0});else{const i=S(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 u=e[i],d=S(u,t,n,r);Object.defineProperty(o,i,{configurable:!0,enumerable:!0,value:d,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"),ar=m((e,r={})=>j(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0),"serialize");export{ur as CODE_FRAME_POINTER,p as NonError,mr as VisulimaError,rr as addKnownErrorConstructor,Xe as aiPrompt,We as aiSolutionResponse,er as captureRawStackTrace,cr as codeFrame,tr as deserializeError,Ge as errorHintFinder,Me as formatStackFrameLine,or as formatStacktrace,nr as getErrorCauses,He as indexToLineColumn,E as isErrorLike,dr as isVisulimaError,lr as parseStacktrace,fr as renderError,Qe as ruleBasedFinder,ar as serializeError};
@@ -0,0 +1 @@
1
+ import{E as r}from"./isVisulimaError-jVZgumOU-C67qeq6-.js";class n extends r{code;context;constructor(e,t,o){super({message:e,name:"CerebroError"}),this.code=t,this.context=o}}export{n as t};
@@ -0,0 +1 @@
1
+ const e=String.raw,p=e`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,i=()=>new RegExp(e`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${p}(?:\u200D${p})*`,"gu");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 r=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,t=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,n=i(),a=/[-_./\s]+/g,E=/(\u001B\[[0-9;]*[a-z])/i,c=new RegExp("\\p{Script=Arabic}","u"),g=new RegExp("\\p{Script=Bengali}","u"),S=new RegExp("\\p{Script=Cyrillic}","u"),w=new RegExp("\\p{Script=Devanagari}","u"),R=new RegExp("\\p{Script=Ethiopic}","u"),x=new RegExp("\\p{Script=Greek}","u"),l=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),B=new RegExp("\\p{Script=Gujarati}","u"),F=new RegExp("\\p{Script=Gurmukhi}","u"),m=new RegExp("\\p{Script=Hangul}","u"),o=new RegExp("\\p{Script=Hebrew}","u"),y=new RegExp("\\p{Script=Hiragana}","u"),h=new RegExp("\\p{Script=Han}","u"),k=new RegExp("\\p{Script=Kannada}","u"),G=new RegExp("\\p{Script=Katakana}","u"),b=new RegExp("\\p{Script=Khmer}","u"),d=new RegExp("\\p{Script=Lao}","u"),H=new RegExp("\\p{Script=Latin}","u"),L=new RegExp("\\p{Script=Malayalam}","u"),M=new RegExp("\\p{Script=Myanmar}","u"),T=new RegExp("\\p{Script=Oriya}","u"),j=new RegExp("\\p{Script=Sinhala}","u"),K=new RegExp("\\p{Script=Tamil}","u"),O=new RegExp("\\p{Script=Telugu}","u"),f=new RegExp("\\p{Script=Thai}","u"),s=new RegExp("\\p{Script=Tibetan}","u"),z=/[\u02BB\u02BC\u0027]/u,A=u=>u.replace(n,"");export{y as A,h as C,k as D,c as G,S as H,d as I,H as J,B as K,w as L,R as M,L as N,F as O,M as P,T as Q,x as T,j as U,K as V,O as W,f as X,A as Y,s as Z,z as _,g as b,m as f,a as h,l as j,E as k,r as m,n,G as q,b as v,t as y,o as z};
@@ -0,0 +1,6 @@
1
+ import{createRequire as X}from"node:module";import{m as N,y as O,n as L}from"./constants-CImsldtV-Ces7vzH9.js";import{createTable as E}from"@visulima/tabular";import{NO_BORDER as v}from"@visulima/tabular/style";import r1 from"@visulima/colorize/template";import{d as t1}from"./runtime-process-hJz7FqPN.js";import{bold as s1}from"@visulima/colorize";const Z=X(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[i,r]=b.versions.node.split(".").map(Number);if(i>22||i===22&&r>=3||i===20&&r>=16)return b.getBuiltinModule(e)}return Z(e)},m=b,{execFileSync:e1}=R("node:child_process"),W=R("node:fs"),i1=R("node:tty"),n1=R("node:os"),o1=[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],a1=12288,l1=65510,d1=[12288,12288,65281,65376,65504,65510],u1=8361,c1=65518,h1=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],f1=32,w1=10630,m1=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],p1=4352,g1=262141,V=[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],$=(e,i)=>{let r=0,t=Math.floor(e.length/2)-1;for(;r<=t;){const s=Math.floor((r+t)/2),a=s*2;if(i<e[a])t=s-1;else if(i>e[a+1])r=s+1;else return!0}return!1},q=19968,[b1,y1]=N1(V);function N1(e){let i=e[0],r=e[1];for(let t=0;t<e.length;t+=2){const s=e[t],a=e[t+1];if(q>=s&&q<=a)return[s,a];a-s>r-i&&(i=s,r=a)}return[i,r]}const I1=e=>e<161||e>1114109?!1:$(o1,e),W1=e=>e<a1||e>l1?!1:$(d1,e),$1=e=>e<u1||e>c1?!1:$(h1,e),O1=e=>e<f1||e>w1?!1:$(m1,e),x1=e=>e>=b1&&e<=y1?!0:e<p1||e>g1?!1:$(V,e);function E1(e){return I1(e)?"ambiguous":W1(e)?"fullwidth":$1(e)?"halfwidth":O1(e)?"narrow":x1(e)?"wide":"neutral"}function v1(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Y(e){return v1(e),E1(e)}const z=new Map,x=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,A=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",A1=(e,i)=>{const r=Math.floor(e/65536),t=e%65536;let s=z.get(r);if(s||(s=new Map,z.set(r,s)),s.has(t))return s.get(t);let a;if(A(e)==="latin")a=i.width.regular;else if(A(e)==="control")a=i.width.control;else if(A(e)==="wide")a=i.width.wide;else switch(Y(e)){case"ambiguous":{a=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{a=i.width.fullWidth;break}case"wide":{a=i.width.wide;break}default:a=i.width.regular}return s.set(t,a),a},M1=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,C=(e,i={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?C(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},t=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:s}=e,a=s>1e4;let n=0,o=0,l=s,d=!1;const p=e.includes("\x1B")||e.includes("›");for(;n<s;){if(p&&(e[n]==="\x1B"||e[n]==="›")){if(e.startsWith("\x1B]8;;",n)){const h="\x1B]8;;\x07",w=h.length,S=e.indexOf("\x07",n+5);if(S!==-1){const k=e.indexOf(h,S+1);if(k!==-1){const G=k+w,Q=e.slice(S+1,k).replace(N,""),P=C(Q,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,t-o),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),j=P.width;if(P.truncated)d=!0,l=Math.min(l,n);else if(o+j>t&&(l=Math.min(l,n),d=!0,o+j>r.truncation.limit))break;if(o+=j,n=G,d&&o>=r.truncation.limit)break;continue}}}if(N.lastIndex=n,N.test(e)){const h=N.lastIndex-n,w=r.truncation.countAnsiEscapeCodes?h:r.width.ansi;if(o+w>t&&(l=Math.min(l,n),o+w>r.truncation.limit)){d=!0;break}o+=w,n=N.lastIndex;continue}}const f=e.codePointAt(n);if(f===8203||f===65279||f>=8288&&f<=8292){n+=1;continue}if(f===9){if(o+r.width.tab>t&&(l=Math.min(l,n),o+r.width.tab>r.truncation.limit)){d=!0;break}o+=r.width.tab,n+=1;continue}if(x.lastIndex=n,x.test(e)){const h=(x.lastIndex-n)*r.width.regular;if(o+h>t){const w=Math.floor((t-o)/r.width.regular);if(l=Math.min(l,n+w),o+h>r.truncation.limit){d=!0;break}}o+=h,n=x.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(O.lastIndex=n,O.test(e))){const h=(O.lastIndex-n)*r.width.control;if(o+h>t&&(l=Math.min(l,n+Math.floor((t-o)/r.width.control)),o+h>r.truncation.limit)){d=!0;break}o+=h,n=O.lastIndex;continue}if(L.lastIndex=n,L.test(e)){if(o+r.width.emoji>t&&(l=Math.min(l,n),o+r.width.emoji>r.truncation.limit)){d=!0;break}o+=r.width.emoji,n=L.lastIndex;continue}const g=e.codePointAt(n)??0;if(M1(g)){n+=g>65535?2:1;continue}let c;if(a)c=A1(g,r);else switch(A(g)){case"control":{c=r.width.control;break}case"latin":{c=r.width.regular;break}case"wide":{c=r.width.wide;break}case"zero":{c=0;break}default:switch(Y(g)){case"ambiguous":{c=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{c=r.width.fullWidth;break}case"wide":{c=r.width.wide;break}default:c=r.width.regular}}if(o+c>t&&(l=Math.min(l,n),o+c>r.truncation.limit)){d=!0;break}o+=c,n+=g>65535?2:1}let y=o,F=!1;return d&&r.truncation.limit>=r.truncation.ellipsisWidth&&(y=r.truncation.limit,F=!0),{ellipsed:F,index:d?l:s,truncated:d,width:y}},_1=(e,i={})=>C(e,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,D=80,J=24,B=(e,i,{shell:r,env:t}={})=>e1(e,i,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:t}).trim(),M=(e,i)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(i,10)}),K=(e,i)=>{const{columns:r,rows:t}=M(e,i);if(!(Number.isNaN(r)||Number.isNaN(t))&&!(r===D&&t===J))return{columns:r,rows:t}},R1=()=>{if(m.platform!=="linux")return!0;try{const e=W.readFileSync("/proc/self/stat","utf8"),i=e.lastIndexOf(") ");if(i===-1)return!1;const r=e.slice(i+2).trim().split(/\s+/),t=Number.parseInt(r[2],10),s=Number.parseInt(r[5],10);return Number.isNaN(t)||Number.isNaN(s)||s<=0?!1:t===s}catch{return!1}};function S1(){const{env:e,stdout:i,stderr:r}=m;if(i?.columns&&i?.rows)return M(i.columns,i.rows);if(r?.columns&&r?.rows)return M(r.columns,r.rows);if(e.COLUMNS&&e.LINES)return M(e.COLUMNS,e.LINES);const t={columns:D,rows:J};return m.platform==="win32"?T()??t:m.platform==="darwin"?H()??T()??t:H()??T()??k1()??t}const H=()=>{try{const e=m.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:i,rows:r}=i1.WriteStream(W.openSync("/dev/tty",e));return{columns:i,rows:r}}catch{}},T=()=>{try{const e=B("tput",["cols"],{env:{TERM:"dumb",...m.env}}),i=B("tput",["lines"],{env:{TERM:"dumb",...m.env}});if(e&&i)return K(e,i)}catch{}},k1=()=>{try{if(!R1())return;const e=B("resize",["-u"]).match(/\d+/g);if(e.length===2)return K(e[0],e[1])}catch{}},I=new Map,j1=500,u=e=>{if(!e||e==="")return"";const i=I.get(e);if(i!==void 0)return i;const r=r1(Object.assign([],{raw:[e]}));if(I.size>=j1){const t=I.keys().next().value;t!==void 0&&I.delete(t)}return I.set(e,r),r},_=()=>{const e=t1().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const i=Number.parseInt(e,10);if(!(Number.isNaN(i)||i<=0))return i};let U=class{lines;constructor(){this.lines=[]}add(i){this.lines.push(i)}toString(){return this.lines.join(n1.EOL)}header(i){this.add(s1(i)),this.lines.push("")}};const L1=e=>e!==void 0&&e>0?e:S1().columns,T1=(e,i,r,t)=>{if(e.length===0||e.some(d=>d.length!==2))return;let s=0;for(const d of e){const p=d[0];if(p===void 0)continue;const y=_1(p);y>s&&(s=y)}if(s===0)return;const a=r+t,n=s+a,o=20+a;if(n+o>i)return;const l=i-n;return[n,l]};class C1 extends U{constructor(i){if(super(),i.header&&this.header(u(i.header)),i.content){if(i.raw)if(Array.isArray(i.content)&&i.content.every(r=>typeof r=="string"))i.content.forEach(r=>{Array.isArray(r)?r.forEach(t=>{this.add(u(t))}):this.add(u(r))});else if(typeof i.content=="string")this.add(u(i.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(i.content));this.add("")}}getContentLines(i){if(typeof i=="string"){const r=E({showHeader:!1,style:{border:v,paddingLeft:4,paddingRight:1},terminalWidth:_(),truncateOverflow:!1,wordWrap:!0});return r.addRow([u(i)]),r.toString()}if(Array.isArray(i)&&i.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(t=>typeof t=="string"))){const r=L1(_()),t=o=>Array.isArray(o)?o.map(l=>u(l)):[u(o)],s=i.map(o=>t(o)),a=T1(s,r,4,1),n=E({columnWidths:a,showHeader:!1,style:{border:v,paddingLeft:4,paddingRight:1},terminalWidth:r,truncateOverflow:!1,wordWrap:!0});return s.forEach(o=>{a!==void 0&&o.length===2?n.addRow([{content:o[0],wordWrap:!1},o[1]]):n.addRow(o)}),n.toString()}if(typeof i=="object"){const r=i;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
2
+ ${JSON.stringify(i)}`);const t=E({showHeader:!1,style:{border:v,paddingLeft:4,paddingRight:1},terminalWidth:_(),truncateOverflow:!1,wordWrap:!0});return r.data.forEach(s=>{Array.isArray(s)?t.addRow(s.map(a=>u(a))):t.addRow([u(s)])}),t.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
+
4
+ ${JSON.stringify(i)}`)}}class B1 extends U{constructor(i){super();let r=i.optionList??[];const t=Array.isArray(i.hide)?i.hide:[i.hide].filter(n=>typeof n=="string"),s=Array.isArray(i.group)?i.group:[i.group].filter(n=>typeof n=="string");t.length>0&&(r=r.filter(n=>!t.includes(n.name))),i.header&&this.header(u(i.header)),s.length>0&&(r=r.filter(n=>{const o=n,l=s.includes("_none")&&!o.group,d=o.group,p=this.intersect(Array.isArray(d)?d:[d],s);return l||p?n:void 0}));const a=E({showHeader:!1,style:{border:v,paddingLeft:2,paddingRight:1,...i.tableOptions?.style},terminalWidth:_()??i.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:i.tableOptions?.wordWrap??!0,...i.tableOptions});r.forEach(n=>{const o=n;a.addRow([this.getOptionNames(o,i.reverseNameOrder??!1,i.isArgument??!1),u(o.description)])}),this.add(a.toString()),this.lines.push("")}getOptionNames(i,r,t){if(!i.name)throw new TypeError("Invalid option definition, name is required.");let s=i.type?i.type.name.toLowerCase():"string";const a=i.multiple||i.lazyMultiple?"[]":"";s=u(i.typeLabel??`{underline ${s}${a}}`);let n;if(i.alias)if(i.name){const o=t?i.name:`{yellow --${i.name}}`;n=u(r?`{bold ${o}}, {bold -${i.alias}} ${s}`:`{bold -${i.alias}}, {bold ${o}} ${s}`)}else r?n=u(`{bold -${i.alias}} ${s}`):n=u(`{bold -${i.alias}} ${s}`);else n=u(`{bold ${t?i.name:`{yellow --${i.name}}`}} ${s}`);return n}intersect(i,r){return i.some(t=>r.includes(t))}}const J1=e=>(Array.isArray(e)?e:[e]).length===0?"":`
5
+ ${e.map(i=>i.optionList?new B1(i).toString():new C1(i).toString()).join(`
6
+ `)}`;export{u as a,J1 as r};
@@ -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 l=Object.defineProperty,s=(e,t)=>l(e,"name",{value:t,configurable:!0}),u=Object.defineProperty,i=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"t");const m=i(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class E extends Error{static{s(this,"VisulimaError")}static{i(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:a,message:o,name:c,stack:n,title:h}){super(o,{cause:t}),this.title=h,this.name=c,this.stack=n??this.stack,this.loc=a,this.hint=r}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{E,m as u};
@@ -0,0 +1 @@
1
+ const e=(a,t)=>async()=>({default:(await a())[t]});export{e as lazyNamed};